FastMail MCP Server
An MCP server that integrates with FastMail's JMAP API to manage mailboxes, search for emails, and send messages. It enables users to interact with their FastMail account for tasks like reading email content and managing folders through natural language.
README
FastMail MCP Server
A Model Context Protocol (MCP) server for integrating with FastMail's JMAP API. This server provides tools for reading emails, searching, managing folders, and sending emails through FastMail.
🚀 Features
- 📁 Mailbox Management: List and find mailboxes/folders
- 📧 Email Reading: Get emails from specific folders with previews
- 🔍 Advanced Search: Search by keyword, sender, subject, date range, attachments
- 📤 Email Sending: Send emails with CC/BCC support
- 🎯 Folder Targeting: Search within specific folders
- ⚡ Fast Performance: Uses FastMail's modern JMAP protocol
📋 Prerequisites
- Python 3.8+
- FastMail account with API access
- API token from FastMail (Settings → Privacy & Security → Integrations)
🛠 Installation
-
Clone the repository:
git clone <your-repo-url> cd fastmail-mcp-server -
Install dependencies:
pip install -r requirements.txt -
Get your FastMail API token:
- Log into FastMail
- Go to Settings → Privacy & Security → Integrations
- Create a new API token
- Copy the token (starts with
fmu1-)
🚀 Usage
Running the Server
python fastmail_mcp_server.py
The server will start and listen for MCP commands via stdio.
Configuration
First, configure your FastMail credentials:
{
"tool": "configure_fastmail",
"arguments": {
"apiToken": "fmu1-your-token-here"
}
}
Available Tools
📁 configure_fastmail
Set up your FastMail API credentials.
📁 list_mailboxes
List all mailboxes with their names, roles, and email counts.
{
"tool": "list_mailboxes",
"arguments": {
"role": "inbox" // Optional: filter by role
}
}
🔍 find_mailbox
Find a specific mailbox by name or role.
{
"tool": "find_mailbox",
"arguments": {
"name": "Work", // Partial matching supported
"role": "sent" // Or search by role
}
}
📧 get_emails
Get emails from a specific mailbox.
{
"tool": "get_emails",
"arguments": {
"mailboxId": "mailbox-id-here", // From list_mailboxes
"mailboxName": "Inbox", // Alternative to mailboxId
"limit": 20, // Max emails to fetch
"includeBody": false // Include full email body
}
}
🔍 search_emails
Search emails with advanced filtering.
{
"tool": "search_emails",
"arguments": {
"keyword": "project update", // Text search
"from_email": "boss@company.com", // From specific sender
"subject": "meeting", // Subject contains
"mailboxId": "inbox-id", // Search within folder
"hasAttachment": true, // Has attachments
"after": "2024-01-01", // Date range
"before": "2024-12-31",
"limit": 50,
"includeBody": false
}
}
📖 get_email_body
Get the full body content of a specific email.
{
"tool": "get_email_body",
"arguments": {
"emailId": "email-id-here",
"format": "text" // "text", "html", or "both"
}
}
📤 send_email
Send an email through FastMail.
{
"tool": "send_email",
"arguments": {
"to": ["recipient@example.com"],
"cc": ["cc@example.com"], // Optional
"bcc": ["bcc@example.com"], // Optional
"subject": "Hello from MCP!",
"body": "This is the email body.",
"isHtml": false // Set to true for HTML emails
}
}
🔧 Integration with MCP Clients
Claude Desktop
Add to your Claude Desktop config:
{
"mcpServers": {
"fastmail": {
"command": "python",
"args": ["/path/to/fastmail_mcp_server.py"]
}
}
}
Other MCP Clients
This server follows the standard MCP protocol and should work with any MCP-compatible client.
🏗 Project Structure
fastmail-mcp-server/
├── fastmail_mcp_server.py # Main server implementation
├── requirements.txt # Python dependencies
├── pyproject.toml # Package configuration
├── README.md # This file
└── examples/ # Example usage scripts
└── test_server.py # Test script
🔒 Security Notes
- API Token Security: Never commit your API token to version control
- Permissions: The API token has access to your entire FastMail account
- Network: All communication uses HTTPS with FastMail's secure APIs
🐛 Troubleshooting
Common Issues
- Authentication Error: Verify your API token is correct and has proper permissions
- Connection Error: Check your internet connection and FastMail service status
- Missing Emails: Ensure you're searching in the correct mailbox
Debug Mode
Enable debug logging by setting environment variable:
export MCP_DEBUG=1
python fastmail_mcp_server.py
🤝 Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
- FastMail for their excellent JMAP API
- Model Context Protocol by Anthropic
- JMAP Specification by the IETF
📚 Additional Resources
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。