FastMail MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone <your-repo-url>
cd fastmail-mcp-server
pip install -r requirements.txt
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add fastmail-mcp -- python "<FULL_PATH_TO_FASTMAILMCP>/dist/index.js"

Replace <FULL_PATH_TO_FASTMAILMCP>/dist/index.js with the actual folder you prepared in step 1.

README.md

An MCP server for integrating with FastMail's 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

  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 tes

Tools (7)

configure_fastmailSet up your FastMail API credentials.
list_mailboxesList all mailboxes with their names, roles, and email counts.
find_mailboxFind a specific mailbox by name or role.
get_emailsGet emails from a specific mailbox.
search_emailsSearch emails with advanced filtering.
get_email_bodyGet the full body content of a specific email.
send_emailSend an email through FastMail.

Environment Variables

MCP_DEBUGEnable debug logging

Configuration

claude_desktop_config.json
{"mcpServers": {"fastmail": {"command": "python", "args": ["/path/to/fastmail_mcp_server.py"]}}}

Try it

→List all my mailboxes to see which ones I have.
→Search for emails from my boss about the project update sent this month.
→Find the latest email in my Inbox and show me the full body content.
→Send an email to team@example.com with the subject 'Meeting Notes' and the body 'Here are the notes from today.'
→Find all emails in my Work folder that have attachments.

Frequently Asked Questions

What are the key features of FastMail MCP Server?

Mailbox management to list and find folders. Email reading with preview and full body retrieval. Advanced search capabilities including sender, subject, and date range filters. Email sending functionality with CC and BCC support. Fast performance leveraging the JMAP protocol.

What can I use FastMail MCP Server for?

Automating email triage by searching for specific project-related keywords. Quickly retrieving and summarizing email content without leaving the AI interface. Drafting and sending routine emails directly through natural language commands. Managing folder organization by identifying and listing mailbox roles.

How do I install FastMail MCP Server?

Install FastMail MCP Server by running: git clone <your-repo-url> && cd fastmail-mcp-server && pip install -r requirements.txt

What MCP clients work with FastMail MCP Server?

FastMail MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep FastMail MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare