@aiwerk/mcp-server-imap
Provides tools for managing emails on Dovecot servers via IMAP/SMTP, including listing, reading, searching, sending, replying, moving, flagging, and deleting messages.
Provides tools for managing emails on Gmail via IMAP/SMTP, including listing, reading, searching, sending, replying, moving, flagging, and deleting messages.
Provides tools for managing emails on Infomaniak via IMAP/SMTP, including listing, reading, searching, sending, replying, moving, flagging, and deleting messages.
Provides tools for managing emails on OVH via IMAP/SMTP, including listing, reading, searching, sending, replying, moving, flagging, and deleting messages.
Provides tools for managing emails on ProtonMail via IMAP/SMTP (using ProtonMail Bridge), including listing, reading, searching, sending, replying, moving, flagging, and deleting messages.
Provides tools for managing emails on Zoho via IMAP/SMTP, including listing, reading, searching, sending, replying, moving, flagging, and deleting messages.
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., "@@aiwerk/mcp-server-imap list my recent emails"
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.
@aiwerk/mcp-server-imap
IMAP/SMTP MCP server that works with any email provider. Set host, user, pass — done.
Unlike Gmail-only or Outlook-only MCP servers, this one speaks standard IMAP/SMTP — so it works with every email provider out of the box.
Why this server?
Most email MCP servers only work with one provider (Gmail, Outlook). This one works with any provider that supports IMAP:
Gmail, Outlook, Yahoo — yes
Fastmail, ProtonMail Bridge, Zoho — yes
Self-hosted (Dovecot, Postfix, hMailServer) — yes
Corporate/hosted (Hostpoint, Infomaniak, OVH) — yes
One server, every mailbox.
Related MCP server: email-mcp
Highlights
Universal — standard IMAP/SMTP, works everywhere
Simple setup — just
IMAP_HOST,IMAP_USER,IMAP_PASSand you're connectedSafety first — email sending is disabled by default (
SMTP_SEND_ENABLED=false). Your AI agent can read emails but can't send anything until you explicitly opt inLazy credentials — the server starts and exposes its tool list without requiring credentials. Auth is only needed when a tool is actually called
Real MIME parsing — handles multipart, HTML/text, attachments, reply threading
AIWerk hosted service — email_send and email_reply are local-only
If you use this server through the AIWerk hosted service at aiwerkmcp.com, the two outgoing-mail tools are not exposed:
❌
email_send❌
email_reply
The other 8 read-side tools (email_list, email_read, email_search, email_folders, email_flag, email_move, email_delete, email_attachment) work normally on the hosted service.
Why? The hosted service shares an IP across all users. If outgoing mail went out from that shared IP, the IP would appear in every recipient's Received: headers — one bad actor could damage deliverability for every user. There is no shared-IP architecture where arbitrary user sends works safely.
How to send mail then? Run the server locally, where outgoing mail goes from your own IP and your own provider reputation. Three paths:
Ad-hoc one-email CLI — see the next section. Zero config, one-shot.
Direct stdio MCP server in your client (Cursor, Claude Desktop, OpenClaw) — point your client config at
npx -y @aiwerk/mcp-server-imapwith yourIMAP_*andSMTP_*env vars includingSMTP_SEND_ENABLED=true.Local
@aiwerk/mcp-bridge—npx -y @aiwerk/mcp-bridge install imap-email --catalog aiwerkmcp.com, then point your client at the local bridge endpoint.
In all three cases the mail goes from your home / office IP, not from the hosted service.
Ad-hoc one-email CLI
Note: On the AIWerk hosted service, the
email_sendandemail_replyMCP tools are not exposed (the service shares an IP across all users, so allowing arbitrary sends would risk every user's deliverability). Use any of the three paths below to send email locally.
Need to send a single email from the command line — for example, to deliver a draft your AI agent composed? Use aiwerk-send-email:
SMTP_HOST=smtp.gmail.com \
SMTP_PORT=587 \
SMTP_USER=me@gmail.com \
SMTP_PASS='app-password' \
SMTP_FROM='Me <me@gmail.com>' \
npx -y @aiwerk/mcp-server-imap aiwerk-send-email \
--to "alice@example.com" \
--subject "Re: invoice" \
--body "Got it, will pay Monday."On success, exits 0 and prints JSON: {"ok":true,"messageId":"...","envelope":{...}}
On failure, exits 1 with the error on stderr. Credentials are never printed.
All CLI arguments
Argument | Required | Description |
| Yes | Recipient(s), comma-separated |
| Yes | Subject line |
| One of body/html | Plain-text body |
| One of body/html | HTML body (both → multipart) |
| No |
|
| No | Space-separated reference IDs |
| No | CC recipients, comma-separated |
| No | BCC recipients, comma-separated |
CLI environment variables
Variable | Required | Default | Description |
| Yes | — | SMTP server hostname |
| Yes | — |
|
| Yes | — | SMTP username / email address |
| Yes | — | Password or app-specific password |
| Yes | — | Sender address ( |
| No |
|
|
Install
Three ways to get email tools — pick the one that fits.
1. Quick (single email) — aiwerk-send-email CLI above: no MCP client needed, one command sends one email.
2. Direct stdio MCP server — all 10 email tools exposed to your AI agent:
npx -y @aiwerk/mcp-server-imap3. Local bridge with catalog UX — install via the AIWerk catalog for a guided setup:
npx -y @aiwerk/mcp-bridge install imap-email --catalog bridge.aiwerk.chOption 1 — Hosted (zero setup)
No local runtime, no env vars on your machine — credentials are AES-256-GCM encrypted server-side via HashiCorp Vault.
Sign up at aiwerkmcp.com.
Install IMAP Email from the catalog and paste your IMAP/SMTP credentials.
Point your MCP client (Claude.ai, Cursor, Hermes, …) at your hosted endpoint:
https://bridge.aiwerk.ch/u/<your-user-id>/mcpwith your Bearer token.
All 10 tools appear immediately. Install other AIWerk recipes from the same bridge.
Option 2 — Self-hosted (npx)
Run directly — you manage the credentials:
IMAP_HOST="imap.example.com" \
IMAP_USER="user@example.com" \
IMAP_PASS="app-password" \
SMTP_HOST="smtp.example.com" \
npx @aiwerk/mcp-server-imapThe server starts immediately and responds to tools/list even without credentials — they're only required when a tool is actually called (lazy credentials).
Tools (10)
Tool | Purpose |
| List emails from a folder |
| Read a single message with full body |
| Search by from/to/subject/date/unread |
| List all folders with message counts |
| Move messages between folders |
| Set read/star/flag status |
| Move messages to Trash |
| Send a new email (requires opt-in) |
| Reply to a message (requires opt-in) |
| List or download attachments |
Configuration
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"email": {
"command": "npx",
"args": ["-y", "@aiwerk/mcp-server-imap"],
"env": {
"IMAP_HOST": "imap.example.com",
"IMAP_USER": "you@example.com",
"IMAP_PASS": "your-app-password",
"SMTP_HOST": "smtp.example.com"
}
}
}
}Cursor / Windsurf / VS Code
Same config format in the respective MCP settings.
AIWerk hosted service
If you want zero-setup, install via aiwerkmcp.com — see Option 1 above.
Environment variables
IMAP (required)
Variable | Default | Description |
| — | IMAP server hostname |
| — | Email address or username |
| — | Password or app-specific password |
|
| IMAP port |
|
| Use TLS |
|
| Connection timeout (ms) |
SMTP (optional, for sending)
Variable | Default | Description |
|
| SMTP server hostname |
|
| SMTP port |
|
| SMTP username |
|
| SMTP password |
|
| Use TLS |
|
| Sender address |
|
| Must be |
Debug
Variable | Default | Description |
|
| Verbose IMAP protocol logging |
Security
Email sending is disabled by default — set
SMTP_SEND_ENABLED=trueto enableCredentials are loaded lazily (only when a tool is called, not at startup)
No credentials are logged
Keep credentials in
.envor a secret manager — never commit them to git
Supported providers
Tested with: Hostpoint, Gmail (app password), Outlook/Microsoft 365, Yahoo Mail, Fastmail, Dovecot, Postfix.
Works with any standards-compliant IMAP/SMTP server.
Build from source
git clone https://github.com/AIWerk/mcp-server-imap
cd mcp-server-imap
npm install
npm run build
node dist/server.jsContributing
Issues and PRs are welcome! Please open an issue first for larger changes.
Changelog
See CHANGELOG.md for version history.
About AIWerk MCP
Part of the AIWerk MCP platform — curated, signed MCP recipes served either as npm packages for self-hosting or through our multi-tenant hosted service at aiwerkmcp.com.
Other AIWerk MCP servers:
@aiwerk/mcp-server-cal — Cal.com scheduling
@aiwerk/mcp-server-wise — Wise (TransferWise) Personal API, read-only
@aiwerk/mcp-server-clawhub — ClawHub skill catalog
Browse the full catalog (20+ recipes including GitHub, Linear, Notion, Stripe, …) at aiwerkmcp.com.
License
MIT — AIWerk
Available Tools
10 toolsemail_attachmentC
List or fetch a message attachment
Inputs: uid (required), folder, filename, index.
email_deleteC
Delete emails by moving them to Trash
Inputs: uids (required), folder.
email_flagC
Set read/star flags on emails
Inputs: uids (required), action (required), folder.
email_foldersA
List all folders and status counters
Inputs: no named parameters.
email_listC
List emails from a folder
Inputs: folder, limit, unreadOnly.
email_moveB
Move email UIDs from one folder to another
Inputs: uids (required), to (required), from.
email_readC
Read one email including body and attachments metadata
Inputs: uid (required), folder, format.
email_replyC
Reply to an existing email via SMTP
Inputs: uid (required), body (required), folder, html, +2 more.
email_searchC
Search emails by text/header/date criteria
Inputs: query, from, to, subject, +5 more.
email_sendC
Send an email via SMTP
Inputs: to (required), subject (required), body (required), html, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool has a distinct purpose: attachment handling, deletion, flagging, folder listing, inbox listing, moving, reading, replying, searching, and sending. No overlapping functionality.
All tools share the 'email_' prefix, and most follow a verb_noun pattern (e.g., email_delete, email_send). 'email_attachment' and 'email_folders' are noun-based but clear given their descriptions.
10 tools cover essential email operations (list, read, send, reply, delete, move, flag, search, folders, attachments) without being excessive or sparse.
Core CRUD and search are present. Minor gaps like folder management (create/rename) or draft handling exist but are not critical for basic IMAP usage.
Related MCP Connectors
Your IMAP mailbox as an MCP server: read, search and (if you allow it) organize mail. Open source.
A MCP server for Gmail that lets you search, read, and draft emails and replies.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Hosted email MCP for your own Gmail, Outlook.com, Microsoft 365, iCloud or IMAP inbox: read, search, draft, reply in thread, forward and file mail. It moves or flags up to 500 messages in one call, and a send leaves exactly one copy in Sent. A calendar is a separate connection, and connecting one adds diary and scheduling tools.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA unified MCP server for email access across Gmail, Outlook, iCloud, and generic IMAP providers, enabling search, send, organize, and batch operations.297 npm26MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for managing email via IMAP/SMTP, supporting multiple accounts and tools for reading, sending, searching, and organizing emails.294 npmMIT
- AlicenseAqualityDmaintenanceMCP server that enables email management (send, read, search, delete, etc.) via IMAP/SMTP, compatible with Gmail, Outlook, Yahoo, iCloud, and other standard mail servers.11MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for reading and sending emails via IMAP and SMTP, designed for Zimbra and any standard mail host.9 npm1ISC