mu-mcp
Search and read your local mu-indexed email via MCP, and extract/open attachments.
health_check — verify the MCP server is running.
query — run a
mu findsearch expression (from:, subject:, date:, flag:attach, mime:application/pdf, etc.) and get matching messages; the tool description embeds the fullmu find/mu querysyntax guide.view — display emails by their file paths (paths obtained from
mu find --fields "l").get_attachment — extract attachment(s) from an email using
mu extract; saves them to a temp dir and optionally opens them with the OS default viewer.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mu-mcpfind emails from Sarah about the project update"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mu-mcp: MCP Server for the mu Mail Indexer
A Model Context Protocol (MCP) server for querying your local mu mail index. This server enables fast, structured mail search from Claude Desktop and other MCP clients.
Features
Stdio MCP server for easy integration
Tools:
search_emails,view_emails(HTML-only emails converted to text),list_attachments,open_attachment(saves to a temp dir and optionally opens with the default OS viewer), andmu_helpfor the fullmureference on demand.Small context footprint: a short query guide lives in the tool description; the full man pages are only loaded when the model asks for them.
Fast, flexible mail search using the
muindexClaude Desktop ready: simple installation and config
Python, uv, and MCP SDK based
Related MCP server: Gmail Plugin MCP Server
Installation
Requires mu installed and your mail indexed (mu init + mu index).
With uv installed, run the published package from PyPI without cloning the repository:
uvx mu-mcpUsage
Run the MCP Server
uvx mu-mcpThe server communicates over stdio; normally your MCP client launches it using the configuration below.
Claude Desktop Integration
Add to your claude_desktop_config.json:
"mcpServers": {
"email": {
"command": "uvx",
"args": ["mu-mcp"]
}
}The client needs uvx and mu on its PATH. If it cannot find uvx, use the
absolute path returned by which uvx as the command.
Claude Code Integration
claude mcp add email -s user -- uvx mu-mcpUse -s local instead to enable it only in the current project. Check it with /mcp in a new session.
Query
Ask Claude to find emails, e.g. "Find emails with a PDF attachment that were sent last April and open the PDF", "Show me the email I received from Alice last week", or "Find emails with the subject 'Meeting Notes'".
Development
To run from a local checkout:
git clone https://github.com/danielfleischer/mu-mcp.git
cd mu-mcp
uv sync
uv run mu-mcpAdding a tool to view an email.
Adding a tool to find and download attachments.
Progressive disclosure of the
muman pages viamu_help.Add a
mu-mcpconsole script and useuvx mu-mcpas the install method.Describe when to use the server in its instructions, including email, inbox, messages, receipts, and attachments.
Future ideas
Return attachment text (PDF, DOCX) from
open_attachment; Claude Desktop can't read the saved file paths.view_thread: show a whole conversation from one message.find_contactsviamu cfind, to resolve a name to its addresses.
Available Tools
5 toolslist_attachmentsC
List the MIME parts (attachments, inline images, bodies) of one email.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full disclosure burden. It does not state that this is a read-only, non-destructive enumeration, nor mention ordering, pagination, or behavior on emails with no parts, for a tool that the agent must be able to call safely.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
A single efficient sentence with the enumerating verb front-loaded and no filler. It is appropriately sized, though the parenthesis adds clarification at the cost of a slightly denser read.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The presence of an output schema means return values needn't be explained, which offsets some gaps. However, with no annotations and an undocumented required path parameter, the definition is only minimally sufficient for a read tool with ambiguous input.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0% and the single parameter "path" is undocumented in both schema and description. "Of one email" hints that path identifies the email, but the format (filesystem path, ID, URI) is left ambiguous, which is a real risk for a required parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb (List) and resource (MIME parts: attachments, inline images, bodies) of a single email, and parenthetically disambiguates what a "MIME part" is. It does not distinguish the tool from siblings like open_attachment or view_emails, but the core purpose is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No when-to-use guidance, no prerequisites, and no mention of alternatives (e.g., open_attachment to fetch the actual content). Usage is only weakly implied by "of one email," so the agent must infer both trigger conditions and relationships to siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
mu_helpA
Full mu reference, for when the short guide in search_emails isn't enough.
Topics: query (complete query language), fields (live list of fields and flags), find (search options), extract (attachment handling).
| Name | Required | Description | Default |
|---|---|---|---|
| topic | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It implies a read-only documentation lookup, but never states that explicitly, nor does it describe output size or whether topics can be combined. For a low-risk help tool this is adequate, but it adds little behavioral context beyond the topic list.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences, front-loaded with the purpose and the routing condition, followed by a compact topic legend. No filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return values need no explanation. For a single-enum documentation tool, the purpose, trigger condition, and value semantics are all covered.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0% and the single parameter is an enum, so the description must supply meaning for the values. It does: each of query, fields, find, and extract is annotated with a parenthetical scope, letting the agent pick the right topic without guessing.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific resource ('full mu reference') and enumerates the four topic areas it covers, so an agent knows exactly what it gets. It also distinguishes itself from search_emails by positioning itself as the deeper version of that tool's short guide.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives an explicit trigger condition ('when the short guide in search_emails isn't enough') and names the alternative, so the agent can decide between calling search_emails' inline guide and calling this tool. The inverse condition (short guide suffices) follows directly.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
open_attachmentA
Save attachments of an email to a temp dir, optionally opening them.
Returns the saved file paths, so their contents can be read afterwards.
Args:
path: message file path.
pattern: case-sensitive PCRE matched against attachment file names,
e.g. .*\.pdf$ or (?i)invoice. Default: all attachments.
open_in_viewer: also open each file with the OS default application.
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| pattern | No | .* | |
| open_in_viewer | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden. It usefully discloses that files land in a temp dir and that open_in_viewer launches the OS default application (a real side effect), but it says nothing about overwrite behavior in the temp dir, permissions, or what happens when no attachment matches.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Front-loaded with the core action, followed by a useful return-value note and a clean Args block. Slightly more verbose than strictly necessary, but every line adds information and nothing is repeated.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return-value detail is not required, and the description still notes that file paths come back. All three parameters are explained despite 0% schema coverage. Only the lack of sibling routing and failure-mode context keeps it from a 5.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must compensate, and it does: path is identified as a message file path, pattern is described as case-sensitive PCRE matched against attachment names with concrete examples and its default, and open_in_viewer is explained as opening each file with the OS default app.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb and resource: save an email's attachments to a temp dir, with optional opening. It is clearly distinct from list_attachments in intent (save/dump vs. list), although it never names that sibling to make the distinction explicit.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied rather than stated: 'Returns the saved file paths, so their contents can be read afterwards' hints at the workflow (save, then read). There is no explicit when-to-use/when-not guidance and no pointer to list_attachments or view_emails for the cases where saving is unnecessary.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_emailsA
Search the local mail index with a mu query.
Returns one line per message: date | from | subject | path. Pass the
path to view_emails or list_attachments.
Query syntax (quote phrases with double quotes; no shell is involved):
Bare words search from/to/cc/subject/body:
invoice marchFields: from: to: cc: contact: (any address) subject: body: maildir: (e.g. maildir:/Inbox) list: tag: file: (attachment name) mime: (attachment type, e.g. mime:application/pdf, mime:image/*)
Dates: date:2024-04..2024-04, date:2w.. (last 2 weeks), date:..2023, date:today.. (units: h d w m y)
Flags: flag:attach flag:unread flag:flagged flag:replied flag:personal flag:list flag:calendar
Operators: and, or, not, parentheses; implicit
andbetween terms.Wildcard suffix:
budg*. Regex:subject:/re.?port/Names match words in the address too: from:alice, from:amazon
Examples:
from:alice date:1w..
subject:"meeting notes"
mime:application/pdf and date:2025-04..2025-04
(from:bank or from:visa) and flag:unread
contact:bob and not flag:list
Args: query: the mu query. max_results: cap on returned messages; raise it or narrow the query if the result is cut off. sort: field to sort by. newest_first: reverse sort order (newest/Z first). include_thread: also return other messages from matching threads.
| Name | Required | Description | Default |
|---|---|---|---|
| sort | No | date | |
| query | Yes | ||
| max_results | No | ||
| newest_first | No | ||
| include_thread | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden and does disclose key behavior: the exact one-line-per-message return format, the fact that max_results truncation is possible and how to react ('raise it or narrow the query if the result is cut off'), and the semantics of newest_first ('newest/Z first'). It never explicitly states read-only/no-side-effect behavior, but search semantics imply it.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Long but dense: purpose and return format are front-loaded, then the query grammar is organized under tight bullet headings with examples. Every block is load-bearing for a tool whose parameter is a mini-language; nothing reads as filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, yet the description still front-loads the return line format, and all five parameters, the query grammar, and the follow-up tools are covered. For a search tool of this complexity, an agent has everything needed to construct a correct call.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate, and it documents all five parameters: query (with a full grammar and examples), max_results (a cap plus the truncation remedy), sort (field to sort by), newest_first (reverse order), and include_thread (also return other messages from matching threads). This is meaningfully more than the bare schema types/defaults.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb and resource ('Search the local mail index with a `mu` query') and immediately clarifies the exact return shape (`date | from | subject | path`). It also names the sibling tools that consume the output (view_emails, list_attachments), so an agent can place it in the workflow without opening any schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Gives extensive guidance on how to use it (full query grammar, field list, date units, flag list, operators, five concrete examples) and how to chain it to siblings via the returned path. It does not explicitly state when to prefer it over mu_help or when a narrower query is required beyond the truncation note, so it stops short of a full when/when-not statement.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
view_emailsA
Read emails (headers + body as text) given paths from search_emails.
HTML-only emails are converted to plain text.
Args: paths: message file paths. max_chars: per-message cap on returned text.
| Name | Required | Description | Default |
|---|---|---|---|
| paths | Yes | ||
| max_chars | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full behavioral burden. It does add real value by disclosing the HTML-to-plain-text conversion and the per-message truncation cap, but it is silent on error behavior for invalid paths, whether truncation is signaled to the caller, and whether attachments are included. Useful but incomplete for an annotation-free tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Four short lines, front-loaded with purpose and the routing cue before the Args block. Every sentence earns its place with no filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
An output schema exists, so return-value documentation is not required, and the description covers purpose, input provenance, format conversion, and truncation policy. It is nearly complete for a simple two-parameter read tool; only error/edge-case behavior is unaddressed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must define both parameters, and it does: 'paths' as message file paths and 'max_chars' as a per-message cap on returned text. The definitions are accurate but terse, and it doesn't explain what happens when the cap is hit (truncation semantics), which is the one behavior an agent would most want clarified.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
States a specific verb+resource ('Read emails') and specifies exactly what is returned (headers + body as text). It also anchors the input to the sibling search_emails, so an agent can distinguish it from search_emails, list_attachments and open_attachment without opening any schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It explicitly tells the agent where the required 'paths' come from ('given paths from search_emails'), which is the key usage constraint. It does not state when NOT to use it or point to list_attachments/open_attachment for attachment content, so it stops short of full when/when-not guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
9 tool updates
v0.6.1- Removed
get_attachment - Removed
health_check - Added
list_attachments - Added
mu_help - Added
open_attachment - Removed
query - Added
search_emails - Removed
view - Added
view_emails
4 tool updates
v0.3.0- First observed
get_attachment - First observed
health_check - First observed
query - First observed
view
TDQS
Scored across 5 tools
Each tool targets a distinct action: search metadata, view message bodies, list MIME parts, save/open attachments, and read help. Boundaries are clear; no two tools overlap in purpose.
Four tools follow a consistent verb_noun snake_case pattern (search_emails, view_emails, list_attachments, open_attachment), but mu_help deviates and list_attachments/open_attachment mix plural/singular. Minor deviations only.
Five tools are well-scoped for a local email search/read server. Each tool earns its place; no bloat or missing essential primitive.
Search and view cover the core read path, but open_attachment saves files without any tool to read their contents afterward, creating a dead end for attachment processing. No update/tag operations either, though those may be outside the read-only scope.
Maintenance
Related MCP Connectors
An MCP server that provides email capabilities, hosted on Alpic platform
An MCP server that provides email capabilities, hosted on Alpic platform
An MCP server that provides email capabilities, hosted on Alpic platform
Your IMAP mailbox as an MCP server: read, search and (if you allow it) organize mail. Open source.
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that provides a seamless email management interface through Claude, allowing users to search, read, and send emails directly through natural language conversations.4114MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables Gmail integration, allowing users to manage emails (send, receive, read, trash, mark as read) directly through MCP clients like Claude Desktop.1MIT
- FlicenseAqualityDmaintenanceAn MCP server that enables Claude to directly access and manage email through IMAP. It provides tools for reading, searching, organizing, and drafting emails within your mailbox.9-
- AlicenseNot gradedqualityDmaintenanceA cross-platform MCP server that provides Claude with email access via IMAP, supporting multiple email providers and account management.MIT