stalwart-mail-mcp
v2.3.0Mail and contacts on a self-hosted Stalwart server via JMAP: search, read, OCR, send, drafts.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
mail_list_mailboxes Folders, accounts and senders
Returns the available accounts (your mailbox plus shared ones), folders with message counts (unread) and the addresses you can send from. Call it first when you do not know which folders or accounts exist. Changes nothing.
| Parameter | Type | Description |
|---|---|---|
account | string | Which account: leave empty for the signed-in mailbox, or name a shared mailbox / group you have access to (the part before @ is enough; a full address works too). mail_list_mailboxes shows what exists… |
mail_search_emails Search messages
Searches mail (full text, sender, recipient, subject, folder, date, unread, attachments) or lists a whole thread. Returns message ids (for mail_get_email), thread, sender, date and a preview. Newest first, paging through limit/offset. Without a filter it returns the latest messages from all folders (trash included) — for “what is new” use mailbox="inbox", unread=true.
| Parameter | Type | Description |
|---|---|---|
account | string | Which account: leave empty for the signed-in mailbox, or name a shared mailbox / group you have access to (the part before @ is enough; a full address works too). mail_list_mailboxes shows what exists… |
after | string | Only messages received from this date on (YYYY-MM-DD or ISO 8601). |
before | string | Only messages received up to this date (YYYY-MM-DD or ISO 8601). |
from | string | Sender (part of the name or address). |
has_attachment | boolean | true = only messages with an attachment. |
limit | integer | How many messages to return (1–100). |
mailbox | string | Folder: inbox, sent, drafts, trash, junk, archive, or a folder name. |
offset | integer | How many messages to skip (paging). |
subject | string | Part of the subject. |
text | string | Full text across subject, body and headers. |
thread_id | string | List every message of this thread (threadId from an earlier result); other filters are then ignored. |
to | string | Recipient (part of the name or address). |
unread | boolean | true = unread only. |
mail_get_email Read a message
Returns a whole message by id (from mail_search_emails): headers, body text (HTML is converted to text) and the list of attachments. mail_get_attachment reads an attachment's content (PDF, image, text). To reply use mail_send_email with in_reply_to_id. Changes nothing (does not mark the message as read).
| Parameter | Type | Description |
|---|---|---|
id * | string | Message id. |
account | string | Which account: leave empty for the signed-in mailbox, or name a shared mailbox / group you have access to (the part before @ is enough; a full address works too). mail_list_mailboxes shows what exists… |
html | boolean | true = return the original HTML instead of converted text. |
mail_get_attachment Open an attachment
Downloads an attachment of a received message, saves it to disk and returns its content: text for text files, the text of every page for PDFs, the picture for images. Scans (PDF pages without a text layer) and photos of documents are read through OCR, tables included; pages that came from OCR are marked “(OCR)” — treat numbers from them with some caution and ask for a preview when a figure matters. Other types (docx, xlsx, zip…) only return the path of the saved file. Pick the attachment by name or by its number from the list in mail_get_email; a message with a single attachment needs…
| Parameter | Type | Description |
|---|---|---|
id * | string | Message id (from mail_search_emails / mail_get_email). |
account | string | Which account: leave empty for the signed-in mailbox, or name a shared mailbox / group you have access to (the part before @ is enough; a full address works too). mail_list_mailboxes shows what exists… |
attachment | string | Attachment name (a part is enough, e.g. “invoice”) or its number starting at 1. |
ocr | boolean | false = do not send scans and photos to the OCR provider, return the image only. |
page_from | integer | PDF: first page to return (default 1). |
page_to | integer | PDF: last page to return (default: the last one). |
preview | boolean | PDF: also attach an image of page 1 (chart, stamp, signature, checking the OCR). |
save_dir | string | Folder to save the file to; default /home/runner/Downloads/Mail-Attachments. |
mail_send_email Send an e-mail
Sends an e-mail from the mailbox — a new one, or a reply (in_reply_to_id). A copy is stored in Sent. It sends IMMEDIATELY and cannot be undone. Send only when the user explicitly said the message should go out; otherwise create a draft (mail_create_draft). Verify the recipient before sending — never guess an unknown address, look it up with mail_search_contacts.
| Parameter | Type | Description |
|---|---|---|
account | string | Which account: leave empty for the signed-in mailbox, or name a shared mailbox / group you have access to (the part before @ is enough; a full address works too). mail_list_mailboxes shows what exists… |
attachments | array | Full paths of files on this computer to attach (max. 25 MB each). |
bcc | array | Bcc — a list of addresses as “name@domain” or “First Last <name@domain>”. |
cc | array | Cc — a list of addresses as “name@domain” or “First Last <name@domain>”. |
from | string | Sender address; default is the address of the signed-in mailbox. Must be one of the account's allowed senders. |
html | string | Body as HTML (optional; when text is missing it is derived from the HTML). |
in_reply_to_id | string | id of the message you are replying to — sets the thread (In-Reply-To/References), fills in the recipient and subject, marks the original as answered. |
reply_all | boolean | For a reply: also copy the other original recipients. |
reply_to | array | Reply-To (where replies should go) — a list of addresses as “name@domain” or “First Last <name@domain>”. |
subject | string | Subject. A reply gets “Re: …” automatically when it is missing. |
text | string | Message body as plain text (preferred). Write the signature yourself, the server adds none. |
to | array | Recipients — a list of addresses as “name@domain” or “First Last <name@domain>”. |
mail_create_draft Create a draft
Saves a message as a draft in the Drafts folder (does not send). The user can then review it in webmail or on the phone and send it themselves, or mail_send_draft sends it by id. Same parameters as mail_send_email (including replying via in_reply_to_id and attachments).
| Parameter | Type | Description |
|---|---|---|
account | string | Which account: leave empty for the signed-in mailbox, or name a shared mailbox / group you have access to (the part before @ is enough; a full address works too). mail_list_mailboxes shows what exists… |
attachments | array | Full paths of files on this computer to attach (max. 25 MB each). |
bcc | array | Bcc — a list of addresses as “name@domain” or “First Last <name@domain>”. |
cc | array | Cc — a list of addresses as “name@domain” or “First Last <name@domain>”. |
from | string | Sender address; default is the address of the signed-in mailbox. Must be one of the account's allowed senders. |
html | string | Body as HTML (optional; when text is missing it is derived from the HTML). |
in_reply_to_id | string | id of the message you are replying to — sets the thread (In-Reply-To/References), fills in the recipient and subject, marks the original as answered. |
reply_all | boolean | For a reply: also copy the other original recipients. |
reply_to | array | Reply-To (where replies should go) — a list of addresses as “name@domain” or “First Last <name@domain>”. |
subject | string | Subject. A reply gets “Re: …” automatically when it is missing. |
text | string | Message body as plain text (preferred). Write the signature yourself, the server adds none. |
to | array | Recipients — a list of addresses as “name@domain” or “First Last <name@domain>”. |
mail_send_draft Send a draft
Sends an existing draft by id (from mail_create_draft or from a search in the drafts folder). Sends immediately — only on the user's explicit instruction.
| Parameter | Type | Description |
|---|---|---|
id * | string | Draft id. |
account | string | Which account: leave empty for the signed-in mailbox, or name a shared mailbox / group you have access to (the part before @ is enough; a full address works too). mail_list_mailboxes shows what exists… |
from | string | Sending address, when it differs from the draft's From header. |
mail_delete_draft Delete a draft
Permanently deletes a draft by id. Works only on messages flagged as drafts — it never deletes sent or received mail.
| Parameter | Type | Description |
|---|---|---|
id * | string | Draft id. |
account | string | Which account: leave empty for the signed-in mailbox, or name a shared mailbox / group you have access to (the part before @ is enough; a full address works too). mail_list_mailboxes shows what exists… |
mail_search_contacts Find a contact / address
Finds an e-mail address or phone number: searches the address books (your own and shared ones) and also the mail history (who wrote to you and whom you wrote to, matching the query). Use it whenever you need a person's or company's address before sending anything. Without a query it lists the whole address book.
| Parameter | Type | Description |
|---|---|---|
account | string | Limit to the address books of one account; default = all. |
include_history | boolean | Also search senders/recipients of mail (only with a query). |
limit | integer | Max. contacts from the address book per account. |
query | string | Name, part of an address, company… |
mail_add_contact Add a contact
Creates a contact in an address book. Default is the signed-in mailbox's own address book; pass the account of a shared mailbox to store it in the shared one (everyone with access sees it, on phones too through CardDAV). Check mail_search_contacts first so you do not create a duplicate.
| Parameter | Type | Description |
|---|---|---|
account | string | Which account: leave empty for the signed-in mailbox, or name a shared mailbox / group you have access to (the part before @ is enough; a full address works too). mail_list_mailboxes shows what exists… |
address_book | string | Address book name (default = the account's default address book). |
emails | array | E-mail addresses. |
full_name | string | Full name, when splitting it makes no sense (e.g. a company as a contact). |
given | string | First name. |
nickname | string | Nickname. |
note | string | Note. |
organization | string | Company / organization. |
phones | array | Phone numbers (international format, e.g. +1 202 555 0123). |
surname | string | Surname. |
title | string | Job title. |