Back to Browse

Langmail MCP Server

Developer ToolsLow Risk10.0MCP RegistryLocal
Free

Server data from the Official MCP Registry

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

About

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

Security Report

10.0
Low Risk10.0Low Risk

Valid MCP server (3 strong, 3 medium validity signals). No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry. Trust signals: 3 highly-trusted packages.

6 files analyzed · 1 issue found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

env_vars

Check that this permission is expected for this type of plugin.

file_system

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Base URL of your Stalwart server (JMAP, CalDAV and CardDAV), e.g. https://mail.example.comOptional

Environment variable: STALWART_URL

Account login name, usually the mail address; use together with STALWART_PASSWORDOptional

Environment variable: STALWART_USERNAME

App password for STALWART_USERNAME, created in Stalwart's account managerRequired

Environment variable: STALWART_PASSWORD

Bearer token such as a Stalwart API key, as an alternative to STALWART_USERNAME and STALWART_PASSWORDRequired

Environment variable: STALWART_TOKEN

Transport: stdio (the default) or http, which serves Streamable HTTP at /mcpOptional

Environment variable: MCP_TRANSPORT

Required with MCP_TRANSPORT=http: the secret callers send as Authorization: Bearer; at least 16 charactersRequired

Environment variable: MCP_AUTH_TOKEN

HTTP transport: address to listen onOptional

Environment variable: MCP_HOST

HTTP transport: port to listen onOptional

Environment variable: MCP_PORT

HTTP transport: the address callers reach the server under, e.g. behind a TLS-terminating reverse proxyOptional

Environment variable: MCP_PUBLIC_URL

Log level for stderr: fatal, error, warn, info, debug, trace or silentOptional

Environment variable: LOG_LEVEL

Set to 1 to let unsubscribe_from_list send the RFC 8058 one-click request to the sender's URL; off by defaultOptional

Environment variable: LANGMAIL_MCP_ALLOW_UNSUBSCRIBE_POST

Set to 1 to let preview_email load a message's remote images through this server; off by defaultOptional

Environment variable: LANGMAIL_MCP_ALLOW_REMOTE_IMAGES

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "langmail-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "langmail-mcp@0.1.0"
      ],
      "env": {
        "MCP_HOST": "your-mcp-host-here",
        "MCP_PORT": "your-mcp-port-here",
        "LOG_LEVEL": "your-log-level-here",
        "STALWART_URL": "your-stalwart-url-here",
        "MCP_TRANSPORT": "your-mcp-transport-here",
        "MCP_AUTH_TOKEN": "your-mcp-auth-token-here",
        "MCP_PUBLIC_URL": "your-mcp-public-url-here",
        "STALWART_TOKEN": "your-stalwart-token-here",
        "STALWART_PASSWORD": "your-stalwart-password-here",
        "STALWART_USERNAME": "your-stalwart-username-here",
        "LANGMAIL_MCP_ALLOW_REMOTE_IMAGES": "your-langmail-mcp-allow-remote-images-here",
        "LANGMAIL_MCP_ALLOW_UNSUBSCRIBE_POST": "your-langmail-mcp-allow-unsubscribe-post-here"
      }
    }
  }
}

Some servers take additional arguments. See the repository for details.

Documentation

View on GitHub

From the project's GitHub README.

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

Reviews

No reviews yet

Be the first to review this server!