Multi-account IMAP/SMTP email MCP server with 22 tools
mcp-server-email
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).
Quick Start
Install
go install github.com/boutquin/mcp-server-email/cmd/mcp-server-email@latestCreate 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:
[ { "id": "hello", "email": "hello@gmail.com", "username": "hello@gmail.com", "password": "app-password-here" } ]For custom mail servers, specify host and port explicitly:
[ { "id": "work", "email": "hello@example.com", "imap_host": "mail.example.com", "imap_port": 993, "smtp_host": "mail.example.com", "smtp_port": 465, "username": "hello@example.com", "password": "app-password-here" } ]chmod 600 ~/.config/mcp-email/accounts.jsonAdd to Claude Code (
~/.claude.json){ "mcpServers": { "email": { "command": "mcp-server-email", "env": { "EMAIL_CONFIG_FILE": "~/.config/mcp-email/accounts.json" } } } }Restart Claude Code — the
email_*tools are now available.
Installation
Go Install (recommended for Go developers)
go install github.com/boutquin/mcp-server-email/cmd/mcp-server-email@latest
Homebrew (macOS/Linux)
brew install boutquin/tap/mcp-server-email
Binary Download
Download pre-built binaries for your platform from GitHub Releases.
Available for: Linux (amd64, arm64), macOS (amd64, arm64), Windows (amd64, arm64).
Docker
docker run --rm \
-e EMAIL_ACCOUNTS='[{"id":"main","email":"user@example.com","imap_host":"mail.example.com","imap_port":993,"smtp_host":"mail.example.com","smtp_port":465,"username":"user@example.com","password":"app-password"}]' \
ghcr.io/boutquin/mcp-server-email:latest
MCP Bundle (Claude Desktop)
Download the .mcpb file from Releases and open in Claude Desktop.
Build from source
git clone https://github.com/boutquin/mcp-server-email.git
cd mcp-server-email
go build -o mcp-server-email ./cmd/mcp-server-email
Configuration
Accounts are loaded once at startup. Changes require a server restart.
Config file vs environment variable
| 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.
Account JSON schema
[
{
"id": "hello",
"email": "hello@example.com",
"imap_host": "mail.example.com",
"imap_port": 993,
"smtp_host": "mail.example.com",
"smtp_port": 465,
"username": "hello@example.com",
"password": "app-password-here"
}
]
| 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 a
Tools (5)
email_list_foldersList all available folders in an email account.email_list_messagesList messages in a specific folder.email_get_messageRetrieve the full content of a specific email message.email_send_messageSend a new email message.email_search_messagesSearch for messages based on query criteria.Environment Variables
EMAIL_CONFIG_FILEPath to a JSON file containing account configurations.EMAIL_ACCOUNTSInline JSON string containing account configurations.Configuration
{"mcpServers": {"email": {"command": "mcp-server-email", "env": {"EMAIL_CONFIG_FILE": "~/.config/mcp-email/accounts.json"}}}}