Skip to content
FunCoding

Langmail MCP for your own Stalwart: email, calendar and contacts

Listed in the official MCP Registry

Self-hosted MCP server for Stalwart: email, calendar and contacts over JMAP, CalDAV and CardDAV.

Star
11
Version
v0.1.0
License
MIT
Last commit
Dec 1, 2026

langmail-mcp

An MCP server that gives an AI agent the mail, calendar and contacts of one mailbox on your own Stalwart server. It talks to Stalwart over JMAP, CalDAV and CardDAV, with a username and an app password, and needs no other service.

This is the server Langmail runs at mcp.langmail.me, from the same code. The hosted server adds a few features that need Langmail's own services, listed under Hosted and self-hosted.

Let your agent decide if this is for you

I found this project on GitHub: https://github.com/langmail/langmail-mcp
Is this something useful for my setup regarding MCP access to emails, calendars, and contacts?
How does it compare to what we're currently using.

What your agent can do with it

  • Mail: search, read whole conversations, file, mark, archive and trash messages, download attachments, preview a message as a rendered page and unsubscribe from mailing lists.
  • Writing: stage drafts with attachments, then send them, reply or forward. A staged draft waits in the Drafts folder, so you can also review and send it from your mail app.
  • Calendar: list calendars and events, create, update, move and delete events, and answer invitations.
  • Contacts: search the address books, create, update, merge and delete contacts, and list upcoming birthdays.
  • Mail rules: list, preview, create, update and delete the Sieve rules that file incoming mail.

The tool reference describes every tool. It is written for the hosted server, and the differences are in docs/self-hosted.md.

Start it

You need Node 22.12 or later (not 23) or Bun, a Stalwart account and an app password for it.

On the same computer as the agent, the MCP client starts the server and talks to it over stdio:

STALWART_URL=https://mail.example.com STALWART_USERNAME=alice \
  STALWART_PASSWORD=<app password> npx langmail-mcp

Over the network, the server listens for Streamable HTTP and every request must carry the secret you set:

STALWART_URL=https://mail.example.com STALWART_USERNAME=alice \
  STALWART_PASSWORD=<app password> MCP_AUTH_TOKEN=<long random secret> \
  npx langmail-mcp --transport http --host 0.0.0.0 --port 8080

Under Bun, use bunx --bun langmail-mcp. langmail-mcp --help lists every setting with its variable.

Connect an MCP client

Claude Code, over stdio:

claude mcp add langmail \
  --env STALWART_URL=https://mail.example.com \
  --env STALWART_USERNAME=alice \
  --env STALWART_PASSWORD=<app password> \
  -- npx -y langmail-mcp

A client configured with JSON, such as Claude Desktop:

{
  "mcpServers": {
    "langmail": {
      "command": "npx",
      "args": ["-y", "langmail-mcp"],
      "env": {
        "STALWART_URL": "https://mail.example.com",
        "STALWART_USERNAME": "alice",
        "STALWART_PASSWORD": "<app password>"
      }
    }
  }
}

Settings

VariableFlagDefaultMeaning
STALWART_URL--stalwart-urlrequiredStalwart's base URL; JMAP, CalDAV and CardDAV are reached under it
STALWART_USERNAME--usernamerequiredThe account name to sign in with
STALWART_PASSWORDnonerequiredAn app password for that account
STALWART_EMAIL--emailthe login Stalwart reportsThe address to send mail as
MCP_ACCESS--accesseverythingWhat the agent may do: read-only, no-send or everything (access levels)
MCP_TRANSPORT--transportstdiostdio or http (Streamable HTTP)
MCP_HOST--host127.0.0.1Where the HTTP listener binds
MCP_PORT--port8080 for httpThe HTTP listener's port
MCP_PUBLIC_URL--public-urlhttp://<host>:<port>Base URL for the attachment and image links the server creates
MCP_AUTH_TOKENnonerequired for httpThe bearer every /mcp request must carry

The secrets have no flag, because a flag shows in the process list. What each setting does, the checks at startup and what the server sends where: docs/self-hosted.md.

Hosted and self-hosted

FeatureHosted at mcp.langmail.meSelf-hosted
Sign-inOAuth with a Langmail accountStalwart username and app password
Calendar sharing (share_calendar, stop_sharing_calendar)YesNo
Filter mail by classified typeYesNo; a todo flag instead
Address book collected from mail and invitationsYesNo; search_contacts also looks at recent mail headers

The details and reasons are in docs/self-hosted.md § What the mode leaves out.

Development

git clone https://github.com/langmail/langmail-mcp.git
cd langmail-mcp
bun install
bun test

CONTRIBUTING.md covers the checks, the integration tests against Radicale and a dev Stalwart, and how releases work. docs/evals.md covers the agent evals. Report bugs in GitHub issues and vulnerabilities as SECURITY.md describes.

License

MIT

Similar MCP servers

labelhead-artist-momentum

Trending hip-hop artist momentum scores across four cultural dimensions.

PApaperclipai/paperclip119k2,120 new stars in the last 7 days

Corsair

One MCP URL for Gmail, Slack, GitHub, Notion and 700+ more apps, with your rules on every change.

COcorsairdev/corsair16k

Inbox Zero

Search Gmail and Outlook, save drafts, manage email rules, and view email stats.

ELelie222/inbox-zero13k76 new stars in the last 7 days

kaneo

Official MCP server for Kaneo: manage tasks, projects, and labels from Claude and other MCP clients

USusekaneo/kaneo9.9k64 new stars in the last 7 days

Official

QR Rápido

Generate QR codes for URLs, PIX, Wi-Fi, vCards, WhatsApp and more. For AI agents.

MOmodelcontextprotocol/registry7.5k24 new stars in the last 7 days

whatsapp-mcp

WhatsApp MCP server

LHlharries/whatsapp-mcp7k33 new stars in the last 7 days