imap-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@imap-mcpcheck my inbox for unread emails from this week"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
imap-mcp
imap-mcp exposes one IMAP mailbox as seven MCP tools over Streamable HTTP. Read tools work once IMAP is configured. Sending, draft creation, and trash moves stay off until you enable each capability.
The server uses standard IMAP and SMTP settings. It does not select a mail provider or endpoint for you.
What it exposes
Tool | Behavior |
| Check the server and its IMAP connection. |
| List folders and IMAP special-use flags. |
| Search by sender, recipient, subject, date, or unread status. Results use the highest UIDs first, up to 50 messages. |
| Read one message by folder and UID. Returns capped text, a short HTML excerpt, and attachment metadata. |
| Send a plain-text email when |
| Append a plain-text draft when |
| Move one message to the unique folder marked |
mail_trash uses IMAP MOVE. It does not delete or expunge messages. Send/draft and trash operations have separate rate limits.
Related MCP server: simple-email-mcp
Requirements
Node.js 22.9 or newer
An IMAP account
An SMTP account if you enable sending
TLS in front of the HTTP endpoint when it is reachable over a network
Quick start
cp .env.example .env
openssl rand -base64 32
npm ci
npm run build
npm startPut the generated token in MCP_AUTH_TOKEN, then fill in the IMAP values in .env. The server listens on 127.0.0.1:3000 by default and accepts MCP requests at POST /mcp.
Clients must send the token as a bearer:
Authorization: Bearer <MCP_AUTH_TOKEN>examples/mcp.json contains a client configuration with placeholder values.
Configuration
Core settings
Variable | Default | Notes |
| required | At least 16 characters, with no leading or trailing whitespace. |
| required | IMAP hostname. |
|
| Integer from 1 to 65535. |
|
| Accepts only |
| required | Provider username. It does not need to be an email address. |
| required | Preserved exactly, including leading or trailing spaces. |
|
| Timeout for each IMAP operation. |
|
| HTTP bind address. |
|
| HTTP port. |
|
|
|
Send and draft settings
Variable | Default | Notes |
|
| Enables |
|
| Shared limit for sends and drafts, per process. |
| required when enabled | SMTP hostname. |
| required when enabled |
|
|
| Defaults from |
| IMAP credentials | Set both or neither. |
| resolved SMTP user | Required when the SMTP username is not an email address. |
Trash settings
Variable | Default | Notes |
|
| Enables |
|
| Independent move limit, per process. |
Runtime boundaries
MCP client
│ HTTPS + bearer token
▼
TLS reverse proxy
│ POST /mcp
▼
HTTP transport → MCP adapter → MailAccount
├─ IMAP: read, draft, move
└─ SMTP: sendMailAccount owns capability checks and rate limits. The MCP layer validates tool input and maps domain errors. IMAP and SMTP adapters contain provider protocol details. See CONTEXT.md for the domain terms used in the code.
Deployment is intentionally outside this repository. The tracked project contains no service unit, tunnel configuration, private hostname, or provider-specific endpoint.
Security notes
Keep the default loopback bind unless a trusted reverse proxy handles TLS and access control.
Treat the bearer token as mailbox access. Rotate it after suspected exposure.
Keep
ALLOW_SENDandALLOW_TRASHdisabled unless the connected client should mutate the mailbox.Store credentials in the runtime environment. Do not add
.envor client tokens to the repository.Application logs record operation names, status, latency, and provider error messages. They do not intentionally log message subjects or bodies.
mail_getdownloads at most 10 MB per message for parsing. It never returns attachment contents.
Prompt injection in an email can influence an MCP client or agent that reads it. The server limits mutation scope and frequency, but the client remains responsible for deciding when a tool call is appropriate.
Report vulnerabilities through the process in SECURITY.md.
Development
npm ci
npm run typecheck
npm run build
npm testThe default suite uses fake mail adapters and does not need mailbox credentials or external network access. Provide .env only when you want the read-only IMAP integration check:
npm run test:integrationThe integration check connects to the configured account and searches for at most one message. It does not send, draft, move, or delete mail.
Read CONTRIBUTING.md before opening a pull request.
Known limits
One server process handles one mailbox account.
UIDs belong to one folder and UIDVALIDITY. A stale UID returns
not_found.HTML-only messages use best-effort text extraction.
The server has no conversation model, attachment download, BCC, HTML sending, or permanent-delete tool.
Rate-limit state lives in memory and resets when the process restarts.
License
This server cannot be deployed
Maintenance
Related MCP Connectors
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Your mailbox for MCP clients: search, read, draft, send, rules and notes. Sending is off by default.
Email inboxes for AI agents: send, receive, reply, search, and manage threaded email over MCP.
Fully-managed email as MCP tools - register domains, real mailboxes, send and receive mail.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables reading and sending emails via IMAP and SMTP through the MCP protocol. Supports multiple email accounts and configuration via UI or environment variables.BSD 3-Clause
- AlicenseBqualityBmaintenanceEnables users to manage email accounts via IMAP/SMTP, including reading, searching, sending emails with attachments and calendar invites, all through natural language interactions with MCP-compatible clients.14MIT
- AlicenseNot gradedqualityBmaintenanceEnables searching, reading full conversations, and sending email across multiple IMAP/SMTP mailboxes from any MCP client, with multi-user support and per-user API tokens.MIT
- AlicenseAqualityAmaintenanceEnables MCP clients to read, search, organise, and manage IMAP mailbox messages, including saving attachments and drafting replies, while treating mail content as untrusted and keeping write capabilities opt-in.6101 npm1MIT