S

Stalwart Mail MCP

by cybersmurf · io.github.cybersmurf/stalwart-mail-mcp

Enables MCP clients to search, read, and manage a self-hosted mailbox over JMAP, including attachments with OCR, sending, drafts, and contacts.

npm Local · stdio GlamaOfficial MCP Registry High confidence

Install

Add to ~/Library/Application Support/Claude/claude_desktop_config.json

Windows / Linux path
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "io-github-cybersmurf-stalwart-mail-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "stalwart-mail-mcp"
      ],
      "env": {
        "STALWART_URL": "<VALUE>",
        "STALWART_USER": "<VALUE>",
        "STALWART_PASSWORD": "<YOUR_VALUE>",
        "MAIL_LANG": "auto",
        "MAIL_OCR_PROVIDER": "auto",
        "MAIL_OCR_API_KEY": "<YOUR_VALUE>",
        "MAIL_OCR_MODEL": "<VALUE>",
        "MAIL_OCR_BASE_URL": "<VALUE>",
        "MAIL_BRAND": "Stalwart Mail",
        "MAIL_TIMEZONE": "<VALUE>",
        "STALWART_TOKEN": "<VALUE>",
        "MAIL_ALLOW_SEND": "<VALUE>",
        "MISTRAL_API_KEY": "<VALUE>",
        "MAIL_TOOL_PREFIX": "mail",
        "MAIL_ALLOW_DRAFTS": "<VALUE>",
        "MAIL_DOWNLOAD_DIR": "<VALUE>",
        "MAIL_SAVE_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_CONTACT_EDIT": "<VALUE>"
      }
    }
  }
}

Restart Claude Desktop to activate the new server.

Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)

Windows / Linux path
Windows: .cursor\mcp.json (project) or %USERPROFILE%\.cursor\mcp.json (global)
Linux: .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
{
  "mcpServers": {
    "io-github-cybersmurf-stalwart-mail-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "stalwart-mail-mcp"
      ],
      "env": {
        "STALWART_URL": "<VALUE>",
        "STALWART_USER": "<VALUE>",
        "STALWART_PASSWORD": "<YOUR_VALUE>",
        "MAIL_LANG": "auto",
        "MAIL_OCR_PROVIDER": "auto",
        "MAIL_OCR_API_KEY": "<YOUR_VALUE>",
        "MAIL_OCR_MODEL": "<VALUE>",
        "MAIL_OCR_BASE_URL": "<VALUE>",
        "MAIL_BRAND": "Stalwart Mail",
        "MAIL_TIMEZONE": "<VALUE>",
        "STALWART_TOKEN": "<VALUE>",
        "MAIL_ALLOW_SEND": "<VALUE>",
        "MISTRAL_API_KEY": "<VALUE>",
        "MAIL_TOOL_PREFIX": "mail",
        "MAIL_ALLOW_DRAFTS": "<VALUE>",
        "MAIL_DOWNLOAD_DIR": "<VALUE>",
        "MAIL_SAVE_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_CONTACT_EDIT": "<VALUE>"
      }
    }
  }
}

Cursor usually picks up config changes automatically; if the server does not appear, reload the window.

Add to .mcp.json (project) or ~/.claude.json (global)

Windows / Linux path
Windows: .mcp.json (project) or %USERPROFILE%\.claude.json (global)
Linux: .mcp.json (project) or ~/.claude.json (global)
{
  "mcpServers": {
    "io-github-cybersmurf-stalwart-mail-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "stalwart-mail-mcp"
      ],
      "env": {
        "STALWART_URL": "<VALUE>",
        "STALWART_USER": "<VALUE>",
        "STALWART_PASSWORD": "<YOUR_VALUE>",
        "MAIL_LANG": "auto",
        "MAIL_OCR_PROVIDER": "auto",
        "MAIL_OCR_API_KEY": "<YOUR_VALUE>",
        "MAIL_OCR_MODEL": "<VALUE>",
        "MAIL_OCR_BASE_URL": "<VALUE>",
        "MAIL_BRAND": "Stalwart Mail",
        "MAIL_TIMEZONE": "<VALUE>",
        "STALWART_TOKEN": "<VALUE>",
        "MAIL_ALLOW_SEND": "<VALUE>",
        "MISTRAL_API_KEY": "<VALUE>",
        "MAIL_TOOL_PREFIX": "mail",
        "MAIL_ALLOW_DRAFTS": "<VALUE>",
        "MAIL_DOWNLOAD_DIR": "<VALUE>",
        "MAIL_SAVE_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_CONTACT_EDIT": "<VALUE>"
      }
    }
  }
}

The server will be available in the next Claude Code session.

Add to .vscode/mcp.json

Windows / Linux path
Windows: .vscode\mcp.json
Linux: .vscode/mcp.json
{
  "servers": {
    "io-github-cybersmurf-stalwart-mail-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "stalwart-mail-mcp"
      ],
      "env": {
        "STALWART_URL": "<VALUE>",
        "STALWART_USER": "<VALUE>",
        "STALWART_PASSWORD": "<YOUR_VALUE>",
        "MAIL_LANG": "auto",
        "MAIL_OCR_PROVIDER": "auto",
        "MAIL_OCR_API_KEY": "<YOUR_VALUE>",
        "MAIL_OCR_MODEL": "<VALUE>",
        "MAIL_OCR_BASE_URL": "<VALUE>",
        "MAIL_BRAND": "Stalwart Mail",
        "MAIL_TIMEZONE": "<VALUE>",
        "STALWART_TOKEN": "<VALUE>",
        "MAIL_ALLOW_SEND": "<VALUE>",
        "MISTRAL_API_KEY": "<VALUE>",
        "MAIL_TOOL_PREFIX": "mail",
        "MAIL_ALLOW_DRAFTS": "<VALUE>",
        "MAIL_DOWNLOAD_DIR": "<VALUE>",
        "MAIL_SAVE_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_CONTACT_EDIT": "<VALUE>"
      }
    }
  }
}

Reload the VS Code window to activate.

Add to ~/.codeium/windsurf/mcp_config.json

Windows / Linux path
Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
Linux: ~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "io-github-cybersmurf-stalwart-mail-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "stalwart-mail-mcp"
      ],
      "env": {
        "STALWART_URL": "<VALUE>",
        "STALWART_USER": "<VALUE>",
        "STALWART_PASSWORD": "<YOUR_VALUE>",
        "MAIL_LANG": "auto",
        "MAIL_OCR_PROVIDER": "auto",
        "MAIL_OCR_API_KEY": "<YOUR_VALUE>",
        "MAIL_OCR_MODEL": "<VALUE>",
        "MAIL_OCR_BASE_URL": "<VALUE>",
        "MAIL_BRAND": "Stalwart Mail",
        "MAIL_TIMEZONE": "<VALUE>",
        "STALWART_TOKEN": "<VALUE>",
        "MAIL_ALLOW_SEND": "<VALUE>",
        "MISTRAL_API_KEY": "<VALUE>",
        "MAIL_TOOL_PREFIX": "mail",
        "MAIL_ALLOW_DRAFTS": "<VALUE>",
        "MAIL_DOWNLOAD_DIR": "<VALUE>",
        "MAIL_SAVE_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_CONTACT_EDIT": "<VALUE>"
      }
    }
  }
}

Restart Windsurf (or refresh its MCP servers panel) to activate the new server.

Windsurf Next uses ~/.codeium/windsurf-next/mcp_config.json. Devin Desktop (the Windsurf rebrand) uses ~/.config/devin/mcp_config.json and imports the Windsurf file.

Add to ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Windows / Linux path
Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
  "mcpServers": {
    "io-github-cybersmurf-stalwart-mail-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "stalwart-mail-mcp"
      ],
      "env": {
        "STALWART_URL": "<VALUE>",
        "STALWART_USER": "<VALUE>",
        "STALWART_PASSWORD": "<YOUR_VALUE>",
        "MAIL_LANG": "auto",
        "MAIL_OCR_PROVIDER": "auto",
        "MAIL_OCR_API_KEY": "<YOUR_VALUE>",
        "MAIL_OCR_MODEL": "<VALUE>",
        "MAIL_OCR_BASE_URL": "<VALUE>",
        "MAIL_BRAND": "Stalwart Mail",
        "MAIL_TIMEZONE": "<VALUE>",
        "STALWART_TOKEN": "<VALUE>",
        "MAIL_ALLOW_SEND": "<VALUE>",
        "MISTRAL_API_KEY": "<VALUE>",
        "MAIL_TOOL_PREFIX": "mail",
        "MAIL_ALLOW_DRAFTS": "<VALUE>",
        "MAIL_DOWNLOAD_DIR": "<VALUE>",
        "MAIL_SAVE_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_ATTACHMENTS": "<VALUE>",
        "MAIL_ALLOW_CONTACT_EDIT": "<VALUE>"
      }
    }
  }
}

Cline reloads cline_mcp_settings.json automatically; if the server does not appear, reload the VS Code window.

Open it from Cline's MCP Servers panel → Configure. Roo Code uses a different file and format.

Configuration

Environment variables this server reads. Secrets stay on your machine.

NameRequiredDescription
STALWART_URL Yes Public address of the Stalwart mail server, e.g. https://mail.example.com (required)
STALWART_USER Yes The mailbox you sign in as (required)
STALWART_PASSWORD secret Yes Mailbox or app password — sent as Basic auth
MAIL_LANG No `auto` (default: the machine's language, English when unsupported) or a locale code Default: auto
MAIL_OCR_PROVIDER No Who reads scans: `auto` (default), `mistral`, `anthropic`, `openai`, `openrouter`, `gemini`, `ollama`, `lmstudio`, `custom` or `off` Default: auto
MAIL_OCR_API_KEY secret No API key for the chosen OCR provider
MAIL_OCR_MODEL No Model used by the chosen OCR provider
MAIL_OCR_BASE_URL No Base URL of a custom OpenAI-compatible OCR server (used with MAIL_OCR_PROVIDER=custom)
MAIL_BRAND No Display name of the server, default `Stalwart Mail` Default: Stalwart Mail
MAIL_TIMEZONE No IANA zone for dates in the output, default the machine's zone
STALWART_TOKEN No An OAuth access token instead of the password — sent as Bearer
MAIL_ALLOW_SEND No `false` removes `send_email` and `send_draft`
MISTRAL_API_KEY No Shortcut: with only this set, scans go to Mistral OCR
MAIL_TOOL_PREFIX No Prefix of the tool names, default `mail` Default: mail
MAIL_ALLOW_DRAFTS No `false` removes `create_draft` and `delete_draft`
MAIL_DOWNLOAD_DIR No Where attachments are saved, default `~/Downloads/Mail-Attachments`
MAIL_SAVE_ATTACHMENTS No `false` = opened attachments are only read, nothing is written to disk
MAIL_ALLOW_ATTACHMENTS No `false` removes `get_attachment`
MAIL_ALLOW_CONTACT_EDIT No `false` removes `add_contact`

Similar servers