loading…
Search for a command to run...
loading…
Enables AI assistants to interact with Fastmail services, providing tools for comprehensive email management, contact searching, and calendar event coordination
Enables AI assistants to interact with Fastmail services, providing tools for comprehensive email management, contact searching, and calendar event coordination via the JMAP API. It supports advanced features like threaded conversations, attachment handling, and bulk mailbox operations through natural language.
A Model Context Protocol (MCP) server for Fastmail email, enabling AI assistants to read inbox mail, search messages, page through large result sets, send and reply to email, and manage drafts.
Tool descriptions are written as routing hints for MCP clients, so prompts like "check email", "read my inbox", "reply to this email", and "save a draft" map more reliably to the right Fastmail tools.
Clone or download this repository
Install dependencies:
npm install
Build the project:
npm run build
Get your Fastmail API token:
Set environment variables:
export FASTMAIL_API_TOKEN="your_api_token_here"
# Optional: customize base URL (defaults to https://api.fastmail.com)
export FASTMAIL_BASE_URL="https://api.fastmail.com"
Start the MCP server:
npm start
For development with auto-reload:
npm run dev
You can also run the server as a private remote MCP endpoint by setting MCP_PATH.
This mode is intended for a small number of trusted clients that all use the same Fastmail account.
export FASTMAIL_API_TOKEN="your_api_token_here"
export MCP_PATH="replace-with-a-long-random-secret-path"
export PORT="3000"
# Optional operational limits
export MCP_MAX_SESSIONS="10"
export MCP_SESSION_TTL_MS="900000"
export MCP_REAP_INTERVAL_MS="60000"
export MCP_MAX_BODY_BYTES="1048576"
npm start
Behavior in HTTP mode:
POST requests are the default hosted path; most remote MCP clients do not need to send mcp-session-id.MCP_PATH, and optionally add reverse-proxy controls such as IP allowlists if they fit your deployment.MCP_MAX_SESSIONS.Default to main branch:
FASTMAIL_API_TOKEN="your_token" FASTMAIL_BASE_URL="https://api.fastmail.com" \
npx --yes github:MadLlama25/fastmail-mcp fastmail-mcp
Windows PowerShell:
$env:FASTMAIL_API_TOKEN="your_token"
$env:FASTMAIL_BASE_URL="https://api.fastmail.com"
npx --yes github:MadLlama25/fastmail-mcp fastmail-mcp
Pin to a tagged release:
FASTMAIL_API_TOKEN="your_token" \
npx --yes github:MadLlama25/[email protected] fastmail-mcp
You can install this server as a Desktop Extension for Claude Desktop using the packaged .dxt file.
Build and pack:
npm run build
npx @anthropic-ai/dxt pack
This produces fastmail-mcp.dxt in the project root.
Install into Claude Desktop:
.dxt file, or drag it into Claude Desktophttps://api.fastmail.com (default)Use any of the tools (e.g. get_recent_emails).
🎯 Most Popular Tools:
items, total, has_more, and next_offset so agents can fetch more only when needed.mailboxId (optional), limit (default: 20), offset (default: 0)emailId (required)inReplyTo and references headers)to (required array), cc (optional array), bcc (optional array), from (optional), mailboxId (optional), subject (required), textBody (optional), htmlBody (optional), inReplyTo (optional array), references (optional array)originalEmailId (required), to (optional array, defaults to original sender), cc (optional array), bcc (optional array), from (optional), textBody (optional), htmlBody (optional)to (required array), cc (optional array), bcc (optional array), from (optional), subject (required), textBody (optional), htmlBody (optional), inReplyTo (optional array), references (optional array)to (optional array), cc (optional array), bcc (optional array), from (optional), mailboxId (optional), subject (optional), textBody (optional), htmlBody (optional)query (required), limit (default: 20), offset (default: 0)limit (default: 10, max: 50), mailboxName (default: 'inbox'), offset (default: 0)emailId (required), read (default: true)emailId (required)emailId (required), targetMailboxId (required)emailId (required), mailboxIds (required array)emailId (required), mailboxIds (required array)emailId (required)emailId (required), attachmentId (required), savePath (optional)query (optional), from (optional), to (optional), subject (optional), hasAttachment (optional), isUnread (optional), mailboxId (optional), after (optional), before (optional), limit (default: 20), offset (default: 0)threadId (required)mailboxId (optional, defaults to all mailboxes)emailIds (required array), read (default: true)emailIds (required array), targetMailboxId (required)emailIds (required array)emailIds (required array), mailboxIds (required array)emailIds (required array), mailboxIds (required array)dryRun (default: true), limit (default: 3)This server uses the JMAP (JSON Meta Application Protocol) API provided by Fastmail. JMAP is a modern, efficient alternative to IMAP for email access.
Many features in this MCP server are inspired by the official Fastmail JMAP-Samples repository, including:
The server uses bearer token authentication with Fastmail's API. API tokens provide secure access without exposing your main account password.
Fastmail applies rate limits to API requests. The server handles standard rate limiting, but excessive requests may be throttled.
src/
├── index.ts # Startup entrypoint (stdio or HTTP mode)
├── mcp-server.ts # MCP server factory and tool handlers
├── http-server.ts # Streamable HTTP session management and limits
├── auth.ts # Authentication handling
└── jmap-client.ts # JMAP client wrapper with paginated email queries
npm run build
npm run dev
MIT
Contributions are welcome! Please ensure that:
npm install to ensure all dependencies are installed npm run buildlimit and offset, then follow next_offset only when has_more is truePOST requests first; mcp-session-id is only needed for explicit stateful-session flowsMCP_MAX_SESSIONS or wait for idle sessions to expire if you are using explicit stateful sessions and the server returns "maximum concurrent MCP sessions reached"If get_email, list_emails, search_emails, or advanced_search fail with "content serialization" or "Cannot read properties of undefined" errors, upgrade to v1.7.1+. This was caused by incomplete JMAP response validation that surfaced after the MCP SDK v1.x upgrade added stricter result checking.
Use the built-in testing tools:
For more detailed error information, check the console output when running the server.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"fastmail-mcp-server": {
"command": "npx",
"args": []
}
}
}