pyfastmail-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| FASTMAIL_EMAIL | Yes | Your Fastmail email address. | |
| FASTMAIL_API_TOKEN | Yes | Fastmail API Token used for JMAP/mail access (e.g., fmu1-...). | |
| FASTMAIL_APP_PASSWORD | Yes | Fastmail App Password used for CardDAV, CalDAV, and WebDAV access. |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| health_checkA | Verify connectivity to Fastmail and return account info. |
| mail_list_mailboxesA | List all JMAP mailboxes (Fastmail folders and labels) with id, name, role, email counts, and parentId. In Fastmail, both folders and labels are represented as JMAP mailboxes. An email can belong to multiple mailboxes simultaneously — this is how labels work. Nested folders have a parentId pointing to their parent mailbox. System mailboxes (inbox, sent, trash, drafts, archive, spam) have a role field set. |
| mail_create_mailboxA | Create a new JMAP mailbox (folder or label) with the given name. In Fastmail, mailboxes serve as both folders and labels. To create a nested folder, provide the parent mailbox's ID via parent_id. Top-level mailboxes have no parentId. An email can belong to multiple mailboxes (labels). |
| mail_rename_mailboxC | Rename a mailbox (folder or label) by its ID. |
| mail_delete_mailboxA | Delete a mailbox (folder or label) by its ID. System mailboxes (inbox, trash, sent, drafts, archive, spam) cannot be deleted. Deleting a folder does not automatically delete its child mailboxes — remove nested folders first. If the mailbox contains emails, set on_destroy_remove_emails=True to delete them along with the mailbox. Args: mailbox_id: ID of the mailbox to delete. on_destroy_remove_emails: If True, also delete all emails in the mailbox. Default False — the server will reject deletion if emails exist. |
| mail_search_emailsA | Search emails with optional filters. Returns id, subject, from, date. Args: text: Full-text search query. from_: Filter by sender address. to: Filter by recipient address. subject: Filter by subject text. has_attachment: Filter by attachment presence. in_mailbox: Mailbox ID to restrict search to. Use mail_list_mailboxes to get the ID. limit: Max results (default 20). newest_first: Sort newest first (default True). |
| mail_get_recent_emailsA | Get emails received in the last N days. Args: days: How many days back to look (default 7). limit: Max results (default 20). |
| mail_get_emailA | Get a single email by ID with full body content and attachment metadata. Optionally fetch specific headers by name. JMAP requires headers to be requested by name — no wildcard fetch is supported. Use mail_export_email to retrieve all raw headers. Common useful headers:
Args: email_id: The JMAP email ID. prefer_html: Return HTML body if available; defaults to plain text. headers: Optional list of header names to fetch (e.g. ["X-Delivered-To"]). |
| mail_get_email_threadA | Return all emails in the same thread as the given email, in chronological order. Args: email_id: ID of any email in the thread. |
| mail_move_emailB | Move one or more emails to a mailbox identified by name. Args: email_ids: List of JMAP email IDs to move. mailbox_name: Name of the destination mailbox (case-insensitive). |
| mail_archive_emailA | Move one or more emails to the Archive mailbox. Args: email_ids: List of JMAP email IDs to archive. |
| mail_mark_email_readB | Set or unset the $seen flag on one or more emails. Args: email_ids: List of JMAP email IDs to update. read: True to mark as read, False to mark as unread (default True). |
| mail_pin_emailA | Pin or unpin one or more emails (sets the $flagged keyword). Pinned emails appear with a flag/star/pin icon in the mail client. Args: email_ids: List of JMAP email IDs to pin or unpin. pin: True to pin, False to unpin (default True). |
| mail_delete_emailB | Delete one or more emails by moving to Trash, or permanently destroy them. Args: email_ids: List of JMAP email IDs to delete. permanent: If True, permanently destroy emails. Default moves to Trash. |
| mail_set_identityA | Create, update, or destroy a sender identity. To create: provide create_email (required) and optionally create_name. To update: provide update_id plus any fields to change (name, replyTo, bcc, textSignature, htmlSignature). To destroy: provide destroy_id. Fails if mayDelete is false on that identity. replyTo and bcc are lists of EmailAddress objects: [{"email": "...", "name": "..."}]. Requires urn:ietf:params:jmap:submission capability. |
| mail_list_identitiesA | List all sender identities available on this Fastmail account. Returns each identity's id, name, and email address. |
| mail_send_emailA | Send an email via Fastmail. Args: to: List of recipient email addresses. subject: Email subject line. text_body: Plain-text body content. cc: Optional list of CC addresses. bcc: Optional list of BCC addresses. html_body: Optional HTML body content. Passed verbatim to the JMAP API with no sanitisation. When this tool is driven by an AI agent that processes external content, ensure the html_body value originates from a trusted source to prevent prompt- injection attacks from causing malicious emails to be sent. identity_id: Sender identity ID; auto-selects first identity if omitted. |
| mail_reply_to_emailA | Reply to an email, preserving threading headers and quoting the original. Args: email_id: ID of the email to reply to. text_body: Your reply text (original message is quoted below). reply_all: If True, CC all original recipients. identity_id: Sender identity ID; auto-selects first if omitted. |
| mail_forward_emailB | Forward an email to one or more recipients, preserving the original content. Args: email_id: ID of the email to forward. to: List of recipient email addresses. text_body: Optional introductory text prepended before the quoted original. identity_id: Sender identity ID; auto-selects first if omitted. |
| mail_manage_email_labelsA | Add or remove keywords/labels on one or more emails. Use this to pin/flag, mark read/unread, or apply custom labels. Common keywords: $flagged (pin/star), $seen (read), $draft, $answered, $forwarded. At least one of add or remove must be provided. Args: email_ids: List of JMAP email IDs to update. add: Keywords to add (e.g. ["$flagged"] to pin, ["$seen"] to mark read). remove: Keywords to remove (e.g. ["$flagged"] to unpin, ["$seen"] to mark unread). |
| mail_list_masked_emailsA | List masked email addresses, optionally filtered by domain or state. Args: domain: Filter by forDomain (partial match). state: Filter by state: 'enabled', 'disabled', 'deleted', 'pending'. 'pending' addresses auto-enable on first received message and auto-delete after 24 hours if no message is received. |
| mail_create_masked_emailA | Create a new masked email address. Args: for_domain: Origin of the site this address is for, e.g. 'https://example.com'. Should be origin only — no path component. description: Short user-supplied description of what this address is for. email_prefix: Optional prefix for the generated address (a-z, 0-9, _ only). url: Optional deep link back to the integrator (e.g. sign-up page URL). 'createdBy' is set server-side from auth credentials; do not try to set it. |
| mail_update_masked_emailA | Update a masked email address. Args: masked_email_id: The ID of the masked email to update. state: New state: 'enabled', 'disabled', or 'deleted'. 'deleted' soft-deletes the address (mail will bounce). for_domain: Update the origin domain, e.g. 'https://example.com' (no path). description: Update the description. url: Update the deep link URL. |
| mail_download_attachmentA | Download an attachment blob by blobId. Args: blob_id: The blobId of the attachment (from email attachments list). name: The filename to use for the download. content_type: MIME type of the attachment (default: application/octet-stream). |
| mail_upload_attachmentA | Upload a blob for use in email composition. Args: data: Base64-encoded file content. content_type: MIME type of the file. name: Filename (informational only; not stored with the blob). |
| mail_search_snippetsB | Get highlighted subject/preview snippets for a list of emails matching a filter. Returns subject (with tags around matches) and a preview snippet per email. Use the same filter params as mail_search_emails to get relevant highlights. Args: email_ids: List of email IDs to fetch snippets for. text: Full-text search query (used for highlighting). from_: Filter by sender address. to: Filter by recipient address. subject: Filter by subject text. has_attachment: Filter by attachment presence. |
| mail_export_emailA | Download the raw RFC 5322 .eml source of an email. Returns the full raw message including all headers and MIME parts. Use this when you need all headers — mail_get_email only fetches headers by name. Args: email_id: The JMAP email ID. blob_id: Optional blobId; fetched automatically if not provided. |
| mail_import_emailA | Import a raw RFC 5322 message blob into the mail store. The blob must already be uploaded (use mail_upload_attachment to get a blobId). The .eml content must be a valid RFC 5322 message with at minimum Date and Message-Id headers — a bare body without proper headers will be rejected. Args: blob_id: blobId of the uploaded .eml blob. mailbox_ids: List of mailbox IDs to place the email in. keywords: Optional JMAP keywords (e.g. ["$seen", "$flagged"]). received_at: Optional UTC timestamp (ISO 8601) for receivedAt. |
| mail_parse_emailA | Parse one or more blobs as RFC 5322 messages without importing them. Useful for viewing .eml attachments or forwarded messages stored as blobs. Metadata fields (mailboxIds, keywords, receivedAt) will be null since the message is not in the mail store. Args: blob_ids: List of blobIds to parse (e.g. from mail_download_attachment). |
| contacts_list_address_booksA | List all address books with id, name, description, sortOrder, isDefault, and isSubscribed. |
| contacts_query_contactsB | Query contacts with optional filters and sorting. Args: address_book_id: Filter to contacts in this address book. text: Full-text search across name, email, phone, etc. kind: Filter by kind (e.g. "individual", "org", "group"). limit: Maximum number of results to return. sort_by: Sort field — one of "name/given", "name/surname", "created", "updated". |
| contacts_listA | List contacts, optionally filtered by address book or text search. Uses a single round trip (ContactCard/query + ContactCard/get). Args: address_book_id: Restrict to contacts in this address book. text: Full-text search across name, email, phone, etc. limit: Maximum number of contacts to return. |
| contacts_get_contactA | Fetch full contact card(s) by ID. Returns id, addressBookIds, name, emails, phones, addresses, organizations, and notes. Args: ids: One or more ContactCard IDs to fetch. |
| contacts_update_contactB | Update an existing contact card via JSON patch. Only the fields you provide will be changed; omitted fields are left as-is. Args: contact_id: ID of the ContactCard to update. name: New full display name. emails: Replace all email addresses with this list. phones: Replace all phone numbers with this list. org: Replace organization name. notes: Replace notes. address_book_ids: Replace address book membership. |
| contacts_delete_contactB | Delete one or more contacts by ID. Args: contact_ids: List of ContactCard IDs to delete. |
| contacts_create_contactC | Create a new contact card. Args: name: Full display name of the contact. emails: List of email addresses. phones: List of phone numbers. org: Organization / company name. notes: Free-text notes. address_book_ids: Address book IDs to add the contact to. |
| calendar_list_calendarsA | List all CalDAV calendars for the authenticated Fastmail account. |
| calendar_list_eventsA | List events in a CalDAV calendar within a date range. Args: calendar_href: The href of the calendar (from calendar_list_calendars). start_date: ISO date string (YYYY-MM-DD). Defaults to today. end_date: ISO date string (YYYY-MM-DD). Defaults to 7 days from start. |
| calendar_get_eventA | Get full details of a single CalDAV event by its href. Args: href: The href/URL path of the .ics resource (as returned by calendar_list_events). |
| calendar_create_eventA | Create a new event in a CalDAV calendar. Args: calendar_href: The href of the calendar (from calendar_list_calendars). title: Event title/summary. start: Start datetime as ISO string (YYYY-MM-DDTHH:MM:SS or YYYY-MM-DD for all-day). end: End datetime as ISO string. location: Optional location string. description: Optional description. all_day: If True, treat start/end as dates (not datetimes). |
| calendar_update_eventA | Update fields on an existing CalDAV event. Args: href: The href of the .ics resource (from calendar_list_events). title: New summary/title (omit to keep existing). start: New start datetime ISO string (omit to keep existing). end: New end datetime ISO string (omit to keep existing). location: New location (omit to keep existing). description: New description (omit to keep existing). |
| calendar_delete_eventA | Delete a CalDAV event by its href. Args: href: The href of the .ics resource (from calendar_list_events). |
| files_listA | List files and folders at a WebDAV path on Fastmail Files. Args: path: Path to list (default: root "/"). depth: "0" for the item itself only, "1" for immediate children (default). |
| files_getA | Download a file from Fastmail Files (WebDAV), returned as base64. Args: path: Path to the file (e.g. "/Documents/report.pdf"). |
| files_uploadA | Upload a file to Fastmail Files (WebDAV). Args: path: Destination path (e.g. "/Documents/report.pdf"). content: Base64-encoded file content. content_type: MIME type of the file (default: application/octet-stream). |
| files_create_folderB | Create a folder on Fastmail Files (WebDAV). Args: path: Path of the new folder (e.g. "/Documents/NewFolder"). |
| files_deleteB | Delete a file or folder on Fastmail Files (WebDAV). Args: path: Path to delete (e.g. "/Documents/old.txt"). |
| files_moveA | Move or rename a file or folder on Fastmail Files (WebDAV). Args: source: Source path (e.g. "/Documents/old.txt"). destination: Destination path (e.g. "/Archive/old.txt"). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/pjosols/pyfastmail-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server