Logo de IMAP MCP Server

IMAP MCP Server

Communauté
nikolausm

A powerful Model Context Protocol (MCP) server for IMAP email integration with Claude

Éditeurnikolausm
Dépôtimap-mcp-server
LangueTypeScript
Forks
48
Étoiles
96
Outils disponibles
35
Type de transportstdio
Catégories
LicenceMIT
Liens
  • Connectez des outils à vos workflows IA

    IMAP MCP Server propose des fonctionnalités MCP utilisables par les clients et agents IA compatibles.

  • 35 outils disponibles

    Parcourez les actions invocables ci-dessous, avec leurs noms et descriptions lorsque le serveur les fournit.

  • Configuration prête à copier

    Utilisez les exemples de configuration pour configurer ce serveur dans votre client MCP préféré.

  • Indicateurs de popularité open source

    96 étoiles et 48 forks sur le dépôt associé.

IMAP MCP Server

A powerful Model Context Protocol (MCP) server that provides seamless IMAP email integration with secure account management and connection pooling.

Features

  • 🔐 Secure Account Management: Encrypted credential storage with AES-256 encryption
  • 🚀 Connection Pooling: Efficient IMAP connection management
  • 📧 Comprehensive Email Operations: Search, read, move, mark, delete, and bulk delete emails
  • ✉️ Email Sending: Send, reply, and forward emails via SMTP
  • 📁 Folder Management: List folders, check status, get unread counts
  • 🔄 Multiple Account Support: Manage multiple IMAP accounts simultaneously
  • 🛡️ Type-Safe: Built with TypeScript for reliability
  • 🌐 Web-Based Setup Wizard: Easy account configuration with provider presets
  • 📱 15+ Email Providers: Pre-configured settings for Gmail, Outlook, Yahoo, and more
  • 🔗 Auto SMTP Configuration: Automatic SMTP settings based on IMAP provider

Installation

Requires Node.js 22.12 or newer. Node 18 and 20 have both reached end-of-life, and several of this package's dependencies no longer support them. Check yours with node --version.

Run via npx (No Installation Required)

Once published to npm, you can run the server directly without cloning or building anything — npx downloads the prebuilt package and runs it:

bash
npx -y imap-mcp-server

This is the easiest way to use the server in an MCP client (see Configuration for ready-to-paste npx configs).

Quick Install (Recommended)

macOS/Linux:

bash
curl -fsSL https://raw.githubusercontent.com/nikolausm/imap-mcp-server/main/install.sh | bash

Windows (PowerShell as Administrator):

powershell
iwr -useb https://raw.githubusercontent.com/nikolausm/imap-mcp-server/main/install.ps1 | iex

Manual Installation

  1. Clone the repository:
bash
git clone https://github.com/nikolausm/imap-mcp-server.git
cd imap-mcp-server
  1. Install dependencies:
bash
npm install
  1. Build the project:
bash
npm run build

Account Setup

Accounts are stored encrypted in ~/.imap-mcp/accounts.json. This file is shared by all run modes — whether you start the server via npx, a global install, or a local clone, they all read the same accounts. So you only need to set up your accounts once.

Setting Up Accounts in npx Mode

If you run the server via npx (no clone), you have two ways to add accounts:

Option A — Run the setup wizard directly via npx (no install needed):

bash
npx -p imap-mcp-server imap-setup

This launches the same web-based wizard described below and writes to ~/.imap-mcp/accounts.json, which your npx-configured MCP server then picks up automatically.

Option B — Add accounts straight from your AI client:

Once the MCP server is configured, just ask your assistant to add an account — it uses the imap_add_account tool. For example:

"Add my IMAP account: host imap.gmail.com, port 993, user me@gmail.com, password …"

No separate setup step required.

Web-Based Setup Wizard (Recommended)

After installation, run the setup wizard:

bash
npm run setup

Or if installed globally:

bash
imap-setup

Or directly via npx without installing:

bash
npx -p imap-mcp-server imap-setup

This will:

  1. Start a local web server
  2. Open your browser to the setup wizard
  3. Guide you through adding email accounts with pre-configured settings

Overriding Credentials via Environment Variables

You can override the username and password of an already-configured account at runtime with environment variables — useful when you inject secrets from a password manager or CI system instead of storing them in accounts.json.

The variables are keyed by the account name, uppercased with every non-alphanumeric character replaced by _. For an account named Work Gmail (key WORK_GMAIL):

VariableOverrides
IMAP_MCP_ACCOUNT_WORK_GMAIL_IMAP_USERNAMEIMAP username (user)
IMAP_MCP_ACCOUNT_WORK_GMAIL_IMAP_PASSWORDIMAP password
IMAP_MCP_ACCOUNT_WORK_GMAIL_SMTP_USERNAMESMTP username (smtp.user)
IMAP_MCP_ACCOUNT_WORK_GMAIL_SMTP_PASSWORDSMTP password

Notes:

  • Overrides apply only to existing accounts; if no account's normalized name matches, the variable is ignored.
  • They are applied in memory only — nothing is written back to accounts.json, and the values are used as-is (not re-encrypted).
  • Variables are consumed at startup: on server start they are captured into an AES-256-encrypted in-memory cache and removed from process.env, so the plaintext secret does not linger in the environment (where it could leak to child processes or diagnostics). Set them before launching the server.

The setup wizard integrates with this: each credential field (IMAP password, IMAP username, SMTP username, SMTP password) has a "Do not save to config; set later using an environment variable" checkbox. When ticked, the value you enter is still used to test the connection, but it is not written to accounts.json — the wizard shows the exact variable name to export, and the account picks the credential up from that variable at runtime.

  • SMTP variables take effect only when the account already has an SMTP config.
  • Each variable takes effect independently; set only the ones you need.

If the variable is missing, the account still holds the empty placeholder the wizard wrote. Rather than dialing out with a blank credential — which providers answer with a generic authentication failure that looks exactly like a wrong password — the server refuses the connection and names what to set:

Account "Work Gmail" has IMAP credentials marked as environment-managed, but
this variable was not set when the server started:
IMAP_MCP_ACCOUNT_WORK_GMAIL_IMAP_PASSWORD. Set it and restart the server, or
store the credentials on the account via imap_update_account.

Because the variables are read once at startup, setting one in an already-running shell has no effect until the server is restarted.

Supported Email Providers

The setup wizard includes pre-configured settings for:

  • Gmail / Google Workspace
  • Microsoft Outlook / Hotmail / Live
  • Yahoo Mail
  • Apple iCloud Mail
  • GMX
  • WEB.DE
  • IONOS (1&1)
  • ProtonMail (with Bridge)
  • Fastmail
  • Zoho Mail
  • AOL Mail
  • mailbox.org
  • Posteo
  • Custom IMAP servers

Configuration

Claude Code (CLI)

Option A — via npx (no clone/build needed)

bash
claude mcp add imap -- npx -y imap-mcp-server

This always runs the latest published version and requires no local build.

Option B — from a local clone

If you use Claude Code in the terminal, add the MCP server with a single command:

Step 1: Make sure you have built the project first (see Manual Installation).

Step 2: Run this command in your terminal:

bash
claude mcp add imap -- node /absolute/path/to/imap-mcp-server/dist/index.js

Important: Replace /absolute/path/to/imap-mcp-server with the actual path where you cloned the repository. For example:

bash
# macOS/Linux example:
claude mcp add imap -- node /Users/yourname/imap-mcp-server/dist/index.js

# Windows example:
claude mcp add imap -- node C:\Users\yourname\imap-mcp-server\dist\index.js

Step 3: Verify it was added:

bash
claude mcp list

You should see imap in the list of configured MCP servers. That's it — the IMAP tools are now available in your Claude Code sessions.

Tip: If you want to remove the server later, run:

bash
claude mcp remove imap

Claude Desktop (GUI App)

Add the IMAP MCP server to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

Option A — via npx (recommended, no clone/build needed):

json
{
  "mcpServers": {
    "imap": {
      "command": "npx",
      "args": ["-y", "imap-mcp-server"],
      "env": {}
    }
  }
}

Option B — from a local clone:

json
{
  "mcpServers": {
    "imap": {
      "command": "node",
      "args": ["/path/to/imap-mcp-server/dist/index.js"],
      "env": {}
    }
  }
}

Restricting tool access (read-only mode / allowlist)

By default all tools are exposed. You can restrict which tools the agent sees using two environment variables (set them under the env key of your MCP config). This is useful when you want to give an assistant read-only access to a mailbox, or expose only a hand-picked subset of tools.

VariableEffect
IMAP_MCP_READ_ONLYWhen truthy (1, true, yes, on), only the safe, read-only tools are registered — searching, reading, listing folders, unread counts, spam analysis. No tool that sends mail, deletes/moves messages, changes flags, or edits accounts is exposed.
IMAP_MCP_ENABLED_TOOLSComma-separated allowlist of tool names — only these are registered. Names are case-insensitive and the imap_ prefix is optional (search_emails ≡ imap_search_emails). When set, it takes precedence over IMAP_MCP_READ_ONLY.

Example — read-only access:

json
{
  "mcpServers": {
    "imap": {
      "command": "npx",
      "args": ["-y", "imap-mcp-server"],
      "env": { "IMAP_MCP_READ_ONLY": "true" }
    }
  }
}

Example — explicit allowlist:

json
{
  "mcpServers": {
    "imap": {
      "command": "npx",
      "args": ["-y", "imap-mcp-server"],
      "env": { "IMAP_MCP_ENABLED_TOOLS": "imap_search_emails,imap_get_email,imap_get_latest_emails" }
    }
  }
}

The read-only subset is: imap_list_accounts, imap_connect, imap_disconnect, imap_test_account, imap_search_emails, imap_get_email, imap_get_latest_emails, imap_download_attachment, imap_find_thread_messages, imap_find_email_by_message_id, imap_list_folders, imap_folder_status, imap_get_unread_count, imap_check_spam, imap_domain_stats, imap_list_spam_domains.

Usage

Once configured, the IMAP MCP server provides the following tools in Claude:

Choosing an account. For the email and folder tools, accountId is optional and backward-compatible. You may instead pass accountName, and if you only have a single account configured you can omit both — that account is used by default. With multiple accounts and no selector, the tool returns a clear error listing your options (imap_list_accounts).

Account Management

  • imap_add_account: Add a new IMAP account

    Parameters:
    - name: Friendly name for the account
    - host: IMAP server hostname
    - port: Server port (default: 993)
    - user: Username
    - password: Password
    - tls: Use TLS/SSL (default: true)
    - allowStartTLS: When tls is false, set to false to also disable the
        opportunistic STARTTLS upgrade imapflow otherwise attempts whenever the
        server advertises it (validating the cert against `host` regardless of
        `tls`). Needed for providers that advertise STARTTLS on a hostname
        covered only by a shared/wildcard cert. Defaults to true.
    - sentFolder: Explicit Sent-folder name for sent-mail copies, e.g. "Gesendet"
        (optional — only needed when the server has no \Sent SPECIAL-USE folder
        and auto-detection fails)
    - defaultBcc: Optional BCC address(es) applied automatically to every
        outbound send, reply, forward, and draft for this account. Merged with
        any per-call `bcc` (duplicates removed case-insensitively)
  • imap_update_account: Update an existing account (fix SMTP settings, rename, etc.)

    Parameters:
    - accountId: ID of the account to update
    - name, host, port, user, password, tls, allowStartTLS, email: IMAP fields (all optional)
    - smtpHost, smtpPort, smtpSecure, smtpUser, smtpPassword: SMTP fields (optional)
    - saveToSent: Save sent emails to the Sent folder (optional)
    - sentFolder: Explicit Sent-folder override (optional). Pass an empty string
        to clear the override and re-enable auto-detection
    - defaultBcc: Optional default BCC address(es) (optional). Pass an empty
        string to clear
  • imap_list_accounts: List all configured accounts

  • imap_remove_account: Remove an account

    Parameters:
    - accountId: ID of the account to remove
  • imap_connect: Connect to an account

    Parameters:
    - accountId OR accountName: Account identifier
  • imap_disconnect: Disconnect from an account

    Parameters:
    - accountId: Account to disconnect

Email Operations

  • imap_search_emails: Search for emails

    Parameters:
    - accountId: Account ID
    - folder: Folder name (default: INBOX; ignored when searchAllFolders is true)
    - searchAllFolders: Search across ALL folders at once (default: false).
        Skips Trash/Spam/Drafts and non-selectable folders by default. Use when a
        message may have been filed/moved/archived and you don't know its folder.
    - includeTrash, includeSpam, includeDrafts: Opt those noisy folders back into
        a searchAllFolders run (default: false each)
    - from, to, subject, body: Search criteria
    - since, before: Date filters
    - seen, flagged: Status filters
    - keywords: Match messages with ANY of these custom keywords (server-side OR).
        Read a mailbox's available custom keywords from `imap_folder_status`'s
        `customKeywords` field first.
    - unKeywords: Exclude messages with ANY of these custom keywords (result has
        NONE of them). Same keyword source as `keywords`.
    - limit: Max results (default: 50)
    - includeBody: Include parsed message body in the response (default: false).
        Fetches the RFC822 source once and parses it with mailparser, so you get
        uid + body in a single tool call instead of paying the N+1 cost of one
        `imap_get_email` per match. Body is rendered per `bodyFormat` and capped
        at `bodyMaxLength` per field.
    - bodyFormat: How to render the body when `includeBody` is true — `markdown`
        (default, clean Markdown via Turndown), `text`, `html`, or `auto`.
    - bodyMaxLength: Per-field cap when `includeBody` is true (default: 10000).

    With searchAllFolders, results include a folder field per message plus foldersSearched, and any folder that failed to open is reported in foldersErrored (so a 0-result answer is never silently incomplete).

    includeBody is honored in the single-folder path only. For a cross-folder sweep the lightweight header shape is preserved by design — pulling RFC822 source for every match across many folders would multiply bandwidth and parse cost. Follow up with imap_get_email for the specific uids whose bodies you need.

    On some servers a "flagged"/starred message carries a custom keyword (e.g. an Open-Xchange color label or Apple's $MailFlagBit*) instead of, or in addition to, the \Flagged system flag — after any flagged search, check each result's customKeywords field before concluding a message is or isn't flagged.

  • imap_get_email: Get full email content

    Parameters:
    - accountId: Account ID
    - folder: Folder name
    - uid: Email UID
    - maxContentLength: Max characters for text/html body (default: 10000)
    - includeAttachmentText: Include text attachment previews (default: true)
    - maxAttachmentTextChars: Max characters per text attachment (default: 100000)
  • imap_get_latest_emails: Get recent emails

    Parameters:
    - accountId: Account ID
    - folder: Folder name (default: INBOX)
    - count: Number of emails (default: 10)
    - includeBody: Include parsed message body (default: false). Same semantics
        as the `includeBody` option on `imap_search_emails` — one round-trip
        instead of N×`imap_get_email`.
    - bodyFormat: `markdown` (default), `text`, `html`, or `auto`.
    - bodyMaxLength: Per-field cap (default: 10000).
  • imap_mark_as_read/unread: Change email read status

    Parameters:
    - accountId: Account ID
    - folder: Folder name
    - uid: Email UID, OR an array of UIDs to flag in one call. Batch uses a
        single IMAP STORE so the operation is atomic at the server level — all
        UIDs are flagged, or none. Useful when triaging many messages at once.
  • imap_flag_email/unflag_email: Star/unstar an email (sets or clears the IMAP \Flagged system flag — shows as a "star" in Gmail and Apple Mail). Some servers/clients (Open-Xchange, Apple Mail) also set a separate custom keyword (e.g. $cl_N, $MailFlagBit*) when flagging; unflag only clears \Flagged, so if a message still shows as flagged, check customKeywords via imap_get_email and clear it with imap_remove_keyword.

    Parameters:
    - accountId: Account ID
    - folder: Folder name
    - uid: Email UID
  • imap_add_keyword/remove_keyword: Set or clear an arbitrary custom (non-system) IMAP keyword/label on an email, passed through verbatim (e.g. provider color labels like Open-Xchange's $cl_1..$cl_10 or Apple Mail's $MailFlagBit0..$MailFlagBit2, or any other custom keyword). Backslash-prefixed system flags (e.g. \Flagged, \Seen, \Deleted) are rejected — use the dedicated flag/read tools for those. Not every server permits custom-keyword changes (see the mailbox's PERMANENTFLAGS); if the server rejects or silently ignores the change, the call fails instead of reporting success.

    Parameters:
    - accountId: Account ID
    - folder: Folder name
    - uid: Email UID
    - keyword: IMAP keyword to set/remove (e.g. "$cl_3")
  • imap_delete_email: Delete an email

    Parameters:
    - accountId: Account ID
    - folder: Folder name
    - uid: Email UID
  • imap_move_email: Move an email from one folder to another

    Parameters:
    - accountId: Account ID
    - folder: Source folder name (default: INBOX)
    - uid: Email UID, OR an array of UIDs to move in one call. Batch moves are
        attributed per-uid in the response (`results[]` with per-uid `uidMap`
        and any errors). Single-uid calls return the legacy response shape.
    - targetFolder: Destination folder name
    - createDestinationIfMissing: Create the destination folder if it does not exist (default: false)
  • imap_find_thread_messages: Find inbox messages that belong to the same conversation threads as messages already sorted into another folder. Uses RFC 3501 HEADER search on In-Reply-To and References — works on any IMAP server.

    Parameters:
    - accountId: Account ID
    - sourceFolder: Folder containing the already-sorted thread messages
    - searchFolder: Folder to search for related messages (default: INBOX)
    - searchReferences: Also match the References header for multi-level threads (default: true)
    - includeBody: Include parsed message body for each found thread message
        (default: false). Same semantics as the `includeBody` option on
        `imap_search_emails` — one round-trip instead of N×`imap_get_email`.
    - bodyFormat: `markdown` (default), `text`, `html`, or `auto`.
    - bodyMaxLength: Per-field cap (default: 10000).
  • imap_download_attachment: Download an email attachment (returns images inline, extracts text from PDFs, or saves to downloads directory)

    Parameters:
    - accountId: Account ID
    - folder: Folder name (default: INBOX)
    - uid: Email UID
    - filename: Attachment filename or contentId (as listed by imap_get_email; NFC/NFD
        spellings of accented characters are treated as equal, and a contentId may
        be passed with or without angle brackets)
    - savePath: Optional file path to save the attachment to
    - extractText: For PDFs, extract and return text content inline (default: true)
  • imap_bulk_delete: Delete multiple emails at once with chunking and auto-reconnection

    Parameters:
    - accountId: Account ID
    - folder: Folder name (default: INBOX)
    - uids: Array of email UIDs to delete
    - chunkSize: Emails to delete per batch (default: 50)
  • imap_bulk_delete_by_search: Search for emails matching criteria and delete them all

    Parameters:
    - accountId: Account ID
    - folder: Folder name (default: INBOX)
    - from, to, subject: Search criteria (optional)
    - before, since: Date filters (optional)
    - chunkSize: Emails to delete per batch (default: 50)
    - dryRun: Preview what would be deleted without deleting (default: false)

    At least one concrete criterion (from, to, subject, before, or since) is required — a call with no criteria is refused, so it can never match and delete an entire folder.

  • imap_send_email: Send a new email

    Parameters:
    - accountId: Account ID to send from
    - to: Recipient email address(es) — an array, or a single comma-separated string
    - subject: Email subject
    - text: Plain text content (optional)
    - html: HTML content (optional)
    - cc: CC recipients (optional)
    - bcc: BCC recipients (optional)
    - replyTo: Reply-to address (optional)
    - attachments: Array of attachments (optional)
      - filename: Attachment filename
      - content: Base64 encoded content; provide exactly one of `content` or `path`
      - path: Readable local file path to attach; provide exactly one of `path` or `content`
      - contentType: MIME type (optional; detected from the filename extension when omitted)
      - contentDisposition: "attachment" (default) or "inline" — use "inline" for images shown in the HTML body via cid:
      - cid: Content-ID for inline attachments; must match the `cid:` value used in an `<img src="cid:...">` tag in `html`
    - dryRun: Validate attachments and compose MIME without sending or saving to Sent (optional, default: false)

    Attachments are validated before SMTP is contacted. Invalid base64, unreadable paths, missing filenames, ambiguous sources, and inline attachments without cid fail fast. Successful sends and dry-runs return attachmentCount and safe attachmentDiagnostics: filename, MIME type, size, source, disposition, and cid. Diagnostics omit bytes, raw MIME, and local file paths.

    For large files, upload with imap_upload_file first and pass its returned local path; for inline images, set contentDisposition: "inline" and a matching cid.

    After sending, a copy is saved to the account's Sent folder (unless saveToSent is disabled on the account). The folder is resolved via the account's sentFolder override → the server's \Sent SPECIAL-USE flag → a list of known localized names ("Sent", "Gesendet", "Éléments envoyés", …). The response reports the outcome: savedToSent (boolean), sentFolder (the folder used), and — when the save fails — sentSaveError explaining why, instead of failing silently. The same applies to imap_reply_to_email and imap_forward_email.

    When the account has defaultBcc configured, those address(es) are always BCC'd on send, reply, forward, and draft (merged with any per-call bcc; duplicates removed case-insensitively). The Bcc header is kept in the MIME stored for drafts and Sent-folder copies so mail clients show it.

  • imap_save_draft: Save an email as a draft (no send). Takes the same fields as imap_send_email, plus inReplyTo, references, and an optional folder override for the Drafts folder.

  • imap_reply_to_email: Reply to an existing email

    Parameters:
    - accountId: Account ID
    - folder: Folder containing the original email
    - uid: UID of the email to reply to
    - text: Plain text reply content (optional)
    - html: HTML reply content (optional)
    - replyAll: Reply to all recipients (default: false)
    - bcc: BCC recipients (optional; merged with account defaultBcc)
    - attachments: Array of attachments (optional, same shape as imap_send_email, including contentDisposition/cid for inline images)
  • imap_forward_email: Forward an existing email

    Parameters:
    - accountId: Account ID
    - folder: Folder containing the original email
    - uid: UID of the email to forward
    - to: Forward to email address(es)
    - text: Additional text to include (optional)
    - bcc: BCC recipients (optional; merged with account defaultBcc)
    - includeAttachments: Include original attachments (default: true)

Folder Operations

  • imap_list_folders: List all folders

    Parameters:
    - accountId: Account ID

    Each folder includes its attributes (raw IMAP LIST flags) and, when the server advertises it, specialUse — the RFC 6154 role (\Sent, \Drafts, \Trash, \Junk, \Archive) that identifies a folder independent of its localized display name (e.g. "Gesendet" carries specialUse: "\Sent").

  • imap_folder_status: Get folder information

    Parameters:
    - accountId: Account ID
    - folder: Folder name
    
    Returns:
    - messages: { total, new, unseen } — from IMAP STATUS
    - uidvalidity, uidnext
    - flags, permanentFlags: string arrays
    - customKeywords: the mailbox's non-system keywords, usable as the
        `keywords` / `unKeywords` input of imap_search_emails
  • imap_create_folder: Create a new IMAP folder/mailbox. Most servers also create any missing parent folders. Returns success even if the folder already exists.

    Parameters:
    - accountId: Account ID
    - folder: Full folder path to create (e.g. "Archives/2026/2026-05" or "INBOX.Archive")
  • imap_get_unread_count: Count unread emails

    Parameters:
    - accountId: Account ID
    - folders: Specific folders (optional)

Security

  • Credentials are encrypted using AES-256-CBC encryption
  • Encryption keys are stored separately in ~/.imap-mcp/.key
  • Account configurations are stored in ~/.imap-mcp/accounts.json
  • The store directory, .key, and accounts.json are written owner-only (0700/0600) so other local users cannot read the key or the credentials
  • The web setup wizard's HTTP API never returns stored passwords to the browser
  • Downloaded attachments are confined to the downloads directory; sender-supplied filenames cannot write outside it
  • Never commit or share your encryption key or account configurations

Development

Running in Development Mode

bash
npm run dev

Building

bash
npm run build

Project Structure

src/
├── index.ts           # MCP server entry point
├── services/
│   ├── imap-service.ts    # IMAP connection management
│   ├── smtp-service.ts    # SMTP service for sending emails
│   └── account-manager.ts # Account configuration
├── tools/
│   ├── index.ts          # Tool registration
│   ├── account-tools.ts  # Account management tools
│   ├── email-tools.ts    # Email operation tools (including send/reply/forward)
│   └── folder-tools.ts   # Folder operation tools
└── types/
    └── index.ts          # TypeScript type definitions

Example Usage in Claude

  1. Add an account: "Add my Gmail account with username john@gmail.com"

  2. Check new emails: "Show me the latest 5 emails from my Gmail account"

  3. Search emails: "Search for emails from boss@company.com in the last week"

  4. Send an email: "Send an email to client@example.com with subject 'Project Update'"

  5. Reply to emails: "Reply to the latest email from my boss"

  6. Forward emails: "Forward the email with subject 'Meeting Notes' to team@company.com"

  7. Move an email: "Move the invoice email from INBOX to my Taxes folder"

  8. Manage folders: "List all folders in my email account and show unread counts"

Troubleshooting

Connection Issues

  • Ensure your IMAP server settings are correct
  • Check if your email provider requires app-specific passwords
  • Verify that IMAP is enabled in your email account settings
  • For sending emails, ensure your account has SMTP access enabled

Recipients arriving as ["a@x.com","b@y.com"]

to, cc, bcc, references and uid accept either a single value or an array. In JSON Schema that is an anyOf, and some MCP clients drop the anyOf before showing the schema to the model — the field then looks untyped or string-typed, and the client serializes the model's array into a string. The server used to pass that string straight to nodemailer, which folded the literal [ and ] into the first and last address, so every recipient was rejected by the receiving mail server (issue #127).

The server now detects a stringified array and restores it, both when validating tool input and again before composing the message, and logs a warning to stderr naming the field. Nothing needs to change on your side. If you want to bypass the client behavior entirely, pass recipients as one comma-separated string: "Alice <alice@example.com>, Bob <bob@example.org>".

SMTP Configuration

The server automatically configures SMTP settings based on your IMAP provider. If you need custom SMTP settings, you can specify them when adding an account:

json
{
  "smtp": {
    "host": "smtp.example.com",
    "port": 587,
    "secure": false
  }
}

Common IMAP Settings

  • Gmail:

    • Host: imap.gmail.com
    • Port: 993
    • Requires app-specific password
  • Outlook/Hotmail:

    • Host: outlook.office365.com
    • Port: 993
  • Yahoo:

    • Host: imap.mail.yahoo.com
    • Port: 993
    • Requires app-specific password

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Installation

TypingMind
{
  "mcpServers": {
    "imap-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "imap-mcp-server"
      ]
    }
  }
}

Outils disponibles

  • imap_add_account

    Add a new IMAP account configuration

  • imap_update_account

    Update an existing IMAP account. Useful for fixing SMTP settings without removing and re-adding the account.

  • imap_list_accounts

    List all configured IMAP accounts

  • imap_remove_account

    Remove an IMAP account configuration

  • imap_connect

    Connect to an IMAP account

  • imap_disconnect

    Disconnect from an IMAP account

  • imap_test_account

    Test an existing account connection without re-entering credentials. Validates IMAP connectivity and returns folder count and message count.

  • imap_search_emails

    Search for emails in a folder

  • imap_get_email

    Get the full content of an email, with optional text attachment previews

  • imap_upload_file

    Upload a file to the server for use as an email attachment. Returns a path that can be used with imap_send_email attachments. This allows sending large attachments without hitting context window limits. Max size: 26214400 bytes (configurable via IMAP_MAX_UPLOAD_SIZE). Uploads are auto-deleted after 86400000 ms (configurable via IMAP_UPLOAD_TTL_MS).

  • imap_download_attachment

    Download an attachment from an email. Returns image content directly for image attachments, extracts text from PDFs, or saves to a shared downloads directory accessible from the host.

  • imap_mark_as_read

    Mark an email as read

  • imap_mark_as_unread

    Mark an email as unread

  • imap_delete_email

    Delete an email (moves to trash or expunges)

  • imap_move_email

    Move an email from one folder to another (e.g., INBOX to Taxes, or INBOX to Archive). Optionally creates the destination folder if it does not exist.

  • imap_bulk_delete

    Delete multiple emails at once with chunking and auto-reconnection. Processes deletions in batches to prevent connection timeouts.

  • imap_bulk_delete_by_search

    Search for emails matching criteria and delete them all. Useful for cleaning up spam or unwanted emails.

  • imap_get_latest_emails

    Get the latest emails from a folder

  • imap_send_email

    Send an email using SMTP

  • imap_save_draft

    Save an email as a draft in the Drafts folder (no send). Takes the same fields as imap_send_email.

  • imap_reply_to_email

    Reply to an existing email

  • imap_forward_email

    Forward an existing email

  • imap_find_thread_messages

    Find messages in searchFolder that belong to the same conversation threads as messages already in sourceFolder. Useful for catching replies that arrived after a thread was sorted. Works on any IMAP server (uses RFC 3501 HEADER search on In-Reply-To and References).

  • imap_list_folders

    List all folders/mailboxes in an IMAP account

  • imap_folder_status

    Get status information about a folder

  • imap_create_folder

    Create a new IMAP folder/mailbox. Most servers also create any missing parent folders (e.g. creating "Archives/2026/2026-05" auto-creates "Archives" and "Archives/2026"). Returns success even if the folder already exists.

  • imap_get_unread_count

    Get the count of unread emails in specified folders

  • imap_check_spam

    Check emails in a folder for spam/disposable email domains. Returns spam analysis and domain statistics.

  • imap_delete_spam

    Find and delete emails from known spam/disposable email domains.

  • imap_domain_stats

    Get statistics about sender domains in a folder. Useful for identifying bulk senders or spam patterns.

  • imap_add_spam_domain

    Add a domain to the custom spam list. Emails from this domain will be flagged as spam.

  • imap_remove_spam_domain

    Remove a domain from the custom spam list.

  • imap_add_whitelist_domain

    Add a domain to the whitelist. Emails from whitelisted domains will never be flagged as spam.

  • imap_list_spam_domains

    List all known spam domains (built-in and custom).

  • imap_delete_by_domain

    Delete all emails from a specific domain. Useful for cleaning up unwanted newsletters or spam.

Utilisez le serveur MCP IMAP MCP Server avec plusieurs modèles IA

TypingMind connecte les outils MCP au niveau de l’espace de travail. Une fois IMAP MCP Server connecté, vous pouvez donc l’utiliser avec différents modèles IA dans TypingMind sans avoir à le configurer séparément pour chaque modèle. Cette intégration MCP s’exécute localement sur votre appareil via le connecteur MCP de TypingMind.

Guide de configuration du connecteur local

Choisissez cette méthode si le serveur MCP doit accéder à des fichiers locaux, à des applications ou à des ressources privées sur votre ordinateur.

1

Ouvrir les paramètres MCP

Dans TypingMind, accédez à « Paramètres », puis à « Paramètres avancés » et à « Model Context Protocol », et choisissez « Configurer connecteur ».

  1. Ouvrez TypingMind dans votre navigateur.
  2. Cliquez sur l’icône Paramètres.
  3. Accédez aux paramètres avancés.
  4. Ouvrez la section Model Context Protocol.
  5. Cliquez sur « Configurer connecteur » et choisissez « Cet appareil ».
Écran de configuration du connecteur MCP de TypingMind avec l’option « Cet appareil » sélectionnée
2

Exécuter la commande du connecteur

Choisissez « Cet appareil », copiez la commande depuis TypingMind et exécutez-la dans Terminal. Laissez le processus en cours d’exécution pendant que vous utilisez MCP.

  1. Copiez la commande de configuration affichée par TypingMind.
  2. Ouvrez Terminal sur macOS ou Windows Terminal sur Windows.
  3. Collez et exécutez la commande.
  4. Autorisez l’installation du paquet si Terminal vous demande de confirmer.
  5. Gardez la fenêtre de Terminal ouverte et le processus en cours d’exécution pendant que vous utilisez les outils MCP.
3

Ajoutez IMAP MCP Server en tant que serveur

Lorsque l’état du connecteur affiche « Prêt », cliquez sur « Éditer serveurs » et collez la configuration du serveur MCP.

  1. Attendez que l’état du connecteur affiche « Prêt ».
  2. Cliquez sur « Éditer serveurs ».
  3. Collez la configuration du serveur MCP IMAP MCP Server.
  4. Enregistrez la liste des serveurs.
  5. Actualisez pour vérifier que le connecteur est toujours prêt.
Paramètres MCP de TypingMind affichant un serveur actif et le bouton « Éditer serveurs »
{
  "mcpServers": {
    "imap-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "imap-mcp-server"
      ]
    }
  }
}
4

Utiliser la connexion avec différents modèles

Enregistrez la liste des serveurs, ouvrez « Plugins », activez les outils MCP de IMAP MCP Server, puis sélectionnez un modèle IA compatible dans TypingMind et utilisez les outils dans une discussion ou attribuez-les à un agent IA.

  1. Ouvrez la page Plugins dans TypingMind.
  2. Activez les outils MCP de IMAP MCP Server.
  3. Démarrez une discussion et choisissez le modèle IA que vous souhaitez utiliser.
  4. Utilisez les outils MCP dans le chat ou attribuez-les à un agent IA.
  5. Passez à un autre modèle IA selon vos besoins sans rétablir la connexion MCP.
Discussion TypingMind utilisant des outils MCP activés avec un modèle d’IA sélectionné
Pouvez-vous utiliser IMAP MCP Server pour m’aider dans cette tâche ?
IMAP MCP Server
Bien sûr. J’ai tout lu.
Voici ce que j’ai trouvé avec IMAP MCP Server.

Foire aux questions

À quoi sert le serveur MCP IMAP MCP Server ?

IMAP MCP Server est un serveur MCP qui permet aux applications IA compatibles d’accéder à des outils et à des informations contextuelles externes. Dans TypingMind, il vous suffit d’ajouter ce serveur MCP une seule fois pour rendre ses outils disponibles dans votre espace de travail IA.

Puis-je utiliser le serveur MCP IMAP MCP Server avec plusieurs modèles IA dans TypingMind ?

Oui. TypingMind connecte les outils MCP au niveau de l’espace de travail. Vous pouvez donc utiliser IMAP MCP Server avec différents modèles IA comme Claude, ChatGPT, Gemini ou d’autres modèles configurés dans TypingMind, sans avoir à configurer le serveur MCP séparément pour chaque modèle.

Pourquoi utiliser le connecteur MCP IMAP MCP Server avec TypingMind ?

TypingMind est l’une des meilleures interfaces de chat avec les LLM, car elle réunit plusieurs modèles IA, prompts, plugins, agents IA, clés API et outils MCP dans un seul espace de travail. Une fois IMAP MCP Server connecté, vous pouvez utiliser ses outils MCP avec vos modèles préférés tout en gardant vos discussions bien organisées dans TypingMind.

Comment connecter le serveur MCP IMAP MCP Server à TypingMind ?

IMAP MCP Server fonctionne via le connecteur MCP local de TypingMind. C’est l’option idéale lorsque le serveur MCP doit accéder à des fichiers locaux, des applications de bureau, des outils en ligne de commande ou des ressources privées sur votre ordinateur.

Quels outils le serveur MCP IMAP MCP Server propose-t-il dans TypingMind ?

IMAP MCP Server propose 35 outils MCP que vous pouvez activer depuis la page Plugins de TypingMind et utiliser dans les discussions ou attribuer à des agents IA.

Dois-je partager mes clés API avec TypingMind pour utiliser le serveur MCP IMAP MCP Server ?

Non. TypingMind privilégie le fonctionnement local et vous permet de garder le contrôle de vos fournisseurs de modèles, clés API, prompts et paramètres MCP. Si IMAP MCP Server nécessite une authentification, ajoutez les en-têtes, les paramètres OAuth ou la configuration locale requis pour ce serveur MCP lors de la création de la connexion.

Serveurs MCP similaires

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇