Skip to main content
Glama
mu-mcp

mu-mcp

by slosar

mu-mcp

A small, read-only Model Context Protocol server that lets agents search and read a local Maildir indexed by mu. It exposes two tools:

  • search_mail: search with mu's query language, returning bounded message metadata.

  • read_mail: read one matching message as plain text, with a configurable output cap.

This connector does not send, delete, move, flag, or otherwise modify mail.

Requirements

  • Python 3.10 or later

  • mu installed and initialized/indexed for the account you want to use

  • An MCP client that supports local stdio servers

Related MCP server: mbox-mcp

Install

From a checkout:

python -m pip install .

Or run directly from the repository with python -m mu_mcp.server after installing the package. For development, install python -m pip install -e '.[dev]'.

Configure an MCP client

The server communicates over stdio. Example configuration for clients that use the common mcpServers format:

{
  "mcpServers": {
    "mu-mail": {
      "command": "mu-mcp",
      "env": {
        "MUHOME": "/home/you/.mu",
        "MU_BIN": "/usr/bin/mu"
      }
    }
  }
}

MUHOME and MU_BIN are optional. MUHOME is passed to mu as --muhome; otherwise mu's normal configuration and MUHOME environment behavior apply. MU_MCP_TIMEOUT sets the per-command timeout in seconds (default 30). Keep stdout reserved for MCP: diagnostics are returned as tool errors.

Tools

search_mail(query, limit=20, sort="date", descending=true)

Accepts native mu query syntax. Examples:

from:alice@example.com subject:invoice
after:2025-01-01 before:2025-02-01
flag:unread
"project aurora" AND to:team@example.com

At most 100 results are allowed. Sorting is restricted to date, from, subject, or size. Results include common headers, flags, and message IDs; local filesystem paths are intentionally omitted.

read_mail(query, max_chars=12000)

Finds one matching result and asks mu view for its headers and plain-text content. Use a discriminating query, such as message-id:<id>, sender plus subject, and/or a date range. max_chars must be between 500 and 40,000. The result includes a truncated flag. Attachments are not extracted.

Privacy and safety

Email content is sensitive. This server runs locally and returns message data only to the connected MCP client, but that client or its model provider may process tool results under its own policies. Connect only clients you trust. Queries are passed as argument values directly to mu without a shell, and the server has no mail mutation tools. Message paths come from mu search results and are not accepted as user-provided filesystem paths.

Development

python -m pip install -e '.[dev]'
pytest

Tests mock the mu process and do not read your mailbox. See mu's query syntax for the full search language.

License

MIT. See LICENSE.

Available Tools

2 tools
read_mailA

Read the first message matching a mu query; message output is truncated.

Use a specific query such as "message-id:abc@example.com" or combine sender, subject, and date terms to identify the intended email. Returns headers and plain-text content. This tool does not modify the mailbox.

Inputs: query (required), max_chars.

search_mailA

Search the local mu-indexed mailbox using mu query syntax.

Examples: "from:alice@example.com subject:invoice", "after:2025-01-01 before:2025-02-01", or "flag:unread". Returns at most 100 metadata records; local filesystem paths are excluded.

Inputs: query (required), sort, limit, descending. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 2 tools

    Disambiguation4/5

    search_mail returns metadata records while read_mail returns message content, so their core actions are distinct. However, both accept mu queries and an agent might initially attempt to use search_mail for reading, though descriptions clarify the limitations.

    Naming Consistency5/5

    Both tool names follow the same snake_case verb_noun pattern: search_mail and read_mail. The convention is clear and consistently applied.

    Tool Count3/5

    Two tools is quite thin for a mailbox server; while the read-only scope justifies minimalism, common operations like listing folders or fetching full messages are absent. The count feels borderline rather than well-scoped.

    Completeness3/5

    The surface covers basic search and read, but read_mail truncates output and there is no way to retrieve full messages or attachments. These are notable gaps for a mail retrieval tool, though read-only limits some expected operations.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      Enables local LLMs to search email via mu, keeping all data on-device for privacy.
      5
      -
    • A
      license
      A
      quality
      C
      maintenance
      Reads and searches local email archives (.mbox or .eml) with full MIME parsing, enabling queries about senders, subjects, dates, and bodies while keeping all data on your machine.
      3
      162 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to search and page through local Thunderbird mbox mail, read message bodies and attachments with SHA-256 verification, open native compose windows, create native drafts, and send explicitly authorized email through existing Thunderbird identities over MCP stdio. Queries stay read-only and never modify the mbox, while account authentication and real delivery remain with Thunderbird.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables an AI agent to search and read a single IMAP mailbox through a local, read-only index and write Markdown drafts without ever sending mail.
      MIT