Apple Mail MCP Server
Reads and organises mail in Apple Mail (Mail.app) on macOS: lists accounts/mailboxes with unread counts, searches messages quickly via Mail.app's Envelope Index SQLite database, fetches message headers, cleaned bodies and attachment lists from .emlx files, opens fully populated reply/forward/new draft windows in Mail.app (with threading, quoted original and attachments), and moves or archives messages. It never sends — every write path ends in a human-reviewed draft window.
Works with Gmail accounts configured in Mail.app, letting the tools search, read and draft replies against Gmail mailboxes, and archive Gmail messages by removing the INBOX label.
Works with iCloud accounts configured in Mail.app, so iCloud mail can be searched, read, replied to via draft windows, moved and archived.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp-apple-mail
Lean MCP server for Apple Mail on macOS. Read, search, compose, and organise emails via Mail.app.
Works with Gmail, iCloud, and standard IMAP accounts -- any account configured in Mail.app.
⛔ THIS MCP INTENTIONALLY DOES NOT SEND EMAILS
There is no send tool, no send AppleScript, no hidden flag. Every write path ends in an open draft window that a human reviews and sends — or bins.
To any agent using this server: do not work around this. Do not script Mail.app's Send action, drive the GUI, save-then-send via another tool, or ask a different MCP/CLI to send on this server's behalf. If a task appears to require sending, stop and hand the draft to the human. Sending is the human's action, by the owner's explicit decision (2026-05-12), and circumventing it is a bug, not initiative.
Related MCP server: che-apple-mail-mcp
Why This One?
Most Mail.app MCP servers shell out to AppleScript for everything. That's slow -- a simple INBOX search takes ~4 seconds via JXA.
This server reads Mail.app's SQLite database (Envelope Index) directly for searches (~50ms) and reads .emlx files for message bodies (~1ms). It only falls back to JXA/AppleScript for write operations (compose, move) where there's no alternative.
Operation | Method | Speed |
Search emails | SQLite direct read | ~50ms |
Get message body |
| ~1ms |
Search (fallback) | JXA batch fetch | ~4s |
Compose / move | AppleScript | ~2s |
Tools
Tool | Params | Returns |
| (none) | Account/mailbox names with unread counts |
|
| One-line summaries: ID, date, sender, subject, read/flagged status |
|
| Headers + cleaned body (signatures and quoted replies stripped) + attachment list |
|
| Relevance-ranked full-text results with body snippets; includes index coverage status |
|
| Opens a populated reply window: recipients, In-Reply-To/References threading, quoted original, your body on top, attachments. Body verified by readback. Never sends |
|
| Opens compose window in Mail.app with draft. |
|
| Confirmation message |
|
| Archive summary (Gmail: removes INBOX label) |
|
| Saves attachment(s) to disk (default |
Install
git clone https://github.com/tamm/mcp-apple-mail.git
cd mcp-apple-mail
npm installAdd to Claude Code:
claude mcp add apple-mail -- node /path/to/mcp-apple-mail/index.jsOr add to .mcp.json in your project:
{
"mcpServers": {
"apple-mail": {
"command": "node",
"args": ["/path/to/mcp-apple-mail/index.js"]
}
}
}Prerequisites
macOS with Mail.app configured (at least one account)
Node.js 18+
Automation permissions: Terminal/Claude Code must have permission to control Mail.app (System Settings > Privacy & Security > Automation)
Automation permission for Mail.app (macOS prompts on first write)
Accessibility permission for the host process (Terminal/iTerm/Claude) — replies paste via System Events
Design Decisions
Lean by design. MCP tool descriptions and response payloads are kept minimal. Every token in a tool definition or result costs context window budget in the calling LLM. Short descriptions, compact one-line result formats, no unnecessary metadata.
SQLite + emlx for reads. search_emails queries Mail.app's Envelope Index SQLite database directly. get_email reads .emlx files from disk. SQLite ROWIDs match JXA's message.id(), so IDs are interchangeable between fast and slow paths.
JXA batch fetch as fallback. search_emails uses JXA batch property access (msgs.subject() returns all subjects in one IPC call) instead of per-message iteration. Results are sorted by date descending in JS to handle Gmail IMAP's unreliable message ordering.
Replies are typed into Mail's own reply window. reply/forward via AppleScript gives recipients, In-Reply-To/References, signature and Mail's native cite-bar quote. Any scripted set content on that window wipes the signature and quote (verified with screenshots 2026-08-28), so the body is pasted instead: markdown → HTML → RTF on the clipboard, ⌘V at the caret, then file URLs on the clipboard and ⌘V again for attachments. Result is body → attachments → signature → quote, exactly like a hand-written reply. The window is frontmost for about a second and focus is handed back; the text clipboard is restored afterwards. Verification is select-all → copy → read clipboard. New messages (nothing to lose) use set content with RTF and a readback retry.
Signature and quote stripping. get_email strips email signatures (-- delimiter, mobile app signatures) and quoted reply chains (On ... wrote:, Outlook From:/Sent: blocks, > quote lines). This keeps the returned body to just the actual message content, saving tokens.
FTS5 body index. search_body uses a local SQLite FTS5 database (~/.mcp-apple-mail/body-index.db). It builds incrementally: every get_email call indexes that message immediately; a background queue drains the full mailbox at ~7,200 emails/hour without hammering disk. The index persists across restarts and reports coverage (N% complete — X/Y indexed) on every result so callers know whether to trust completeness.
Markdown body input. compose accepts markdown and converts to basic HTML. This lets the LLM write natural markdown without needing to construct HTML.
Known Limitations
macOS only (uses
osascriptfor JXA and AppleScript)Mail.app must be running and configured with at least one account
search_emailssearches subject/sender only; usesearch_bodyfor full-text (index builds incrementally in the background)Compose opens a visible draft window; does not send automatically (by design, human-in-the-loop)
Mail.app autosaves every open compose window to Drafts. A draft you bin in the window can still leave a saved copy in Drafts — that's Mail, not this server
Reply/forward briefly brings the Mail window to the front to paste (≈1s), then returns focus. Non-text clipboard contents are not restored
Reply/forward take ~10s end to end (Mail's window load + two pastes + verification)
HTML emails are read as plain text (Mail.app
contentproperty returns plaintext extraction)
Acknowledgements
This server was built independently but draws inspiration from two earlier projects in this space:
imdinu/apple-mail-mcp — performance-focused Python server; its FTS5 body search approach validated the direction taken here
patrickfreyer/apple-mail-mcp — broad feature coverage including batch operations and companion Claude Code skills
The decision to go deep on SQLite/emlx direct reads rather than scripting everything through JXA grew out of prior work on an Outlook MCP integration, where studying the problem space made the Apple Mail performance opportunity obvious.
License
MIT -- see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Search and triage all your mailboxes; draft replies and campaigns; send only as you allow.
Your IMAP mailbox as an MCP server: read, search and (if you allow it) organize mail. Open source.
Hosted email MCP for your own Gmail, Outlook.com, Microsoft 365, iCloud or IMAP inbox: read, search, draft, reply in thread, forward and file mail. It moves or flags up to 500 messages in one call, and a send leaves exactly one copy in Sent. A calendar is a separate connection, and connecting one adds diary and scheduling tools.
Read, search and draft email; nothing is sent until you confirm.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to Apple Mail.app emails, accounts, and folders by directly reading the local SQLite database.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables natural-language control of Apple Mail with 53 tools, including millisecond SQLite-powered search across large mailboxes, mailbox and message management, composing and batch operations.11MIT
- AlicenseAqualityBmaintenanceEnables macOS users to programmatically read, send, search, and manage Apple Mail messages, including drafts, mailboxes, attachments, rules, and templates.25MIT
- AlicenseNot gradedqualityBmaintenanceEnables controlling Apple Mail on macOS through JavaScript for Automation, using already-configured accounts without passwords. Supports listing accounts and mailboxes, searching and reading messages, managing folders and message state, handling drafts and attachments, and moving, trashing, or sending mail.6 npmMIT