JMD-native MCP server for email — IMAP/SMTP access for LLM agents
Server has 5 tools with explicit registration and detailed descriptions. Tool naming is clear (read, write, delete, send, accounts) and action-oriented. However, input schemas are minimal, only 'account' and 'document' string parameters with basic descriptions. The 'read' tool has an exceptionally long description (2000+ chars) that documents JMD syntax, credential handling, and OAuth2 flow, but this is domain-specific documentation rather than LLM-optimized parameter guidance. Output schemas are not documented. Error handling is mentioned in descriptions (credential_missing, oauth_token_required) but recovery guidance is embedded in prose rather than structured. Parameters lack type constraints (enums, ranges). The 'document' parameter is opaque, LLMs cannot infer valid JMD syntax from the description alone.
Read-only accounts tool — a sanitized projection of the config. Accounts live in the out-of-reach config.jmd (see mail_mcp._config), authored by the user out-of-band. This tool does not create or edit accounts; it only exposes a PII-free projection so the agent knows which labels exist (and how each authenticates), plus this server's public key for the OAuth2 sealing flow.
Delete IMAP messages using a JMD document.
Read IMAP resources using a JMD document (https://github.com/ostermeyer/jmd-spec). Args: account: Account label configured out-of-band in config.jmd. The server resolves the IMAP endpoint and username from it; you never pass or see them. List labels via `accounts`. document: JMD read/query/schema document. Supported labels: Folder, Folder[], Message. Document forms — body-form only. Fields go on lines *after* the heading; the JMD parser does NOT read inline parens or brackets in the heading itself (silent empty parse). #! Folder | #! Message | #! EmailAddress (schema) # Folder[] (list roots) # Folder (one folder) path: INBOX # Message (one message) id: 42 folder: INBOX #? Folder (filter) parent: INBOX #? Message (filter) folder: INBOX from: ~alice subject: ~invoice seen: false Pagination frontmatter (before the #? heading): page, page-size. Results are newest-first. `count` switches to COUNT-ONLY mode — the response is just `total: N` with an empty list (no message items); omit `count` to receive the items. Frontmatter policy: observable tolerance — unknown keys are echoed in the response as 'ignored-keys: ...'. Debug frontmatter: 'debug: timing' (composable). Credentials — first-time setup or 'credential_missing' error: Passwords come from the user's OS keystore, looked up by (service, username). When a keystore item is missing, the tool returns a '# Error' document with code 'credential_missing' that already contains the exact platform-appropriate seed command (security / secret-tool / cmdkey) in its message. DO NOT run the seed command yourself — the entire security model of this server depends on the password never crossing any tool call. Instead, present the seed command to the user as a copy-paste shell block (just like: ```sh security add-generic-password \ -s imap.gmail.com:993 -a [email protected] -w ``` ) and tell them to paste it into their own terminal. The keystore CLI then prompts for the password tty-interactively in their shell — never in the LLM context. A mail account typically needs *two* seed items: one for the IMAP endpoint (read/write/delete) and one for the SMTP endpoint (send). When helping a new user onboard, offer both copy-paste blocks proactively. Mainstream providers' canonical endpoints are well-known: gmail.com → imap.gmail.com:993 + smtp.gmail.com:587 (App Password required), outlook/Office 365 → outlook.office365.com:993 + smtp.office365.com:587, ionos.de → imap.ionos.de:993 + smtp.ionos.de:587, fastmail.com → imap.fastmail.com:993 + smtp.fastmail.com:587, gmx.{net,de} → imap.gmx.net:993 + mail.gmx.net:587, web.de → imap.web.de:993 + smtp.web.de:587. OAuth2 accounts (Microsoft, Gmail, …) — no password, a sealed token instead: Providers that disabled Basic Auth are marked ``auth: oauth2`` in the registry and name a ``broker-client`` (a jmd-mcp-oauth2 client). For these, do NOT seed a keystore password; hand this server a short-lived *sealed* access token per call: 1. Get this server's public key — call ``accounts`` with ``# PublicKey`` (returns ``key: <base64>``). 2. Ask the token broker (jmd-mcp-oauth2) to seal a token to that key — its ``read`` with:: # OAuthToken name: <broker-client> recipient-pubkey: <key from step 1> One-time first: authorize the broker via its ``write`` ``# OAuthSession { name: <broker-client> }`` (a device-code or browser login). 3. Pass the returned ``ciphertext`` to THIS call as a frontmatter key:: access-token-sealed: <ciphertext> # Folder[] It is opened here with our private key and used via XOAUTH2; the plaintext token never crosses a tool call. Calling an oauth2 account without a sealed token returns ``oauth_token_required``, naming the broker-client and steps.
Input schemas are minimal and underdocumented. All tools accept only 'account' (string) and 'document' (string) parameters. No enums, ranges, patterns, or format constraints. The 'document' parameter is opaque, LLMs cannot infer valid JMD syntax from a one-line description. This violates the constrained-input pattern and forces LLMs to guess at valid document structure.
Output schemas are not documented. Callers cannot predict the structure of responses (e.g., does 'read' return a JMD document string, a parsed object, or a list?). This forces LLMs to reason about output structure without guidance, increasing parsing errors and wasted tokens.
Descriptions for write, delete, and send are extremely brief (30 chars each: 'Modify IMAP...', 'Delete IMAP...', 'Send an email...'). They lack context on when to use each tool, what side effects occur, and how to structure the 'document' parameter. Baseline for A+ tools is 50-200 chars with actionable guidance.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 47 | 2026-07-28+ | v2 |
Send an email message via SMTP using a JMD document.
Modify IMAP message flags and folder membership using a JMD document.
Error handling is documented in prose within the 'read' description but not structured as tool-level error codes or recovery guidance. The server returns JMD '# Error' documents with codes like 'credential_missing' and 'oauth_token_required', but LLMs cannot parse these from the tool description alone. Error classification and recovery guidance should be explicit in the tool definition.
The 'read' tool description is 2000+ chars, far exceeding the 1024-char baseline for A+ tools. While comprehensive, it buries key parameter guidance in domain-specific JMD syntax documentation. This wastes tokens and makes it harder for LLMs to extract actionable constraints.