SMTP MCP Server
This server lets you manage multiple email accounts over SMTP/IMAP from an MCP client for everyday inbox workflows.
List configured accounts and identify the default without exposing credentials.
Search emails by text, sender, recipient, subject, date, read state, flag state, or attachments, optionally returning full bodies and base64 attachments.
Send plain-text or HTML email with CC, BCC, sender aliases, and base64 attachments.
Reply, reply-all, or forward by email ID with threading and optional original or additional attachments.
Mark emails read/unread, flag/unflag, or move them between folders.
List folders/labels with optional total and unread counts.
Use any configured account via account_name, falling back to the default account.
Provides SMTP configuration for Gmail as an email sending service that can be used by the MCP server
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., "@SMTP MCP Server send a welcome email to alex@example.com using the welcome template"
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.
Email SMTP/IMAP MCP
One local MCP server for every inbox: search, read, send, reply, forward, and organize email across multiple accounts.
Why this server
For third-party notices, licence enquiries and the version 2.2.2 supplement, see the open source licence compliance programme.
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.
Related MCP server: Email MCP Server
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": "work@example.com",
"password": "app-password"
},
"imap": {
"host": "imap.gmail.com",
"port": 993,
"secure": true,
"user": "work@example.com",
"password": "app-password"
},
"default_from_name": "Your Name",
"sender_emails": ["work@example.com", "alias@example.com"]
},
"personal": {
"smtp": {
"host": "smtp.mail.me.com",
"port": 587,
"secure": false,
"user": "you@icloud.com",
"password": "app-password"
},
"imap": {
"host": "imap.mail.me.com",
"port": 993,
"secure": true,
"user": "you@icloud.com",
"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.jsonWindows:
%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.”
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\":\"work@example.com\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.gmail.com\",\"port\":993,\"user\":\"work@example.com\",\"password\":\"app-password\"}}}",
"DEFAULT_EMAIL_ACCOUNT": "work"
}
}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
See the tool reference for every input, default, response field and error format.
Tool | What it does |
| List every configured account and identify the default without exposing credentials. |
| Search by text, sender, recipient, subject, date, read state, flag state, or attachments. Optionally return bodies and attachments. |
| Send plain-text or HTML email with CC, BCC, sender aliases, and base64 attachments. |
| Reply, reply-all, or forward by email UID with threading and optional original attachments. |
| Mark read/unread, flag/unflag, or move messages to another folder. |
| List folders with optional total and unread counts. |
All tools except accounts_list accept 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 |
|
| |
iCloud Mail |
|
| |
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. Both SMTP and IMAP require TLS 1.2 or newer and a valid server certificate. With secure: false, STARTTLS is mandatory before authentication; servers without STARTTLS are rejected. Plaintext-only relays are not supported.
Development
git clone https://github.com/samihalawa/email-smtp-imap-mcp.git
cd email-smtp-imap-mcp
npm ci
npm testRun 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
Security and release assurance
Report vulnerabilities through the private route in SECURITY.md. The security assurance programme and source-bound review describe the controls, evidence and publication boundaries for this project. They do not claim an external ISO certificate or completed OpenChain conformance.
Maintainers can run npm run assurance to build the package, run security checks, archive pinned component inputs and verify an offline recovery. The generated release assets include platform-specific build inputs and are intended for durable release retention.
Available Tools
6 toolsaccounts_listA
List every configured email account and show which account is the default. Use this before other tools when multiple SMTP/IMAP accounts are configured.
Inputs: no named parameters.
email_respondA
Reply to or forward an existing email. Use this to continue email conversations, respond to messages, or forward information to others.
Inputs: body (required), email_id (required), to, body_type, +5 more.
email_sendA
Send a new email with HTML support and file attachments. Use this to send messages, project updates, or any new email conversation.
Inputs: to (required), body (required), subject (required), cc, +5 more.
emails_findA
Search for emails in your inbox with flexible filters. Optionally get full email content and attachments. Use this to find specific emails, check for unread messages, or browse your inbox.
Inputs: limit, query, filters, account_name, +2 more.
emails_modifyA
Change email states like read/unread, flagged, or move between folders. Use this to organize your inbox, mark emails as read, archive messages, or flag important emails.
Inputs: email_ids (required), flag, unflag, mark_read, +3 more.
folders_listA
List all available email folders/labels in your account. Use this to see your folder structure and organize emails.
Inputs: account_name, include_counts.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct operation: account listing, folder listing, searching, modifying, sending, and responding. There is no overlap; even email_send and email_respond are clearly separated by new vs. reply/forward.
Most tools follow a consistent resource_action pattern (e.g., accounts_list, emails_find). However, there is minor inconsistency in singular vs. plural usage (accounts_list vs. email_send) and action placement, but it remains readable.
With 6 tools, the server is well-scoped for email operations. Each tool earns its place, covering account context, folder navigation, search, state changes, and message creation without redundancy.
The toolset covers the core email workflow: discover accounts and folders, find messages, modify their state, send new emails, and reply/forward. No essential operation is missing; even email deletion can be handled via moving to trash.
Maintenance
Related MCP Connectors
Send transactional emails for AI agents via SMTP. Templates included.
Send, track, and manage transactional and bulk email delivery
Send transactional email over a verified domain — templates, attachments, custom headers.
Send email, manage domains, templates, webhooks and broadcasts from your AI agent.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables sending emails via SMTP with support for HTML content, attachments, bulk sending, and template-based emails. Features session management and full MCP Streamable HTTP transport compliance.-
- AlicenseNot gradedqualityDmaintenanceEnables sending emails through SMTP using nodemailer, allowing AI assistants to send plain text and HTML emails with configurable SMTP credentials.27 npm2ISC
- AlicenseNot gradedqualityDmaintenanceEnables sending and receiving emails through SMTP, IMAP, and POP3 protocols with support for attachments, HTML content, and email validation.MIT
- FlicenseAqualityDmaintenanceEnables sending emails through SMTP with support for multiple recipients, attachments, CC/BCC, and both plain text and HTML formats. Includes preset configurations for common email providers like Gmail, QQ, Outlook, and 163.5-