stalwart-mail-mcp

v2.3.0
io.github.cybersmurf/stalwart-mail-mcp Checked 3 days ago Published 2 months ago

Mail 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.

ParameterTypeDescription
accountstringWhich 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.

ParameterTypeDescription
accountstringWhich 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…
afterstringOnly messages received from this date on (YYYY-MM-DD or ISO 8601).
beforestringOnly messages received up to this date (YYYY-MM-DD or ISO 8601).
fromstringSender (part of the name or address).
has_attachmentbooleantrue = only messages with an attachment.
limitintegerHow many messages to return (1–100).
mailboxstringFolder: inbox, sent, drafts, trash, junk, archive, or a folder name.
offsetintegerHow many messages to skip (paging).
subjectstringPart of the subject.
textstringFull text across subject, body and headers.
thread_idstringList every message of this thread (threadId from an earlier result); other filters are then ignored.
tostringRecipient (part of the name or address).
unreadbooleantrue = 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).

ParameterTypeDescription
id *stringMessage id.
accountstringWhich 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…
htmlbooleantrue = 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…

ParameterTypeDescription
id *stringMessage id (from mail_search_emails / mail_get_email).
accountstringWhich 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…
attachmentstringAttachment name (a part is enough, e.g. “invoice”) or its number starting at 1.
ocrbooleanfalse = do not send scans and photos to the OCR provider, return the image only.
page_fromintegerPDF: first page to return (default 1).
page_tointegerPDF: last page to return (default: the last one).
previewbooleanPDF: also attach an image of page 1 (chart, stamp, signature, checking the OCR).
save_dirstringFolder 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.

ParameterTypeDescription
accountstringWhich 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…
attachmentsarrayFull paths of files on this computer to attach (max. 25 MB each).
bccarrayBcc — a list of addresses as “name@domain” or “First Last <name@domain>”.
ccarrayCc — a list of addresses as “name@domain” or “First Last <name@domain>”.
fromstringSender address; default is the address of the signed-in mailbox. Must be one of the account's allowed senders.
htmlstringBody as HTML (optional; when text is missing it is derived from the HTML).
in_reply_to_idstringid 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_allbooleanFor a reply: also copy the other original recipients.
reply_toarrayReply-To (where replies should go) — a list of addresses as “name@domain” or “First Last <name@domain>”.
subjectstringSubject. A reply gets “Re: …” automatically when it is missing.
textstringMessage body as plain text (preferred). Write the signature yourself, the server adds none.
toarrayRecipients — 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).

ParameterTypeDescription
accountstringWhich 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…
attachmentsarrayFull paths of files on this computer to attach (max. 25 MB each).
bccarrayBcc — a list of addresses as “name@domain” or “First Last <name@domain>”.
ccarrayCc — a list of addresses as “name@domain” or “First Last <name@domain>”.
fromstringSender address; default is the address of the signed-in mailbox. Must be one of the account's allowed senders.
htmlstringBody as HTML (optional; when text is missing it is derived from the HTML).
in_reply_to_idstringid 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_allbooleanFor a reply: also copy the other original recipients.
reply_toarrayReply-To (where replies should go) — a list of addresses as “name@domain” or “First Last <name@domain>”.
subjectstringSubject. A reply gets “Re: …” automatically when it is missing.
textstringMessage body as plain text (preferred). Write the signature yourself, the server adds none.
toarrayRecipients — 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.

ParameterTypeDescription
id *stringDraft id.
accountstringWhich 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…
fromstringSending 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.

ParameterTypeDescription
id *stringDraft id.
accountstringWhich 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.

ParameterTypeDescription
accountstringLimit to the address books of one account; default = all.
include_historybooleanAlso search senders/recipients of mail (only with a query).
limitintegerMax. contacts from the address book per account.
querystringName, 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.

ParameterTypeDescription
accountstringWhich 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_bookstringAddress book name (default = the account's default address book).
emailsarrayE-mail addresses.
full_namestringFull name, when splitting it makes no sense (e.g. a company as a contact).
givenstringFirst name.
nicknamestringNickname.
notestringNote.
organizationstringCompany / organization.
phonesarrayPhone numbers (international format, e.g. +1 202 555 0123).
surnamestringSurname.
titlestringJob title.