email-smtp-imap-mcp
Health Pass
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 19 GitHub stars
Code Warn
- process.env — Environment variable access in src/accountManager.ts
- network request — Outbound network request in src/imapService.ts
- process.env — Environment variable access in test/accountManager.test.mjs
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
Multi-account email MCP server for SMTP sending, IMAP search, replies, attachments, and inbox organization
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
- Multi-account by design — switch between work, personal, support, or client inboxes 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
Add this to your MCP client configuration. For Claude Desktop, the file is:
- 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_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_from_name\":\"Your Name\",\"sender_emails\":[\"[email protected]\"]},\"personal\":{\"smtp\":{\"host\":\"smtp.mail.me.com\",\"port\":587,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.mail.me.com\",\"port\":993,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"default_from_name\":\"Your Name\"}}",
"DEFAULT_EMAIL_ACCOUNT": "work"
}
}
}
}
Replace the addresses and app passwords, restart your MCP client, and ask it to list your email folders.
Readable multi-account configurationThe escaped EMAIL_ACCOUNTS_JSON value above represents:
{
"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_from_name": "Your Name",
"sender_emails": ["[email protected]", "[email protected]"]
},
"personal": {
"smtp": {
"host": "smtp.mail.me.com",
"port": 587,
"user": "[email protected]",
"password": "app-password"
},
"imap": {
"host": "imap.mail.me.com",
"port": 993,
"user": "[email protected]",
"password": "app-password"
},
"default_from_name": "Your Name"
}
}
Single-account environment 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 |
|---|---|
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 tool accepts an optional account_name. Without it, the server uses DEFAULT_EMAIL_ACCOUNT or the first configured account.
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. Please include a regression test for behavior changes and run npm test before opening a PR.
License
MIT © Sami Halawa
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found