Skip to main content
Glama
plmail-mcp

plmail-mcp

by jo2904

plmail-mcp

An MCP server that gives an agent (Hermes, Claude, any MCP client) the mail, calendar and contacts of a plMail server — every mailbox plMail syncs (IMAP, Gmail, Outlook) through one URL and one app password. No per-mailbox IMAP/SMTP settings: plMail already holds those, this talks to its JMAP API.

Setup

  1. In plMail: Settings → App passwords → create (e.g. "Hermes"). The secret starts with plmail_ and is shown once.

  2. Write ~/.config/plmail-mcp/config.toml, mode 600 (see contrib/config.example.toml):

    url = "https://mail.example.org"
    token = "plmail_…"

    Environment variables override the file: PLMAIL_URL, PLMAIL_TOKEN or PLMAIL_TOKEN_FILE, PLMAIL_VERIFY_TLS, and PLMAIL_MCP_CONFIG for another file path. A config file or token file readable by anyone but its owner is refused.

  3. Check what the agent will see:

    uv run plmail-mcp check

Revoking the app password in plMail cuts the agent off everywhere at once.

Switching tools off

Every tool is on by default. To take one away from the agent, set it to false in a [tools] table; it then disappears from the tool list the agent sees:

[tools]
send_email = false
send_draft = false
jmap = false

A name that matches no tool is refused at start-up, so sned_email = false cannot leave sending on by mistake. Switch jmap off whenever another tool is off: the raw JMAP tool can do anything the others do, and the server warns when it is left on. These switches are enforced by this server, not by plMail: the app password itself can still do everything, so keep it where the agent cannot read it (see Running).

Related MCP server: AT&T Mail MCP Server

Running

uv run plmail-mcp serve                                   # stdio
uv run plmail-mcp serve --transport streamable-http \
    --host 127.0.0.1 --port 9558                          # http://127.0.0.1:9558/mcp

For an agent that runs sandboxed (Hermes' gateway), run the HTTP server outside the sandbox as a user service, so the app password never enters it: contrib/plmail-mcp.service. Then, in ~/.hermes/config.yaml:

mcp_servers:
  plmail:
    url: http://127.0.0.1:9558/mcp

For a client that spawns servers itself (stdio):

mcp_servers:
  plmail:
    command: uv
    args: ["run", "--directory", "/path/to/plmail-mcp", "plmail-mcp", "serve"]

Tools

Accounts

list_accounts, list_mailboxes, list_identities

Reading

search_emails (all accounts at once unless one is named), read_email, read_thread

Organising

update_emails (read/unread, star, add/remove folder or label), move_thread, snooze_thread, trash_emails

Writing

create_draft (replies fill in recipients, subject, threading, sending address), send_draft, send_email, cancel_send (for sends held with delay_seconds)

Contacts

find_contacts, suggest_recipients, save_contact, delete_contact

Calendar

list_calendars, list_events (recurrences expanded), save_event, delete_event

Templates

list_templates, render_template

Anything else

jmap: a raw JMAP request, for every other plMail method

Accounts are named by id or address ("3", "me@gmail.com", or a unique part of it). Every result carries the account it came from.

The agent can send mail unless send_email and send_draft are switched off. With them on, the tool descriptions tell it to send only when asked, and create_draft + send_draft leave a step for review.

Behaviour worth knowing

  • Trash is a move: plMail never hard-deletes.

  • Waking a snoozed conversation puts it back in the inbox unread (plMail's own snooze semantics).

  • plMail's Session advertises urn:plmail:params:jmap:push, which its API then refuses in using. The client drops any capability the API refuses and retries.

  • Calendars and contacts belong to the plMail user, served from the session's primary account; mail is per account.

Testing

tests/smoke.py starts the server over stdio and calls every tool against a throwaway plMail (it creates and deletes drafts, contacts and events):

PLMAIL_URL=http://127.0.0.1:8001 PLMAIL_TOKEN_FILE=/path/to/token uv run python tests/smoke.py

A local plMail test stack: compose.test.yaml in the plMail repo, then bin/console app:test:seed-user --email=demo@plmail.test --password=…, app:test:seed-demo --email=demo@plmail.test and app:test:seed-api-token --email=demo@plmail.test -q for the token.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Unified email access via IMAP/SMTP, enabling reading, searching, sending, and deleting messages across multiple accounts through a single MCP server.
      9
      AGPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP clients to read and organize mail, manage drafts, and perform broader mailbox operations under configurable read-only, draft-only, or full-access modes.
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables MCP clients to access and manage email over IMAP, POP3, and SMTP, including listing, searching, reading, sending, downloading attachments, and managing flags, moves, and deletions using environment-based credentials and TLS.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables MCP clients to manage multiple email accounts, including searching, reading, organizing, drafting, and sending messages over IMAP/SMTP with encrypted credentials.
      MIT