trackmcp
Back to directory
jmhron

FastMailMCP

View on GitHub

FastMail

2 stars PythonOthers Updated Jan 5, 2026

Documentation

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:

bash
git clone 
   cd fastmail-mcp-server

2. Install dependencies:

bash
pip install -r requirements.txt

3. Get your FastMail API token:

    ๐Ÿš€ Usage

    Running the Server

    bash
    python fastmail_mcp_server.py

    The server will start and listen for MCP commands via stdio.

    Configuration

    First, configure your FastMail credentials:

    json
    {
      "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.

    json
    {
      "tool": "list_mailboxes",
      "arguments": {
        "role": "inbox"  // Optional: filter by role
      }
    }

    ๐Ÿ” find_mailbox

    Find a specific mailbox by name or role.

    json
    {
      "tool": "find_mailbox", 
      "arguments": {
        "name": "Work",     // Partial matching supported
        "role": "sent"      // Or search by role
      }
    }

    ๐Ÿ“ง get_emails

    Get emails from a specific mailbox.

    json
    {
      "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.

    json
    {
      "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.

    json
    {
      "tool": "get_email_body",
      "arguments": {
        "emailId": "email-id-here",
        "format": "text"  // "text", "html", or "both"
      }
    }

    ๐Ÿ“ค send_email

    Send an email through FastMail.

    json
    {
      "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:

    json
    {
      "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

    code
    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:

    bash
    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

    Frequently asked questions

    What is FastMailMCP?

    FastMailMCP is FastMail

    How do I install FastMailMCP?

    Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.

    Is FastMailMCP open source?

    Yes โ€” it is hosted on GitHub at https://github.com/jmhron/FastMailMCP and has 2 stars.

    Related MCP tools

    Run your own MCP server? See who uses it and what to fix.

    Measure it with TrackMCP