Multi-account IMAP/SMTP email server with 22 tools for reading, sending, searching, and organizing.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Multi-account email server for the Model Context Protocol. Gives LLMs full email access β read, send, search, organize β over IMAP/SMTP with connection pooling, rate limiting, and retry. Designed as the remote-email counterpart to apple-bridge (local Mail.app access).
Install
Create a config file (~/.config/mcp-email/accounts.json)
For well-known providers (Gmail, Outlook, Yahoo, iCloud, Fastmail, Zoho), host and port are auto-detected from the email domain β just provide credentials:
For custom mail servers, specify host and port explicitly:
Add to Claude Code (~/.claude.json)
Restart Claude Code β the email_* tools are now available.
Download pre-built binaries for your platform from GitHub Releases.
Available for: Linux (amd64, arm64), macOS (amd64, arm64), Windows (amd64, arm64).
Download the .mcpb file from Releases and open in Claude Desktop.
Accounts are loaded once at startup. Changes require a server restart.
| Approach | Best for |
|---|---|
EMAIL_CONFIG_FILE β path to a JSON file | Production use. File can be permission-locked (chmod 600) |
EMAIL_ACCOUNTS β inline JSON in env var | Testing, CI, or containerized deployments |
If both are set, EMAIL_ACCOUNTS takes precedence.
| Field | Required | Description |
|---|---|---|
id | Yes | Unique account identifier |
email | Yes | Email address |
imap_host | No* | IMAP server hostname |
imap_port | No* | IMAP port (993 = implicit TLS, 143 = STARTTLS) |
smtp_host | No* | SMTP server hostname |
smtp_port | No* | SMTP port (465 = implicit TLS, 587 = STARTTLS) |
username | Yes | Login username |
password | Yes** | App password or account password |
use_starttls | No | Override TLS auto-detection (true/false) |
insecure_skip_verify | No | Skip TLS certificate verification (dev/testing) |
auth_method | No | "password" (default) or "oauth2" |
oauth_client_id | No | OAuth2 client ID (required when auth_method is "oauth2") |
oauth_client_secret | No | OAuth2 client secret |
oauth_token_file | No | Override token file path |
*Host and port are auto-detected for well-known providers (see below). Required for custom servers. **Not required when using OAuth2 authentication.
When imap_host/smtp_host are omitted, the server detects settings from the email domain:
| Provider | Domains | IMAP | SMTP |
|---|---|---|---|
| Gmail | gmail.com, googlemail.com | imap.gmail.com:993 | smtp.gmail.com:587 |
| Outlook | outlook.com, hotmail.com, live.com | outlook.office365.com:993 | smtp.office365.com:587 |
| Yahoo | yahoo.com | imap.mail.yahoo.com:993 | smtp.mail.yahoo.com:587 |
| iCloud | icloud.com, me.com, mac.com | imap.mail.me.com:993 | smtp.mail.me.com:587 |
| Fastmail | fastmail.com, fastmail.fm | imap.fastmail.com:993 | smtp.fastmail.com:587 |
| Zoho | zoho.com, zohomail.com | imap.zoho.com:993 | smtp.zoho.com:587 |
Explicit host/port in the config always takes precedence over auto-detection.
TLS mode is auto-detected from port:
| Port | Protocol | Mode |
|---|---|---|
| 993 | IMAP | Implicit TLS |
| 143 | IMAP | STARTTLS |
| 465 | SMTP | Implicit TLS |
| 587 | SMTP | STARTTLS |
Override with "use_starttls": true or "use_starttls": false in the account object. Omit for auto-detection (recommended).
For providers that support it (Gmail, Outlook), you can use OAuth2 instead of app passwords. This uses the device code flow (RFC 8628) β no browser redirect needed.
Create OAuth2 credentials in the provider's developer console (Google Cloud Console or Azure AD)
Configure the account with auth_method: "oauth2":
On first connection, the server initiates the device code flow β printing a verification URL and code to stderr. Visit the URL and enter the code to authorize.
Tokens are persisted in ~/.config/mcp-email/tokens/ and automatically refreshed. Subsequent connections reuse the stored token without re-authorization.
Supported OAuth2 providers: Gmail (gmail.com, googlemail.com) and Outlook (outlook.com, hotmail.com, live.com).
| Variable | Required | Default | Description |
|---|---|---|---|
EMAIL_CONFIG_FILE | Yes* | β | Path to JSON config file |
EMAIL_ACCOUNTS | Yes* | β | JSON array of account configs (inline) |
EMAIL_DEFAULT_ACCOUNT | No | First account | Default account ID |
EMAIL_IMAP_TIMEOUT_MS | No | 30000 | IMAP operation timeout (ms) |
EMAIL_SMTP_TIMEOUT_MS | No | 30000 | SMTP operation timeout (ms) |
EMAIL_IMAP_RATE_LIMIT | No | 60 | IMAP requests/minute/account |
EMAIL_SMTP_RATE_LIMIT | No | 100 | SMTP sends/hour/account |
MAX_ATTACHMENT_SIZE_MB | No | 18 | Max size per attachment (MB) |
MAX_TOTAL_ATTACHMENT_SIZE_MB | No | 18 | Max total attachment size per message (MB) |
MAX_DOWNLOAD_SIZE_MB | No | 25 | Max attachment download size (MB) |
EMAIL_POOL_CLOSE_TIMEOUT_MS | No | 5000 | Pool close timeout (ms) |
EMAIL_DEBUG | No | false | Debug logging to stderr |
LOG_LEVEL | No | info | Log level: debug, info, warn, error |
LOG_FORMAT | No | json | Log format: json or text |
*One of EMAIL_CONFIG_FILE or EMAIL_ACCOUNTS is required.
The config file contains account passwords. Always restrict access:
| Tool | Description | Key params |
|---|---|---|
email_accounts | List configured accounts with connection status | β |
email_folders | List all folders with unread/total counts | account? |
email_folder_create | Create new folder | name, account? |
| Tool | Description | Key params |
|---|---|---|
email_list | List messages in folder | folder?, limit?, offset?, includeBody?, account? |
email_unread | List unread messages | folder?, limit?, includeBody?, account? |
email_search | Search subject and body | query, from?, to?, since?, before?, folder?, limit?, includeBody?, account? |
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/email-imap-smtp)<a href="https://allmcps.com/mcp/email-imap-smtp"><img src="https://allmcps.com/api/badge/email-imap-smtp?style=directory" alt="SMTP) on AllMCPs" /></a>