Email SMTP/IMAP MCP Server
Enables sending, searching, replying to, and organizing Gmail emails through SMTP and IMAP protocols, with support for attachments, threading, and folder management.
Enables sending, searching, replying to, and organizing iCloud Mail emails through SMTP and IMAP protocols, with support for attachments, threading, and folder management.
Click on "Install 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., "@Email SMTP/IMAP MCP Serverfind unread emails from my boss this week"
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 MCP Server
A clean, simple stdio MCP server for email operations supporting both SMTP (sending) and IMAP (reading).
Features
✅ Send emails with HTML and attachments
✅ Search emails with flexible filters
✅ Reply/Forward with proper threading
✅ Organize (mark read, archive, flag)
✅ Multi-account support for managing multiple email accounts
✅ List folders to browse your mailbox structure
Related MCP server: Email Send/Receive MCP Server
Quick Start
Installation
npx -y email-smtp-imap-mcpOr install globally:
npm install -g email-smtp-imap-mcpConfiguration
Add to your Claude Desktop config file:
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\":\"your@gmail.com\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.gmail.com\",\"port\":993,\"user\":\"your@gmail.com\",\"password\":\"app-password\"},\"default_from_name\":\"Your Name\",\"sender_emails\":[\"your@gmail.com\"]}}",
"DEFAULT_EMAIL_ACCOUNT": "work"
}
}
}
}⚠️ Important: Restart Claude Desktop after adding this configuration.
Email Provider Settings
Gmail
"EMAIL_ACCOUNTS_JSON": "{\"gmail\":{\"smtp\":{\"host\":\"smtp.gmail.com\",\"port\":587,\"user\":\"your@gmail.com\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.gmail.com\",\"port\":993,\"user\":\"your@gmail.com\",\"password\":\"app-password\"},\"default_from_name\":\"Your Name\",\"sender_emails\":[\"your@gmail.com\"]}}"Setup: Create App Password
iCloud Mail
"EMAIL_ACCOUNTS_JSON": "{\"icloud\":{\"smtp\":{\"host\":\"smtp.mail.me.com\",\"port\":587,\"user\":\"your@icloud.com\",\"password\":\"app-specific-password\"},\"imap\":{\"host\":\"imap.mail.me.com\",\"port\":993,\"user\":\"your@icloud.com\",\"password\":\"app-specific-password\"},\"default_from_name\":\"Your Name\",\"sender_emails\":[\"your@icloud.com\"]}}"Setup: Generate App-Specific Password
Outlook/Office 365
"EMAIL_ACCOUNTS_JSON": "{\"outlook\":{\"smtp\":{\"host\":\"smtp-mail.outlook.com\",\"port\":587,\"user\":\"your@outlook.com\",\"password\":\"your-password\"},\"imap\":{\"host\":\"outlook.office365.com\",\"port\":993,\"user\":\"your@outlook.com\",\"password\":\"your-password\"},\"default_from_name\":\"Your Name\",\"sender_emails\":[\"your@outlook.com\"]}}"Multiple Accounts
"EMAIL_ACCOUNTS_JSON": "{\"work\":{\"smtp\":{\"host\":\"smtp.gmail.com\",\"port\":587,\"user\":\"work@company.com\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.gmail.com\",\"port\":993,\"user\":\"work@company.com\",\"password\":\"app-password\"},\"default_from_name\":\"John Doe\"},\"personal\":{\"smtp\":{\"host\":\"smtp.mail.me.com\",\"port\":587,\"user\":\"me@icloud.com\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.mail.me.com\",\"port\":993,\"user\":\"me@icloud.com\",\"password\":\"app-password\"},\"default_from_name\":\"John\"}}",
"DEFAULT_EMAIL_ACCOUNT": "work"The server also accepts flat or single-account environment variables. For compatibility, SMTP_USERNAME/SMTP_PASSWORD are aliases for SMTP_USER/SMTP_PASS, IMAP_USERNAME/IMAP_PASSWORD are aliases for IMAP_USER/IMAP_PASS, and IMAP_USER/IMAP_PASS fall back to the SMTP credentials when omitted.
Available Tools
Tool | Description |
| Search emails with flexible filters (sender, subject, date, attachments, etc.) |
| Mark as read/unread, flag, archive, or move emails |
| Send new emails with HTML content and attachments |
| Reply or forward emails with proper threading |
| List all available email folders |
Usage Examples
Ask Claude to:
"Find unread emails from last week"
"Send an email to team@company.com about the meeting"
"Reply to the last email from Sarah"
"Archive all emails older than 30 days"
"List my email folders"
"Find emails with attachments from my boss"
"Mark all emails from newsletter@site.com as read"
Security Notes
Never commit
.envfiles or credentials to version controlUse app-specific passwords or app passwords, not your main account password
The server runs locally on your machine - credentials stay private
All email connections use TLS encryption (ports 587 for SMTP, 993 for IMAP)
Development
# Clone the repository
git clone https://github.com/samihalawa/email-smtp-imap-mcp.git
cd email-smtp-imap-mcp
# Install dependencies
npm install
# Build
npm run build
# Run locally
npm startTroubleshooting
Authentication Errors
Make sure you're using an app password, not your regular password
For Gmail: Create App Password
For iCloud: Generate App-Specific Password
Server Not Starting
Verify your configuration JSON is properly escaped
Check that ports 587 (SMTP) and 993 (IMAP) are not blocked by your firewall
Restart Claude Desktop after configuration changes
Connection Issues
Confirm your email provider allows IMAP/SMTP access
Check your internet connection
Verify the SMTP/IMAP host and port settings for your provider
License
MIT License - see LICENSE file for details
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Author
Sami Halawa - GitHub
Made with ❤️ for the MCP community
Maintenance
Related MCP Servers
- Alicense-qualityDmaintenanceEnables comprehensive email management through IMAP/SMTP protocols with tools for searching, organizing, moving, flagging, and sending emails across various email providers. Features safe preview mode for destructive operations and supports multiple email providers including Gmail, Outlook, and Chinese email services.Last updated28MIT
- Alicense-qualityCmaintenanceEnables sending and receiving emails through SMTP, IMAP, and POP3 protocols with support for attachments, HTML content, and email validation.Last updatedMIT
- Alicense-qualityDmaintenanceEnables email management through IMAP and SMTP protocols, supporting reading, sending, replying to emails with proper threading, and downloading attachments. Supports multiple email accounts with flexible configuration options.Last updated1BSD 3-Clause
- AlicenseBqualityCmaintenanceEnables users to manage email accounts via IMAP/SMTP, including reading, searching, sending emails with attachments and calendar invites, all through natural language interactions with MCP-compatible clients.Last updated14MIT
Related MCP Connectors
Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Email for AI agents — send, receive as a webhook, manage domains, templates, routing.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/samihalawa/email-smtp-imap-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server