apple-mail-mcp
Integrates with Apple Mail via AppleScript to list accounts and mailboxes, list and search messages, read full messages and threads, and save drafts without ever sending mail. It can optionally use IMAP for faster server-side search on large mailboxes.
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., "@apple-mail-mcp what did Jane send me last week?"
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.
apple-mail-mcp
Let an AI assistant read your Apple Mail — search it, read threads, and save drafts — instead of squinting at screenshots of the Mail window.
It is an MCP server for macOS. It talks to Mail.app through AppleScript out of the box (no setup, no credentials), and can optionally use IMAP for speed on big mailboxes.
It never sends mail. The only write it can do is save a draft.
Quick start
You need macOS with Mail.app set up, and uv.
Claude Code
claude mcp add apple-mail -s user -- uvx --from git+https://github.com/TrevorIkky/apple-mail-mcp apple-mail-mcpClaude Desktop, or any MCP client
Add this to the client's MCP config (for Claude Desktop that is
~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"apple-mail": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/TrevorIkky/apple-mail-mcp",
"apple-mail-mcp"
]
}
}
}Restart the client. The first time the server talks to Mail, macOS asks you to allow it to control Mail — say yes, or it can't read anything.
Then just ask: "what did Jane send me last week?", "summarise the thread about the invoice", "draft a reply agreeing to Tuesday".
Check it works
uvx --from git+https://github.com/TrevorIkky/apple-mail-mcp apple-mail-mcp --selftestThat prints your account names and the five newest messages in the first one.
Related MCP server: Apple Mail MCP Server
What it can do
Tool | What it does |
| The accounts configured in Mail |
| Folders in an account |
| Newest messages, headers only, with sender/subject/unread filters |
| Full bodies for specific message ids |
| Full bodies by position in the mailbox (1 = newest) — use on slow mailboxes like Sent |
| Find by sender or subject (optionally body text) |
| Save a draft in Mail — never sends |
| The fast path, see below |
A typical sequence: list_messages to see what's there → read_messages with
the handful of ids that matter → create_draft for the reply.
The fast path (optional)
AppleScript is the only route Apple documents, but every call is synchronous against the Mail app and dies at the Apple Event timeout (~2 minutes). On a mailbox with tens of thousands of messages, a broad search will simply time out.
If that's you, point the IMAP tools at the same account and get real server-side
search. Create ~/.config/apple-mail-mcp/config.json:
{
"accounts": {
"work": {
"host": "imap.example.com",
"port": 993,
"user": "you@example.com",
"keychain_service": "apple-mail-mcp",
"keychain_account": "you@example.com"
}
}
}Your password is not in that file. Put it in the macOS Keychain yourself:
security add-generic-password -s apple-mail-mcp -a you@example.com -wFor Gmail and iCloud this must be an app-specific password, not your login password.
Why it works this way
There is no supported Apple framework for reading a mailbox from outside Mail, so the honest options are limited:
Route | Supported | Fast | Notes |
AppleScript | Yes — Mail's scripting dictionary | No | Bound by the Apple Event timeout. What this server uses by default. |
Yes, but wrong tool | — | macOS 12+ extension API: content blocking, message actions, compose sessions, security. It hands your extension messages as they arrive; it cannot browse mailboxes or fetch stored mail. | |
On-disk store ( | No — undocumented | Yes | Needs Full Disk Access, and the format can change with any macOS release. |
IMAP | Yes — a standard protocol | Yes | Independent of Mail. Needs credentials. The opt-in path above. |
Two rules keep the AppleScript backend from wedging Mail, both learned the hard way:
No
whosefilters.messages whose id is Nwalks the entire store and times out. The server iterates by index and filters in Python.Never fetch bodies for a list. Headers are cheap, bodies are not.
list_messagesreturns headers only; bodies come fromread_messagesfor the ids you actually want.
Every call takes a scan bound, so a request can't quietly turn into a
mailbox-wide walk.
Troubleshooting
"Mail got an error: AppleEvent timed out (-1712)" — a request was too big, or
Mail is busy syncing. Lower scan, or use the IMAP path. If Mail itself has
become unresponsive, give it a minute; it recovers.
"Operation not permitted" — your client needs Automation permission for Mail in System Settings → Privacy & Security → Automation.
Empty results from an account that clearly has mail — check the mailbox name
with list_mailboxes; it is INBOX on some accounts and Inbox on others.
Development
git clone https://github.com/TrevorIkky/apple-mail-mcp
cd apple-mail-mcp
uv run pytest
uv run apple-mail-mcp --selftestSee CONTRIBUTING.md for the layout and the rules that keep Mail.app from wedging.
License
MIT
Available Tools
10 toolscreate_draftB
Save a new message as a draft in Mail.app. It is never sent.
account picks the sending address (an account name from
list_accounts). The person reviews and sends the draft themselves.
Inputs: to (required), body (required), subject (required), cc, +1 more. Returns: result
imap_fetchC
Fetch full message bodies by UID, as returned by imap_search.
Inputs: uids (required), account (required), mailbox, max_chars. Returns: result
imap_mailboxesA
List IMAP folders for a configured account.
account is a key under "accounts" in ~/.config/apple-mail-mcp/config.json,
not necessarily the name Mail.app shows.
Inputs: account (required). Returns: result
imap_searchA
Server-side search - fast even on mailboxes too large for AppleScript.
since takes the IMAP date form, e.g. "01-Oct-2026". Returns headers
plus the UIDs to pass to imap_fetch. Read-only: nothing is marked read.
Inputs: account (required), limit, since, mailbox, +3 more. Returns: result
list_accountsA
List the mail accounts configured in Mail.app.
Inputs: no named parameters. Returns: result
list_mailboxesA
List the mailboxes (folders) of one account.
Names differ between accounts - INBOX on some, Inbox on others - so check here before guessing.
Inputs: account (required). Returns: result
list_messagesA
List message headers, newest first, without fetching bodies.
scan bounds how many of the newest messages are examined; limit caps
how many matches come back. Filters are case-insensitive substrings.
Positions in this result feed read_by_position.
Inputs: account (required), scan, limit, mailbox, +3 more. Returns: result
read_by_positionB
Read full bodies by position in the mailbox, where 1 is the newest.
list_messages returns messages in this order. Prefer this on mailboxes
with long quoted threads - Sent, typically - where locating a message by
id is slow enough to time out.
Inputs: account (required), positions (required), mailbox, max_chars. Returns: result
read_messagesA
Read full bodies for specific message ids from list_messages.
Locates them by scanning the newest scan messages, so raise scan for
older mail. If this times out, use read_by_position instead.
Inputs: ids (required), account (required), scan, mailbox, +1 more. Returns: result
search_messagesA
Find messages whose sender or subject contains query, case-insensitively.
search_body: true also searches bodies and returns an excerpt, which is
much slower - keep scan small. For real search on a large mailbox, use
imap_search.
Inputs: query (required), account (required), scan, limit, +3 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
There are two parallel surfaces, AppleScript and IMAP, causing overlapping pairs such as list_mailboxes/imap_mailboxes, list_messages/search_messages/imap_search, and read_messages/read_by_position/imap_fetch. The descriptions give useful guidance and fallback advice, but the boundaries are not as crisp as ideal.
Most tools use lower_snake_case action-oriented names like list_accounts, read_messages, search_messages, and create_draft. The imap_ prefixed family is still readable and groupable, though imap_mailboxes is noun-like rather than following the same verb_noun pattern.
Ten tools is well within a reasonable range for an email integration. The AppleScript and IMAP paths each add tools for distinct operational needs rather than padding the surface unnecessarily.
The set covers account/mailbox discovery, listing/searching/reading messages, and draft creation, but omits sending, moving/deleting/marking messages, attachment operations, and draft editing. The draft-only design may be intentional safety, but it leaves notable gaps in the mail lifecycle.
Related MCP Connectors
Connect Gmail, iCloud Mail, Outlook, Yahoo Mail, Fastmail and other IMAP inboxes to ChatGPT, Claude and compatible AI assistants. Find emails by meaning across languages with semantic search. Ask AI to find customer conversations, summarize deadlines and draft follow-ups. Give a sales rep access to a shared outreach inbox or bring email into a compatible CRM. Share an iCloud custom-domain inbox with teammates without their own Apple ID or iCloud+ plan. Search results may be incomplete or stale; separate permissions control mail actions.
Connect any IMAP/SMTP mailbox to Claude & ChatGPT: search, read, sort, draft. Sends only with OK.
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Your mailboxes in ChatGPT and Claude: Gmail, iCloud, Fastmail, any IMAP. Passwords stay yours.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI assistants to read, send, search, and manage emails in Apple Mail on macOS.25105MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to read, search, send, and manage email on macOS through programmatic access to Apple Mail.29MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to query a local, read-only Apple Mail archive, letting them search messages by keyword, sender, subject, date or account and retrieve summaries, individual message bodies, pending action items and stored daily briefs. All tools are annotated read-only, so assistants can consult mail without sending, deleting, moving or editing anything.MIT
- AlicenseNot gradedqualityCmaintenanceLets an AI agent read messages in Apple Mail on macOS through AppleScript, list the newest mail, and open drafts for review. Sending happens only after the user clicks Send in Mail's confirmation dialog, so nothing leaves the machine unapproved.MIT