Email SMTP/IMAP MCP Server
Enables email management through SMTP and IMAP protocols with support for sending emails with attachments, searching and filtering messages, replying/forwarding with threading, organizing mailboxes, and managing multiple email accounts.
README
Email MCP Server
A clean, simple 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
Quick Start
Installation
npx -y email-smtp-imap-mcp
Or install globally:
npm install -g email-smtp-imap-mcp
Configuration
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},\"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},\"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},\"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},\"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},\"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},\"default_from_name\":\"John\"}}",
"DEFAULT_EMAIL_ACCOUNT": "work"
Available Tools
| Tool | Description |
|---|---|
emails_find |
Search emails with flexible filters (sender, subject, date, attachments, etc.) |
emails_modify |
Mark as read/unread, flag, archive, or move emails |
email_send |
Send new emails with HTML content and attachments |
email_respond |
Reply or forward emails with proper threading |
folders_list |
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 control - Use 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 start
Troubleshooting
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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。