FastMail MCP Server

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.

Category
Visit Server

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

  1. Clone the repository:

    git clone <your-repo-url>
    cd fastmail-mcp-server
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. 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

  1. Authentication Error: Verify your API token is correct and has proper permissions
  2. Connection Error: Check your internet connection and FastMail service status
  3. 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

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

šŸ“„ License

MIT License - see LICENSE file for details.

šŸ™ Acknowledgments

šŸ“š Additional Resources

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured