FastMail
Interact with FastMail's email, calendar, and contacts via its JMAP API.
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
Related Servers
Twitter MCP Server
Accurately count Twitter/X post characters and optimize posts.
ChatSum
Summarize chat messages from a local database file.
MCP-Pushover Bridge
Enables AI assistants to send push notifications via the Pushover service.
MCP Reddit Server
An MCP server for interacting with the Reddit API, enabling searches for posts, comments, and subreddits.
Notifications
Send native macOS notifications with full Notification Center integration and interactive features.
Outlook MCP Server
Read, search, and manage emails in Microsoft Outlook through a standardized interface.
Tiny Chat
A simple chat application that requires an external database configuration.
News Feed
A news feed server for aggregating news from various sources.
Damien Email Wrestler
An AI-powered email intelligence platform that integrates with Gmail and OpenAI. It can be run as a CLI tool or deployed on AWS Lambda for enhanced capabilities.
Discord
A server for reading and sending messages on Discord.