pyfastmail-mcp

MCP server for Fastmail — email, contacts, calendars, and files via JMAP, CardDAV, CalDAV, and WebDAV

pyfastmail-mcp

An MCP server that gives AI assistants full access to your Fastmail account — email, contacts, calendars, and file storage.

⚠️ This server can send email, delete messages, and modify contacts/calendars on your behalf. AI assistants may act on content from untrusted sources (emails, web pages, files) which could contain prompt injection attacks. Review tool calls before approving them, especially actions that send email or delete data.

Features

DomainProtocolTools
MailJMAPSend, reply, forward, search, read, pin, archive, keywords, masked email, attachments, threads, import/export, identities
ContactsJMAPList address books, CRUD contacts, query
CalendarCalDAVList calendars, CRUD events (optional — requires app password)
FilesWebDAVList, upload, download, move, delete, create folders (optional — requires app password)

Installation

pip install pyfastmail-mcp

Or run directly with uvx:

uvx pyfastmail-mcp

Configuration

1. Get Fastmail Credentials

You need an API token from Fastmail. An app password is optional (only needed for calendar and file storage).

If you only set the API token, the server starts with mail and contacts tools. Calendar and file tools are registered only when the app password is also provided.

2. Set Environment Variables

export FASTMAIL_API_TOKEN="fmu1-..."
export FASTMAIL_APP_PASSWORD="your-app-password"
export FASTMAIL_EMAIL="[email protected]"

3. Add to Your MCP Client

For Claude Desktop, add to claude_desktop_config.json:

{
  "mcpServers": {
    "fastmail": {
      "command": "uvx",
      "args": ["pyfastmail-mcp"],
      "env": {
        "FASTMAIL_API_TOKEN": "fmu1-...",
        "FASTMAIL_APP_PASSWORD": "your-app-password",
        "FASTMAIL_EMAIL": "[email protected]"
      }
    }
  }
}

For Kiro CLI, add to .kiro/settings/mcp.json:

{
  "mcpServers": {
    "fastmail": {
      "command": "uvx",
      "args": ["pyfastmail-mcp"],
      "env": {
        "FASTMAIL_API_TOKEN": "${FASTMAIL_API_TOKEN}",
        "FASTMAIL_EMAIL": "${FASTMAIL_EMAIL}",
        "FASTMAIL_APP_PASSWORD": "${FASTMAIL_APP_PASSWORD}"
      }
    }
  }
}

Tools

Mail (mail_*)

ToolDescription
health_checkVerify connection and auth
mail_list_mailboxesList all mailboxes (folders/labels)
mail_create_mailboxCreate a mailbox
mail_rename_mailboxRename a mailbox
mail_delete_mailboxDelete a mailbox
mail_get_emailGet email by ID (with optional headers)
mail_get_recent_emailsGet recent emails
mail_search_emailsSearch by query
mail_search_snippetsHighlighted search result snippets
mail_get_email_threadGet full thread
mail_mark_email_readMark read/unread
mail_pin_emailPin/unpin (flag/star)
mail_move_emailMove to mailbox
mail_delete_emailMove to trash or permanently delete
mail_archive_emailArchive
mail_manage_email_labelsAdd/remove keywords
mail_export_emailDownload raw .eml file
mail_import_emailImport .eml into mail store
mail_parse_emailParse a blob as email without importing
mail_list_identitiesList send-as identities
mail_set_identityCreate/update/delete identities
mail_send_emailSend new email
mail_reply_to_emailReply to email
mail_forward_emailForward email
mail_list_masked_emailsList masked emails
mail_create_masked_emailCreate masked email
mail_update_masked_emailUpdate masked email state, domain, description, or URL
mail_download_attachmentDownload attachment
mail_upload_attachmentUpload blob for sending

Contacts (contacts_*)

ToolDescription
contacts_list_address_booksList address books
contacts_listList contacts (query+get combo)
contacts_get_contactGet contact(s) by ID
contacts_query_contactsQuery contacts with filters and sorting
contacts_create_contactCreate contact
contacts_update_contactUpdate contact fields
contacts_delete_contactDelete contact(s)

Calendar (calendar_*)

ToolDescription
calendar_list_calendarsList calendars
calendar_list_eventsList events
calendar_get_eventGet event details
calendar_create_eventCreate event
calendar_update_eventUpdate event
calendar_delete_eventDelete event

Files (files_*)

ToolDescription
files_listList files/folders
files_getDownload file
files_uploadUpload file
files_create_folderCreate folder
files_moveMove/rename file
files_deleteDelete file/folder

Development

git clone https://github.com/pjosols/pyfastmail-mcp.git
cd pyfastmail-mcp
uv sync --group dev
uv run pytest

License

MIT

Related Servers