About
A Model Context Protocol server for SMTP email services
README
Email SMTP/IMAP MCP
One local MCP server for every inbox: search, read, send, reply, forward, and organize email across multiple accounts.
release npm downloads CI Node.js stars license
Why this server
- No account-count cap — add work, personal, support, or client inboxes and switch with
account_name. - SMTP + IMAP together — send and receive through one small MCP server.
- Complete everyday workflow — search, read, reply, forward, attach files, flag, archive, move, and list folders.
- Provider-agnostic — works with Gmail, iCloud Mail, Fastmail, Outlook, self-hosted mail, and other standard SMTP/IMAP providers.
- Local stdio transport — no hosted relay and no separate control panel.
Quick start
1. Create your .env
Copy .env.example to a private location and add as many named accounts as you need:
EMAIL_ACCOUNTS_JSON='{
"work": {
"smtp": {
"host": "smtp.gmail.com",
"port": 587,
"secure": false,
"user": "[email protected]",
"password": "app-password"
},
"imap": {
"host": "imap.gmail.com",
"port": 993,
"secure": true,
"user": "[email protected]",
"password": "app-password"
},
"default_from_name": "Your Name",
"sender_emails": ["[email protected]", "[email protected]"]
},
"personal": {
"smtp": {
"host": "smtp.mail.me.com",
"port": 587,
"secure": false,
"user": "[email protected]",
"password": "app-password"
},
"imap": {
"host": "imap.mail.me.com",
"port": 993,
"secure": true,
"user": "[email protected]",
"password": "app-password"
}
}
}'
DEFAULT_EMAIL_ACCOUNT="work"
The server loads .env from its working directory automatically. EMAIL_ENV_FILE lets an MCP client use an .env stored anywhere.
2. Add the MCP server
For Claude Desktop, edit:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"email": {
"command": "npx",
"args": ["-y", "email-smtp-imap-mcp"],
"env": {
"EMAIL_ENV_FILE": "/absolute/path/to/your/.env"
}
}
}
}
Use an absolute path, restart your MCP client, then ask: “List my configured email accounts.”
Pass account JSON directly from the MCP client
You can skip the .env file and set EMAIL_ACCOUNTS_JSON plus DEFAULT_EMAIL_ACCOUNT directly in the MCP client’s env object. The JSON must be escaped into a single string.
{
"env": {
"EMAIL_ACCOUNTS_JSON": "{\"work\":{\"smtp\":{\"host\":\"smtp.gmail.com\",\"port\":587,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.gmail.com\",\"port\":993,\"user\":\"[email protected]\",\"password\":\"app-password\"}}}",
"DEFAULT_EMAIL_ACCOUNT": "work"
}
}
Single-account `.env` variables
Use SMTP_HOST, SMTP_PORT, SMTP_SECURE, SMTP_USER, SMTP_PASS, IMAP_HOST, IMAP_PORT, IMAP_SECURE, IMAP_USER, and IMAP_PASS instead of EMAIL_ACCOUNTS_JSON.
SMTP_USERNAME/SMTP_PASSWORD and IMAP_USERNAME/IMAP_PASSWORD are accepted aliases. IMAP credentials default to the SMTP credentials when omitted. Use SENDER_EMAILS as a comma-separated allowlist for optional from_email selection.
Tools
| Tool | What it does |
|---|---|
accounts_list |
List every configured account and identify the default without exposing credentials. |
emails_find |
Search by text, sender, recipient, subject, date, read state, flag state, or attachments. Optionally return bodies and attachments. |
email_send |
Send plain-text or HTML email with CC, BCC, sender aliases, and base64 attachments. |
email_respond |
Reply, reply-all, or forward by email UID with threading and optional original attachments. |
emails_modify |
Mark read/unread, flag/unflag, or move messages to another folder. |
folders_list |
List folders with optional total and unread counts. |
Every email tool accepts an optional account_name. Without it, the server uses DEFAULT_EMAIL_ACCOUNT or the first configured account. There is no application-level account-count limit.
Verify your setup
After restarting the MCP client, try these in order:
- “List my configured email accounts.”
- “List folders for my
workaccount.” - “Find the five newest unread emails in my
personalaccount.” - “Send a plain-text email from my
workaccount.”
Provider settings
| Provider | SMTP | IMAP | Credential |
|---|---|---|---|
| Gmail | smtp.gmail.com:587 |
imap.gmail.com:993 |
App password |
| iCloud Mail | smtp.mail.me.com:587 |
imap.mail.me.com:993 |
App-specific password |
| Other providers | Use the provider's SMTP host | Use the provider's IMAP host | Provider password or app password |
Use secure: true for implicit TLS ports such as 465/993. Port 587 normally uses secure: false and upgrades with STARTTLS.
Development
git clone https://github.com/samihalawa/email-smtp-imap-mcp.git
cd email-smtp-imap-mcp
npm ci
npm test
Run the compiled stdio server with npm start. Build a production container with docker build -t email-smtp-imap-mcp ..
Contributing
Issues and focused pull requests are welcome. See CONTRIBUTING.md for the development workflow and SECURITY.md for vulnerability reports.
License
MIT © Sami Halawa
Install Smtp in Claude Desktop, Claude Code & Cursor
unyly install smtpInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add smtp -- npx -y github:samihalawa/mcp-server-smtpStep-by-step: how to install Smtp
FAQ
Is Smtp MCP free?
Yes, Smtp MCP is free — one-click install via Unyly at no cost.
Does Smtp need an API key?
No, Smtp runs without API keys or environment variables.
Is Smtp hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Smtp in Claude Desktop, Claude Code or Cursor?
Open Smtp on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Gmail
Read, send and search emails from Claude
by GoogleSlack
Send, search and summarize Slack messages
by SlackRunbear
No-code MCP client for team chat platforms, such as Slack, Microsoft Teams, and Discord.
Discord Server
A community discord server dedicated to MCP by [Frank Fiegel](https://github.com/punkpeye)
Klavis AI
Open Source MCP Infra. Hosted MCP servers and MCP clients on Slack and Discord.
Work90210/APIFold
Turn any REST API into a hosted MCP server. 18 free public servers (GitHub, Stripe, Slack, OpenAI, Notion, and more) — no setup required, bring your own API key
by Work90210arikusi/deepseek-mcp-server
MCP server for DeepSeek AI with chat, reasoning, multi-turn sessions, function calling, thinking mode, and cost tracking.
by arikusihashgraph-online/hashnet-mcp-js
MCP server for the Registry Broker. Discover, register, and chat with AI agents on the Hashgraph network.
by hashgraph-onlineprofullstack/mcp-server
A comprehensive MCP server aggregating 20+ tools including SEO optimization, document conversion, domain lookup, email validation, QR generation, weather data,
by profullstackWayStation-ai/mcp
Seamlessly and securely connect Claude Desktop and other MCP hosts to your favorite apps (Notion, Slack, Monday, Airtable, etc.). Takes less than 90 secs.
by waystation-aiCompare Smtp with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All communication MCPs
