mail-mcp
Provides tools for reading and managing email in Apple Mail, including listing accounts and mailboxes, searching and fetching messages, handling attachments, and creating drafts. It does not send mail.
Click on "Install 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., "@mail-mcpCheck my inbox for unread messages"
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.
mail-mcp
An Apple Mail MCP server with a supply chain small enough to read in an
afternoon: zero runtime dependencies, no network code, no shell, and no way
to send mail. It drives Mail.app through its scripting interface (JXA over
osascript) and exposes thirteen tools for reading mail, listing structure,
handling attachments, and creating drafts.
Everything load-bearing here traces to measurements on real hardware,
recorded in docs/apple-mail/ and re-checkable with node research/verify.mjs.
The security posture, stated plainly
This server cannot send mail, and that is the design, not a gap.
There is no send tool, no send code path, and no code that could grow one quietly: a test walks the dependency closure and fails if anything imports
node:net,node:tls,node:http,node:https,node:dgram, callsfetch, or contains asend(call in a Mail script. Do not add a send tool; a draft-then-send flow with an in-band confirmation token does not actually establish human review, because a model can chain both calls in one turn. The user reviews drafts in Mail.app and presses Send there.Drafts are the only mutation. No delete, no move, no mark-as-read, no rule editing. Email content is attacker-controlled input to any model reading it; the small write surface bounds what injected instructions can do.
No credentials, no sockets, no Keychain. Mail.app does its own syncing; this server never sees a password or opens a connection.
save-attachmentis the only filesystem writer. It writes only under an allowlisted root (MAIL_MCP_SAVE_ROOT, default~/Downloads), resolves symlinks before checking containment, sanitizes filenames from mail, and never overwrites. There is deliberately no tool that returns attachment bytes into the conversation.No user value is ever interpolated into script text. Scripts are static files on disk; values travel as
argv, spawned without a shell.package.jsonhas nodependencieskey. Ever. A test enforces this too.
Related MCP server: mail-mcp
Requirements
macOS with Mail.app configured (built against Mail 16.0 on macOS 26.x)
Node.js 20 or newer
Automation permission for whatever runs the server (see below)
Install and register
No build step and no dependencies to install:
git clone https://github.com/007hacky007/mail-mcp.git
cd mail-mcpRegister with Claude Code (available in every session):
claude mcp add --scope user mail-mcp -- node "$(pwd)/src/index.mjs"Or for the current project only:
claude mcp add mail-mcp -- node "$(pwd)/src/index.mjs"For any other MCP host, configure a stdio server running
node /absolute/path/to/mail-mcp/src/index.mjs.
Verify with the host's tooling (claude mcp list should show
mail-mcp ... Connected), then call the doctor tool.
Automation permission
On the first call into Mail, macOS prompts to allow the host application to
control Mail.app. Approve it. To check or repair the grant: System Settings >
Privacy & Security > Automation, find the host app (Terminal, Claude, etc.),
enable Mail. The doctor tool reports whether the grant is working.
The ad-hoc-signed Node problem
TCC identifies programs by code signature. A Homebrew-installed Node is
ad-hoc signed and its signature changes on every upgrade, so macOS forgets
the Automation grant and prompts again after each brew upgrade. If the
re-prompting bothers you, use the official Node.js installer (Developer ID
signed, stable identity) at a stable path. doctor reports which kind of
Node is running.
Tools
Tool | What it does |
| Diagnostics: Mail running, Automation granted, accounts visible, Node signing, warm round-trip timing. Run first when anything misbehaves. |
| Accounts with enabled state, type, addresses. Disabled accounts are reported as disabled, never hidden. |
| Mailbox tree with full paths and (optionally) counts. Full paths are the identifiers everything else expects. |
| Cheap unread counts; defaults to every enabled account's INBOX. |
| Newest N of one mailbox: id, subject, sender, date, read state, mailbox path. |
| Substring search over subject/sender with date range, across accounts or scoped. Reports every mailbox scanned and skipped. |
| One message in full: headers, recipients, plain-text body; |
| Related messages via References/In-Reply-To, with visible normalized-subject fallback. |
| Attachment names, types, sizes, parsed from the MIME source. Metadata only. |
| Writes one attachment under the allowlisted root. Never overwrites. |
| New draft with recipients, subject, body, optional attachments. Saved to Drafts, never sent. |
| Reply (or reply-all) draft with your body above the quoted original. Never sent. |
| Forward draft to given recipients with an optional note. Never sent. |
Things worth knowing before filing a bug
Message ids are per-mailbox integers and do not survive moves. Every tool returns the full mailbox path with the id, and lookups need both. If a message was moved since you listed it, re-list or search again.
Size guards are deliberate. Bulk reads degrade worse than linearly with mailbox size (measured: a 52k-message mailbox is far more than 3x slower than a 17k one). Mailboxes over the guard are refused or skipped and reported, never silently dropped. Raise
maxMessagesper call to scan them anyway and expect tens of seconds.Search covers subject and sender, not bodies. Fetching every body through the scripting bridge would take minutes and gigabytes.
A failed operation never looks like an empty result. Transport failures (Mail unresponsive, timeout) surface as errors; domain refusals name the real candidates; partial scans label their totals as floors and list what was skipped.
Ambiguity is refused, not guessed. Real mailboxes can have two same-named siblings (this machine has twin
Junkmailboxes in one account); a path matching more than one mailbox is an error naming them.Gmail accounts may hide standard mailboxes from the scripting bridge. On this machine the Gmail-backed account exposes no
All Mail, no[Gmail]container, and noDraftsmailbox; its INBOX is real and holds the mail. Created drafts for such an account exist in Mail's unified Drafts even when no per-account Drafts path can list them.
Configuration
Variable | Meaning | Default |
| Root directory |
|
Testing
npm test # tier 1: 219 unit tests, no Mail.app, runs anywhere
node research/verify.mjs # tier 2: replays every recorded probe against real MailTier 1 gates every commit: input guards, MIME parsing, path containment,
error mapping, and the no-network/no-send/no-deps enforcement tests. Tier 2
is the drift detector: it fails when a macOS update changes Mail's object
model or performance characteristics that this design rests on (bulk fetch,
byId cost, mailbox structure).
Tier 3 is drafts: creating them is the only mutation, so automated runs are
manual-by-choice. The live checklist used during development is described in
docs/apple-mail/README.md (draft recipes section); it creates clearly
labeled test drafts that you delete afterwards.
Architecture
src/mcp/ stdio JSON-RPC framing: initialize, tools/list, tools/call
src/tools/ one file per tool: validate input, call, shape output
src/mail/ domain logic that runs in Node: MIME parsing, path containment
src/jxa/ the runner plus one .js script per operation, run via osascriptScripts are ordinary files, independently runnable from a terminal for
debugging (osascript -l JavaScript src/jxa/list-accounts.js). The runner
serializes all Mail calls (Mail's scripting dispatch is single-threaded),
charges queue wait against each call's own deadline, kills overruns with
SIGKILL, and treats non-JSON output as a transport failure, never as data.
The knowledge behind every design decision lives in docs/apple-mail/:
measured costs, the whose-clause trap, message identity semantics, the
draft-content trap, and the corrections to folklore that turned out to be
wrong on real hardware.
License
No license granted yet. All rights reserved.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityAmaintenanceThis MCP server allows AI assistants to read, send, search, and manage emails in Apple Mail on macOS. It uses AppleScript to interact with the Mail app locally.503,77956MIT
- Alicense-qualityCmaintenanceAn MCP server for email operations supporting IMAP and SMTP protocols, enabling sending, receiving, searching, and managing emails with attachments.MIT
- Alicense-qualityBmaintenanceMCP server for managing email via IMAP/SMTP, supporting multiple accounts and tools for reading, sending, searching, and organizing emails.7MIT
- AlicenseAqualityBmaintenanceMCP server that enables email management (send, read, search, delete, etc.) via IMAP/SMTP, compatible with Gmail, Outlook, Yahoo, iCloud, and other standard mail servers.11MIT
Related MCP Connectors
Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.
Shipmail MCP server for AI agent custom-domain email inboxes with REST API and webhooks.
MCP server for Appcircle mobile CI/CD platform.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/007hacky007/mail-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server