Fastmail MCP Server
Enables AI assistants to securely access and search Fastmail emails via the JMAP API. Supports searching emails, retrieving full email content, and listing mailboxes with read-only access using Fastmail API tokens.
README
Fastmail MCP Server
An MCP (Model Context Protocol) server that provides AI assistants with secure access to your Fastmail emails via the JMAP API.
Features
- 🔍 Search Emails: Search your emails by text query and filter by mailbox
- 📧 Get Email Details: Retrieve full email content including body and attachments
- 📁 List Mailboxes: View all your mailboxes with email counts
- 🔒 Secure: Uses Fastmail API tokens with proper authentication
Prerequisites
- Python 3.12+
- A Fastmail account
- Fastmail API token (instructions below)
Getting Your Fastmail API Token
- Log into your Fastmail account
- Go to Settings → Privacy & Security → Integrations → API Tokens
- Or visit: https://app.fastmail.com/settings/security/tokens/new
- Create a new API token with the following scopes:
urn:ietf:params:jmap:core(Required)urn:ietf:params:jmap:mail(Required for email access)
- Copy the generated token - you'll need it for setup
Installation
-
Clone or download this repository
-
Install dependencies:
pip install -r requirements.txt
- Create a
.envfile in the project root:
cp .env.example .env
- Edit
.envand add your Fastmail API token:
FASTMAIL_API_TOKEN=your_actual_token_here
Configuration for AI Clients
Claude Desktop
Add this to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"fastmail": {
"command": "python",
"args": ["/absolute/path/to/fastmail_mcp.py"],
"env": {
"FASTMAIL_API_TOKEN": "your_fastmail_api_token_here"
}
}
}
}
Replace /absolute/path/to/ with the actual path to this project.
Other MCP Clients
For other MCP-compatible clients (VS Code, Cursor, etc.), configure them to run:
python /path/to/fastmail_mcp.py
Make sure to set the FASTMAIL_API_TOKEN environment variable.
Smithery Deployment
This server is configured for deployment on Smithery, a platform for hosting and sharing MCP servers. When deployed to Smithery, users provide their Fastmail API token through Smithery's configuration flow - no token is required at build time.
Deploy to Smithery:
- Push this repository to GitHub
- Go to the Smithery dashboard and click "Deploy"
- Select "From GitHub" and connect your repository
- Smithery will build and host your server automatically
When users install your server from Smithery, they'll be prompted to enter their Fastmail API token through Smithery's secure configuration interface.
Use via Smithery CLI:
# Install Smithery CLI
npm install -g @smithery/cli
# Run the server (you'll be prompted for your API token)
smithery run @your-username/fastmail-mcp --config '{"FASTMAIL_API_TOKEN":"your_token"}'
Add to Claude Desktop via Smithery:
{
"mcpServers": {
"fastmail": {
"command": "npx",
"args": [
"-y",
"@smithery/cli@latest",
"run",
"@your-username/fastmail-mcp",
"--config",
"{\"FASTMAIL_API_TOKEN\":\"your_token_here\"}"
]
}
}
}
HTTP Mode (for Smithery/remote deployment):
The server supports both stdio (local) and HTTP (remote) transports:
# Run in HTTP mode on port 8000
python fastmail_mcp.py --http
# Run in stdio mode (default, for local use)
python fastmail_mcp.py
Available Tools
1. search_emails
Search emails in your Fastmail account.
Parameters:
query(string, optional): Search text (searches subject, body, from, to)limit(number, optional): Max emails to return (default: 10, max: 50)mailbox(string, optional): Filter by mailbox (e.g., "inbox", "sent", "archive")
Example usage in Claude:
"Search my emails for messages about 'project deadline'" "Show me the last 5 emails in my inbox" "Find emails from john@example.com"
2. get_email
Get the full content of a specific email.
Parameters:
email_id(string, required): The email ID from search results
Example usage in Claude:
"Show me the full content of email ID abc123" "Get the email body for that message"
3. list_mailboxes
List all mailboxes with their email counts.
Example usage in Claude:
"What mailboxes do I have?" "Show me my folders and how many emails are in each"
Testing
You can test the MCP server using the MCP Inspector:
npx @modelcontextprotocol/inspector python fastmail_mcp.py
This opens a web UI where you can manually test the tools.
Security Notes
- Your API token grants full access to your Fastmail account - keep it secure
- Never commit your
.envfile or expose your API token - The MCP server only has read access (no sending or deleting emails)
- Consider creating a dedicated API token just for this MCP server
Troubleshooting
"FASTMAIL_API_TOKEN environment variable must be set"
- Make sure your
.envfile exists and contains your API token - For Claude Desktop, ensure the token is in the config file
"401 Unauthorized"
- Check that your API token is correct and hasn't been revoked
- Ensure the token has the required scopes
No emails returned
- Try broadening your search query
- Check that the mailbox name is correct (use
list_mailboxesto see available mailboxes)
API Rate Limits
Fastmail has rate limits on API requests. The MCP server handles this gracefully, but avoid making excessive requests in short periods.
License
MIT License - feel free to modify and use as needed.
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
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 模型以安全和受控的方式获取实时的网络信息。