Imap MCP server
IMAP/SMTP MCP server to search, read, organize, send, reply & forward email for AI assistants
96 stars528 downloads/wk
Reviews
Write oneNobody has reviewed Imap yet.
If you have run it, two minutes of your experience saves the next person an afternoon.
Imap tools (40, 19 write)
write = sends, deletes, buys or postsRead from the package source without running it. The installed server may list more.
imap_add_accountAdd a new IMAP account configuration
imap_add_keywordSet an arbitrary custom (non-system) IMAP keyword/label on an email \u2014 e.g. a provider color label like Open-Xchange's $cl_1..$cl_10, Apple Mail's $MailFlagBit0..$MailFlagBit2, or an app tag such as $promotion. Unlike imap_flag_email (which only ever sets the system \Flagged flag), this passes the keyword through verbatim, but rejects backslash-prefixed system flags (e.g. \Flagged, \Seen, \Del
imap_add_spam_domainAdd a domain to the custom spam list. Emails from this domain will be flagged as spam.
imap_add_whitelist_domainAdd a domain to the whitelist. Emails from whitelisted domains will never be flagged as spam.
imap_bulk_deletewrite actionDelete multiple emails at once with chunking and auto-reconnection. Processes deletions in batches to prevent connection timeouts.
imap_bulk_delete_by_searchwrite actionSearch for emails matching criteria and delete them all. Useful for cleaning up spam or unwanted emails. At least one concrete criterion (from, to, subject, before, or since) is REQUIRED \u2014 a call with no criteria is refused so it can never wipe an entire folder. Supports dryRun to preview matches first.
imap_check_spamCheck emails in a folder for spam. Combines sender-domain checks (known spam/disposable domains, suspicious patterns) with deterministic raw-header analysis: bulk-mailer X-Mailer/User-Agent signatures, Precedence: bulk, DMARC/SPF/DKIM failures in Authentication-Results, and List-Unsubscribe / Reply-To domains that do not match the sender. Header checks catch scam mail from fresh, unlisted domains
imap_connectConnect to an IMAP account
imap_create_folderwrite actionCreate 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_delete_by_domainwrite actionDelete all emails from a specific domain. Useful for cleaning up unwanted newsletters or spam.
imap_delete_emailwrite actionDelete ONE email by folder + uid (moves to Trash or expunges, server-dependent). Destructive and not easily undone \u2014 confirm the user means this specific message. To remove many at once use imap_bulk_delete (known uids) or imap_bulk_delete_by_search (by criteria, supports dryRun). To file an email away instead of deleting, use imap_move_email.
imap_delete_spamwrite actionFind and delete emails from known spam/disposable email domains.
imap_disconnectDisconnect from an IMAP account
imap_domain_statsGet statistics about sender domains in a folder. Useful for identifying bulk senders or spam patterns.
imap_download_attachmentDownload a single attachment from an email (folder + uid + attachment filename/contentId, as listed by imap_get_email). Images are returned inline for viewing; PDFs are saved and their text is extracted inline (extractText); other files are saved to the shared downloads directory (or savePath). Use when the user wants the actual file contents, not just the message body.
imap_find_email_by_message_idwrite actionLocate an email by its RFC822 Message-ID across folders and return its current { folder, uid } plus basic envelope. Robust to the message having been moved or archived (IMAP UIDs are folder-relative). Pass the returned folder + uid to imap_reply_to_email or imap_get_email. Without `folders`, searches Gmail \All Mail when present, else INBOX \u2192 Archive \u2192 Sent \u2192 remaining folders.
imap_find_thread_messagesFind 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). Set `includeBody=true` to also return the parsed body for each found thread message in one round-trip \u2014 avoids the N+1 cost o
imap_flag_emailwrite actionFlag an email \u2014 sets the IMAP \Flagged system flag (shows as a star in Gmail / a flag in Apple Mail). Use this tool when a user asks to star, flag, or mark a message as important.
imap_folder_statusGet status information about a folder
imap_forward_emailwrite actionForward an existing email (folder + uid) to new recipients, quoting the original message and headers. Optionally include the original attachments. Use when the user wants to pass an existing message on to someone else; use imap_reply_to_email instead to respond to the sender. Account defaultBcc addresses are always BCC'd when configured.
imap_get_emailwrite actionRead the FULL content of a single email by its UID (body, sender/recipients, date, attachment list, optional raw headers and text-attachment previews). By default the body is returned as clean Markdown in markdownContent and raw HTML is omitted so it never crosses the boundary; set bodyFormat to "html" for the legacy raw htmlContent, or "text" for plain text only. Use after imap_search_emails or i
imap_get_latest_emailsGet the most recent emails from a folder, newest first. Use this for "what just came in?" / "show my latest inbox messages" when no search filter is needed. By default returns lightweight headers (uid, from, subject, date); set `includeBody=true` to also return the parsed body in one round-trip instead of paying the N+1 cost of calling imap_get_email per message. To filter by sender/subject/date i
imap_get_unread_countCount unread (unseen) emails per folder, plus a total. Use for "how many unread do I have?" overviews. Defaults to all folders; pass a folders list to limit scope and speed it up.
imap_list_accountsList all configured IMAP accounts
imap_list_foldersList all folders/mailboxes for an account (names, hierarchy delimiter, attributes, RFC 6154 special-use role). Use this first to discover exact folder names before searching, moving, or creating subfolders \u2014 folder naming varies by provider (e.g. "Archive" vs "[Gmail]/All Mail" vs "INBOX.Archive"). The specialUse field ("\\Sent", "\\Drafts", "\\Trash", "\\Junk", "\\Archive") identifies a fold
imap_list_spam_domainsList all known spam domains (built-in and custom).
imap_mark_as_readMark one or many emails as read. Accepts a single UID or an array \u2014 pass an array to flag N messages in one IMAP STORE round-trip (useful when triaging).
imap_mark_as_unreadMark one or many emails as unread. Accepts a single UID or an array \u2014 pass an array to flag N messages in one IMAP STORE round-trip.
imap_move_emailwrite actionMove 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_remove_accountwrite actionRemove an IMAP account configuration
imap_remove_keywordwrite actionRemove an arbitrary custom (non-system) IMAP keyword/label from an email \u2014 e.g. a provider color label like Open-Xchange's $cl_1..$cl_10, Apple Mail's $MailFlagBit0..$MailFlagBit2, or an app tag such as $promotion. Unlike imap_unflag_email (which only ever clears the system \Flagged flag), this passes the keyword through verbatim, but rejects backslash-prefixed system flags (e.g. \Flagged, \S
imap_remove_spam_domainwrite actionRemove a domain from the custom spam list.
imap_reply_to_emailwrite actionReply to an existing email identified by folder + uid. Automatically sets the recipient to the original sender, prefixes the subject with "Re:", and preserves threading (In-Reply-To/References). Set replyAll to also include the original recipients. Use this instead of imap_send_email whenever the user is responding to a message already in a mailbox. Account defaultBcc addresses are always BCC'd wh
imap_save_draftSave an email as a draft in the Drafts folder (no send). Takes the same fields as imap_send_email (including account defaultBcc when configured).
imap_search_emailsimap_send_emailwrite actionCompose and send a NEW email via the account's SMTP server (a copy is saved to Sent unless disabled; account defaultBcc addresses are always BCC'd when configured). Use for fresh outbound messages. To respond to an existing message use imap_reply_to_email (keeps threading); to pass a message on use imap_forward_email; to store without sending use imap_save_draft. Supports to/cc/bcc, text and/or HT
imap_test_accountTest an existing account connection without re-entering credentials. Validates IMAP connectivity and returns folder count and message count.
imap_unflag_emailwrite actionUnflag an email \u2014 removes the IMAP \Flagged system flag (the star in Gmail, the flag in Apple Mail). Note: some servers (e.g. Open-Xchange / Network Solutions) and Apple Mail also write a separate custom keyword such as $cl_N or $MailFlagBit* when a message is flagged in their client. Removing \Flagged alone does not clear that keyword, so the message may still display as flagged. If it does,
imap_update_accountwrite actionUpdate an existing IMAP account. Useful for fixing SMTP settings without removing and re-adding the account.
imap_upload_filewrite actionUpload 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: … bytes (configurable via IMAP_MAX_UPLOAD_SIZE). Uploads are auto-deleted after … ms (configurable via IMAP_UPLOAD_TTL_MS).
Public scan report
scanner v0.1.9 · 2026-09-24 · same rubric, same numbers if you re-run it
- Code scan5 source files scanned25/25
- –Live reliabilityno gateway calls yet and no remote to proben/a
- –Tool poisoningtools not inspected (local package is not executed); not countedn/a
- Auth qualitylocal package, no credentials required12/15
- Maintenancelast push 1 days ago15/15
- Maintainer identityregistry namespace matches repository owner; GitHub account older than a year8/10
What the publisher says
From the Imap repository's README, as published. We do not edit it. Read it on GitHub
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:
npx -y imap-mcp-serverThis 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:
curl -fsSL https://raw.githubusercontent.com/nikolausm/imap-mcp-server/main/install.sh | bashWindows (PowerShell as Administrator):
iwr -useb https://raw.githubusercontent.com/nikolausm/imap-mcp-server/main/install.ps1 | iexManual Installation
- Clone the repository:
git clone https://github.com/nikolausm/imap-mcp-server.git
cd imap-mcp-server- Install dependencies:
npm install- Build the project:
npm run buildAccount 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):
npx -p imap-mcp-server imap-setupThis 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 imapaddaccount 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:
npm run setupOr if installed globally:
imap-setupOr directly via npx without installing:
npx -p imap-mcp-server imap-setupThis will:
- Start a local web server
- Open your browser to the setup wizard
- 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 WORKGMAIL):
Shortened. The full README is on GitHub.
Nothing above is checked by us. What we check is on the safety report.
Install directly
Runs npx -y imap-mcp-server on your machine. Read the scan report first; the gateway never runs local packages.
claude mcp add imap-mcp-server -- npx -y imap-mcp-server
Imap: common questions
- Is Imap MCP server safe?
- Yes, by our scan: it is graded A (92/100). Read the Imap safety report
- How do I install Imap?
- It runs on your machine. Copy the Claude Code, Claude Desktop or Cursor config from the install section.
- Does Imap need an API key?
- Not as far as the registry entry and our scan can tell: no credentials are declared or required.
- Is Imap maintained?
- The last commit was in the last day (2026-09-23). The latest release is v2.0.0.
- What can I use instead of Imap?
- Servers from other publishers that do the same job: MCP Emails MCP server, Fluxmail MCP server and Agent Email MCP server. Compare all Imap alternatives.
Alternatives to Imap
Same job from other publishers: the closest match first, then the best rated.
- MCP EmailsNever-stored live email: read, send, organize, schedule and auto-triage Gmail or any IMAP mailbox.not reviewedGrowingA
FluxmailRead, search, draft, send, and organize email through Gmail, Outlook, and IMAP/SMTP mailboxes.not reviewedGrowingB- Agent EmailLocal email connectivity for AI agents — read, draft, send, and organize Outlook mail via MCPnot reviewedGrowingA
- Microsoft 365 MailMicrosoft 365 Outlook mail via Graph: read, search, send, reply, forward, draft, move, delete.not reviewedGrowingA
PostfleetGive an AI agent its own email address: send, reply, read, and wait for mail.not reviewedGrowingA