home / mcp / fastmail mcp server

Fastmail MCP Server

A Model Context Protocol (MCP) server that provides tools for interacting with JMAP (JSON Meta Application Protocol) email servers. Built with Deno and using the jmap-jam client library.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "wyattjoh-jmap-mcp": {
      "command": "deno",
      "args": [
        "run",
        "--allow-net=api.fastmail.com",
        "--allow-env=JMAP_SESSION_URL,JMAP_BEARER_TOKEN,JMAP_ACCOUNT_ID",
        "jsr:@wyattjoh/[email protected]"
      ],
      "env": {
        "JMAP_ACCOUNT_ID": "YOUR_ACCOUNT_ID",
        "JMAP_SESSION_URL": "https://api.fastmail.com/jmap/session",
        "JMAP_BEARER_TOKEN": "API_TOKEN"
      }
    }
  }
}

You can run a MCP server that provides JMAP-based email tools. Built with Deno and leveraging the jmap-jam client, this MCP server exposes practical actions for searching, retrieving, organizing, sending, and threading emails, all while validating input and handling errors robustly.

How to use

Connect with a MCP client to perform common email actions such as searching for messages, retrieving emails and threads, marking read or flagged status, moving or deleting messages, and composing or replying to emails. You will interact with the server through standard MCP client calls; the server handles JMAP protocol compatibility, input validation, pagination, and error handling. Use the provided environment variables to authorize requests and point the client at your JMAP server.

How to install

Prerequisites include a Deno runtime and a JMAP-compliant email server with valid credentials.

Install and run the MCP server as shown in the setup example.

{
  "mcpServers": {
    "fastmail": {
      "type": "stdio",
      "command": "deno",
      "args": [
        "run",
        "--allow-net=api.fastmail.com",
        "--allow-env=JMAP_SESSION_URL,JMAP_BEARER_TOKEN,JMAP_ACCOUNT_ID",
        "jsr:@wyattjoh/[email protected]"
      ],
      "env": {
        "JMAP_SESSION_URL": "https://api.fastmail.com/jmap/session",
        "JMAP_BEARER_TOKEN": "API_TOKEN"
      }
    }
  }
}

Additional notes

Environment variables control access and target the specific JMAP server. Ensure the session URL is reachable and the bearer token has permission to access the desired account. The MCP server validates inputs with strong typing and provides comprehensive error handling. You can run the server in development mode with live reloading by using the provided Deno command and watching the source files.

Security considerations

All input is validated using strict schemas, and sensitive configuration lives in environment variables rather than being logged or exposed in responses.

Troubleshooting

If you cannot connect, verify that the JMAP session URL and bearer token are correct, the account ID (if required) is valid, and the JMAP server is reachable from the MCP host network.

Notes

This MCP server is designed to work with any JMAP-compliant email server. Ensure your chosen backend supports RFC 8620/8621 and that credentials permit the requested operations.

Available tools

search_emails

Search emails with text queries, sender/recipient filters, date ranges, and keywords

get_emails

Retrieve specific emails by ID with full details

get_threads

Retrieve email threads (conversation chains)

mark_emails

Mark emails as read/unread, flagged/unflagged

move_emails

Move emails between mailboxes

delete_emails

Delete emails permanently

get_mailboxes

List all mailboxes/folders with hierarchy support

send_email

Compose and send new emails with plain text or HTML

reply_to_email

Reply to existing emails with reply-all support