Apple Mail MCP Server logo

Apple Mail MCP Server

Community
sweetrb

MCP server for Apple Mail - read, search, send, and manage emails via Claude and other AI assistants

Publishersweetrb
Repositoryapple-mail-mcp
LanguageJavaScript
Forks
28
Stars
83
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    Apple Mail MCP Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    83 stars and 28 forks from the linked repository.

Apple Mail MCP Server

A Model Context Protocol (MCP) server that enables AI assistants like Claude to read, send, search, and manage emails in Apple Mail on macOS.

npm version npm downloads node CI OpenSSF Scorecard platform: macOS License: MIT MCP

Note: This is the npm/Node.js package — install with npx or npm. There is an unrelated Python project of the same name on PyPI (imdinu/apple-mail-mcp) installed via pipx/uvx. If you're using uvx and seeing a cyclopts dependency error, you're looking for that project, not this one.

What is This?

This server acts as a bridge between AI assistants and Apple Mail. Once configured, you can ask Claude (or any MCP-compatible AI) to:

  • "Check my inbox for unread messages"
  • "Find emails from john@example.com"
  • "Send an email to the team about the meeting"
  • "Create a draft email for me to review"
  • "Reply to that message"
  • "Forward this to my colleague"
  • "Move old newsletters to the Archive folder"

The AI assistant communicates with this server, which then uses AppleScript to interact with the Mail app on your Mac. All data stays local on your machine.

Quick Start

Using Claude Code (Easiest)

If you're using Claude Code (in Terminal or VS Code), just ask Claude to install it:

Install the sweetrb/apple-mail-mcp MCP server so you can help me manage my Apple Mail

Claude will handle the installation and configuration automatically.

Or register it deterministically in one command:

bash
claude mcp add apple-mail -s user -- npx -y apple-mail-mcp

Using the Plugin Marketplace

Install as a Claude Code plugin for automatic configuration and enhanced AI behavior:

bash
/plugin marketplace add sweetrb/apple-mail-mcp
/plugin install apple-mail

This method also installs a skill that teaches Claude when and how to use Apple Mail effectively.

Configuring IMAP/SMTP for a plugin install: a plugin install has no editable env block, so supply settings via the config file at ~/Library/Application Support/apple-mail-mcp/config.json — Method B in the IMAP / SMTP Setup Guide. Passwords stay in the macOS Keychain; run the doctor tool to verify.

Using the Codex Marketplace

Install the same public marketplace in Codex:

bash
codex plugin marketplace add sweetrb/apple-mail-mcp
codex plugin add apple-mail@apple-mail-mcp

The Codex package registers the same apple-mail MCP server through an exactly pinned runtime — npx -y apple-mail-mcp@<plugin version> — and includes the Apple Mail skill guidance. The pin in codex/.mcp.json is rewritten to match package.json by scripts/sync-plugin-version.mjs on every version bump, so the plugin manifest and the server it launches are always the same release; CI fails the PR if they drift.

Other Hosts (Hermes, Antigravity)

Two more hosts can run the same apple-mail MCP server (npx -y apple-mail-mcp):

  • Hermes Agent (NousResearch) — Hermes has no plugin/marketplace drop-in, so there is nothing in this repo to install from. Register the server with the CLI:

    bash
    hermes mcp add apple-mail --command npx --args -y apple-mail-mcp

    Or add it to ~/.hermes/config.yaml by hand:

    yaml
    mcp_servers:
      apple-mail:
        command: npx
        args: ["-y", "apple-mail-mcp"]

    Restart your Hermes session afterward so the tools load.

  • Antigravity (Google) — add the server entry from .antigravity-plugin/mcp_config.json to ~/.gemini/config/mcp_config.json (or via Antigravity's MCP settings).

Manual Installation

1. Install the server:

bash
npm install -g apple-mail-mcp

2. Add to Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

json
{
  "mcpServers": {
    "apple-mail": {
      "command": "npx",
      "args": ["apple-mail-mcp"]
    }
  }
}

3. Restart Claude Desktop and start using natural language:

"Show me my unread emails"

On first use, macOS will ask for permission to automate Mail.app. Click "OK" to allow.

Configuring email (IMAP & SMTP)

The server works out of the box over AppleScript with no configuration. Two opt-in power features take a one-time setup:

  • Fast IMAP reads — server-side search, counts, and large-mailbox handling that AppleScript is too slow for (it times out on big Gmail mailboxes).
  • Clean SMTP sending — send-email submits clean MIME directly, avoiding the macOS 15+ Mail.app <blockquote> wrapping that otherwise makes sent mail look quoted/indented like a reply.

Both are driven by non-secret APPLE_MAIL_MCP_* settings — supplied via an env block or a config.json file (for hosts like Claude Desktop that strip env) — with passwords kept in the macOS Keychain, never in config.

👉 IMAP / SMTP Setup Guide — step-by-step: app passwords, Keychain, both config methods, multi-account, SMTP, verification with the doctor tool, and troubleshooting. Verify any time by running the doctor tool.

Requirements

  • macOS - Apple Mail and AppleScript are macOS-only
  • Node.js 20+ - Required for the MCP server
  • Node.js 22.5+ and Full Disk Access - Required by search-contacts only. It reads the Contacts database directly through Node's built-in node:sqlite, which does not exist before 22.5. On an older runtime, or without Full Disk Access for the Node binary, it logs one line to stderr and returns an empty list rather than an error — so "no contacts found" can mean "cannot read Contacts". Every other tool works on Node 20+. See Node runtime & TCC permissions.
  • Apple Mail - Must have at least one account configured (iCloud, Gmail, Exchange, etc.)

Features

Messages

FeatureDescription
List MessagesList messages with pagination, sender filter, date display
Search MessagesSearch by sender, subject, content, date range, read/flagged status — across all accounts
Read MessagesGet full email content (plain text or HTML)
Read HeadersGet a message's raw RFC 5322 headers — the author's Date:, Message-ID, threading ids, Received: trace — without downloading the body
Send EmailCompose and send new emails (attach by file path or inline base64 content)
Send Serial EmailMail merge — send personalized emails to a list of recipients with {{placeholder}} support
Create DraftSave emails to Drafts folder (attach by file path or inline base64 content)
ReplyReply to messages (with reply-all support)
ForwardForward messages to new recipients
Get ThreadGroup a conversation by normalized subject (across AppleScript or IMAP)
Mark Read/UnreadChange read status (single or batch)
Flag/UnflagFlag or unflag messages (single or batch)
Delete MessagesMove messages to trash (single or batch)
Move MessagesOrganize into mailboxes (single or batch)
List AttachmentsView attachment metadata (name, type, size)
Save AttachmentSave attachments to disk
Fetch AttachmentGet an attachment's bytes as base64 (no disk write)

Read/list/get tools also return structured JSON (structuredContent) alongside the text, so agents can consume results without parsing prose.

Mailbox & Account Management

FeatureDescription
List MailboxesShow all folders with message/unread counts
Create/Delete/Rename MailboxFull mailbox lifecycle management
List AccountsShow configured accounts
Unread CountGet unread counts per mailbox

Rules, Contacts & Templates

FeatureDescription
List RulesView all mail rules and their enabled status
Enable/Disable RulesToggle mail rules on or off
Create/Delete RulesCreate rules with conditions + actions, or delete by name
Search ContactsLook up contacts from Contacts.app by name
Email TemplatesSave, list, use, and delete reusable email templates (persisted to disk across restarts)

Diagnostics

FeatureDescription
Health CheckVerify Mail.app connectivity
DoctorDiagnose Mail permission, account state, and each IMAP/SMTP backend with actionable messages
StatisticsMessage and unread counts per account, recently received stats
Sync StatusCheck if Mail.app is actively syncing
Effect reconciliationEvery delete/move reports what it actually did to the mailbox (countDelta), and warns when more messages left than were operated on — see Auditing destructive operations

MCP resources & prompts

Resources expose read-only context the client can attach without a tool call: mail://accounts, mail://templates, and mail://mailboxes/{account}. Prompts package common workflows: triage-inbox, compose-reply, weekly-summary.


Tool Reference

This section documents all available tools. AI agents should use these tool names and parameters exactly as specified.

Message Operations

search-messages

Search for messages matching criteria. Searches all accounts by default.

ParameterTypeRequiredDescription
querystringNoText to search in subject/sender
bodystringNoText to search in the message body. IMAP backend only (server-side BODY search); AppleScript-only accounts are reported as not searched
fromstringNoFilter by sender email address
subjectstringNoFilter by subject line
mailboxstringNoMailbox to search in (omit to search all mailboxes)
accountstringNoAccount to search in (omit to search all accounts)
isReadbooleanNoFilter by read status
isFlaggedbooleanNoFilter by flagged status
dateFromstringNoStart date filter (e.g., "January 1, 2026")
dateTostringNoEnd date filter (e.g., "March 1, 2026")
limitnumberNoMax results, 1–500 (default: 50)
offsetnumberNoNewest matches to skip, ≥ 0 (for pagination). IMAP accounts only; without a mailbox, offset + limit may not exceed 5,000

Returns: List of matching messages with ID, date, subject, sender, and read state.

⚠️ Row dates. Since 2.19.7 every row — on both the IMAP and AppleScript backends — carries both dateSent (the message's Date: header) and dateReceived (mailbox arrival — IMAP INTERNALDATE or Mail's date received). They differ legitimately by transit time; when they differ by years, the mailbox was migrated or re-imported and the arrival timestamp was reset — trust dateSent for chronology (#224). dateSent is omitted (not invented) when the message carries no parseable Date: header, or when it is more than 7 days later than dateReceived — Mail substitutes a timestamp of its own for a Date: header it cannot parse (#234).

Large mailboxes & partial results. Apple Mail's AppleScript bridge cannot search very large IMAP/Gmail mailboxes (tens of thousands of messages) before the Apple Event times out — empirically even reading the newest 20 messages of a 44k-message mailbox takes ~45s. To avoid burning minutes only to return a misleading empty result, an unscoped (all-mailboxes) search skips mailboxes whose message count exceeds a threshold (default 5000), enforces a per-account time budget, and reports anything it skipped or that timed out rather than silently returning nothing. When coverage is incomplete the result includes an explicit warning, e.g.:

⚠️  Partial results — this is NOT a confirmed "no such mail":
  - skipped mailbox(es) too large to search via AppleScript: Gmail / All Mail (44287) — scope the search with `mailbox` + a `dateFrom`/`dateTo` window to target them

To search inside a large mailbox, scope the call with mailbox (and ideally a dateFrom/dateTo window). Tune or disable the skip threshold with the APPLE_MAIL_MAX_SEARCH_MAILBOX environment variable (default 5000; set to 0 to disable the guard and attempt every mailbox regardless of size). (#24)

Coverage diagnostics (structured fields). The warning above is prose for a human reader; the same information is also returned as structured fields on search-messages and list-messages, so a caller can tell "nothing matched" apart from "I did not look everywhere" without parsing the text:

FieldTypeMeaning
partialbooleanCoverage was incomplete — the result is not a confirmed "no such mail". True whenever any field below is non-empty.
skippedLargeMailboxesstring[]Mailboxes never scanned because their message count exceeded APPLE_MAIL_MAX_SEARCH_MAILBOX, formatted "Account / Mailbox (count)" — e.g. "iCloud / Archive (90694)".
notSearchedMailboxesstring[]Mailboxes that were reached but timed out or errored mid-scan, formatted "Account / Mailbox". Also carries the IMAP path's failedMailboxes.
timedOutAccountsstring[]Accounts whose whole-account AppleScript was killed by the per-account time budget — nothing from that account was searched.
failedMailboxesstring[]IMAP-backend mailboxes that errored. These are merged into notSearchedMailboxes as well; read that field unless you need to attribute the failure to the IMAP path specifically.
failedMailboxReasonsobjectThe IMAP server's own error text for each entry in failedMailboxes, keyed the same way.
omittedMessagesobject[]IMAP messages that belong on the page but whose FETCH response could not be read even with a reduced item set — { id, mailbox, uid, reason }. The page is short by exactly these; the id still works with get-message / get-message-headers. (#256)

Treat a non-empty skippedLargeMailboxes as actionable rather than informational: re-run scoped to the named mailbox with a dateFrom/dateTo window, or configure the IMAP backend, which searches those mailboxes server-side. The list fields are optional and are omitted (or empty) when coverage was complete.

A row the IMAP backend could only read with a reduced item set (its full BODYSTRUCTURE, or its whole FETCH response, was unparseable — e.g. a message forwarded as an attachment many levels deep) is still returned, with a metadataIncomplete note saying what was missing; its hasAttachments is then inferred from the top-level Content-Type.


get-message

Get the full content of a message.

ParameterTypeRequiredDescription
idstringYesMessage ID
preferHtmlbooleanNoReturn HTML source instead of plain text
mailboxstringNoMailbox holding the message (e.g. "Sent Items"). With account, opens that mailbox directly instead of scanning every mailbox — this is the fix for timeouts on large folders
accountstringNoAccount holding the message. Pair with mailbox to skip the cross-mailbox scan

Returns: Subject line and message body (plain text by default, HTML if preferHtml is true and HTML content is available). structuredContent also carries rfcMessageId and, since 2.19.0, two dates: dateSent (the message's Date: header — Mail's date sent) and dateReceived (arrival in the mailbox — Mail's date received / IMAP INTERNALDATE). They differ legitimately by transit time; when they differ by years, the mailbox was migrated or re-imported and the arrival timestamp was reset — trust dateSent for chronology (#224). Since 2.19.6 dateSent is omitted when it is more than 7 days later than dateReceived: a message cannot be sent after it arrived, and Mail.app substitutes a timestamp of its own for a Date: header it cannot parse (#234). isHtml reports what was actually returned — a message with no text/plain part returns its HTML part with isHtml: true. Bodies are decoded by each part's declared charset, falling back to windows-1252 for bytes that are not valid UTF-8.

Large messages / attachments: reading a full message routes through osascript, whose captured output buffer defaults to 64 MB. Override it with the APPLE_MAIL_MCP_MAX_BUFFER environment variable (in bytes) if you work with messages whose raw MIME (e.g. a large embedded attachment) exceeds that — a value below the message size makes the read fail with a buffer-overflow error rather than truncating (#27).


get-message-headers

Return a message's raw RFC 5322 header block — without fetching the body or any attachment — plus the parsed fields chronological and threading work needs. Added in 2.19.0 for mailboxes whose arrival timestamps were reset by a migration (#224): the Date: header is the author's send time and survives such moves; INTERNALDATE / date received does not.

ParameterTypeRequiredDescription
idstringYesMessage ID (numeric or imap:…)
mailboxstringNoMailbox holding the message. With account, opens that mailbox directly instead of scanning every mailbox
accountstringNoAccount holding the message. Pair with mailbox to skip the cross-mailbox scan

Returns: The raw header block as text. structuredContent carries raw, every header as ordered headers[] ({name, value}, folded lines joined, duplicates such as Received: kept in wire order, values left RFC 2047-encoded), headerCount, and the decoded key fields: date (ISO 8601, from the Date: header), dateHeader (verbatim), dateReceived (mailbox arrival time — IMAP INTERNALDATE or Mail's date received), messageId, subject, from, to, cc, replyTo, inReplyTo, references[] and received[] (first entry = last hop). Fields the message does not carry are omitted. backend says which backend read the block ("imap" or "applescript"), and warnings[] appears when a malformed block was repaired (#234).

Backends (get-message-headers): an imap: id reads the first 64 KiB of BODY.PEEK[] over IMAP and cuts the header block out of it (cheap even for a 20 MB message). That is deliberate: iCloud rewrites 8-bit header bytes to * in ENVELOPE and BODY[HEADER], and only BODY[] returns them as stored; each line is decoded as UTF-8, falling back to windows-1252, so a raw latin-1 display name survives. A header block larger than the window falls back to BODY.PEEK[HEADER]. A numeric id reads Mail's all headers property over AppleScript, with the same mailbox-scoped fast path as get-message. ⚠️ That property is Mail's own rendering, not the stored bytes: for a Date: value Mail cannot parse it drops the value and joins the next header onto the name (Date: Subject: …). The tool splits that back apart, reports the date as absent rather than as a Subject string, and says so in warnings[]; the imap: id for the same message has the real Date:.


get-message-rfc822

Acquire a message's complete original RFC 822 bytes exactly as the IMAP server stores them, together with the IMAP identity that links the copy back to its source (#244). Built for archival, forensic review and evidence preservation: nothing is decoded, charset-converted, line-ending-normalized or MIME-re-serialized, and the SHA-256 is computed over exactly the bytes returned. IMAP-only — it needs an imap: id, i.e. an IMAP-configured account (docs/IMAP-SETUP.md). There is no AppleScript path on purpose: Mail's bridge exposes its own rendering of a message, not the stored bytes.

ParameterTypeRequiredDescription
idstringYesAn imap: message id (numeric Mail.app ids are refused with an explanation)
savePathstringNoDirectory inside the configured allowed roots. Writes the bytes to a new .eml there instead of returning them inline, and raises the size ceiling to 25 MiB
fileNamestringNoFile name to use with savePath (no path separators, no ..). Default <account>-<mailbox>-uidv<UIDVALIDITY>-uid<UID>.eml
maxBytesnumberNoRefuse — never truncate — a message larger than this many raw bytes. Default and inline maximum 6 MiB (6291456); with savePath up to 25 MiB (26214400)

Returns: a one-line summary as text. structuredContent carries the acquisition record: account, mailbox, uid, uidValidity (decimal string), internalDate (ISO 8601 INTERNALDATE — arrival, not the Date: header), flags[], size (the server's RFC822.SIZE), bytes (the count actually acquired and hashed), sha256 (hex, over exactly those bytes), messageId (from ENVELOPE, for convenience — the authoritative copy is in the bytes), readMethod (the IMAP commands issued), backend: "imap" and warnings[] — plus contentBase64 in inline mode or savedPath in file mode. The base64 is carried only in structuredContent; the text block never repeats it.

Read-only by construction. The mailbox is opened with EXAMINE and the body fetched with BODY.PEEK[], so \Seen is not set and no STORE, COPY, MOVE, APPEND or EXPUNGE is issued. No Mail.app, AppleScript or osascript is involved. The only side effect is the optional file, created with wx (an existing file or symlink is refused, never overwritten) and mode 0600, and only inside the allowed roots — the same policy as save-attachment.

Sizes. The inline ceiling exists because the MCP stdio transport drops any single message over 10 MB with no error text: 6 MiB of raw bytes is 8 MiB of base64. maxBytes is a ceiling, not a cut — an oversize message is refused with its RFC822.SIZE, so you can choose between raising maxBytes (inline, up to 6 MiB) and savePath (up to 25 MiB). warnings[] reports an RFC822.SIZE that disagrees with the byte count actually received (the hash still covers what was received) and a server that reported no UIDVALIDITY.

Verifying a derivative. shasum -a 256 file.eml must equal sha256. account + mailbox + uidValidity + uid is the durable pointer back to the source message — a UID on its own is meaningful only for one UIDVALIDITY, which the server may change (typically on a mailbox rebuild).


list-messages

List messages in a mailbox.

ParameterTypeRequiredDescription
mailboxstringNoMailbox name (omit to list from all mailboxes)
accountstringNoAccount name
limitnumberNoMax messages, 1–500 (default: 50)
offsetnumberNoNumber of messages to skip, ≥ 0 (for pagination)
fromstringNoFilter by sender email address or name
unreadOnlybooleanNoOnly show unread messages

Returns: List of messages with ID, date, subject, and sender.

⚠️ Row dates. Since 2.19.7 every row — on both the IMAP and AppleScript backends — carries both dateSent (the message's Date: header) and dateReceived (mailbox arrival — IMAP INTERNALDATE, falling back to the header date if the server withholds it; Mail's date received on the AppleScript path). They differ legitimately by transit time; when they differ by years, the mailbox was migrated or re-imported and the arrival timestamp was reset — trust dateSent for chronology (#224). Since 2.19.6 the IMAP dateSent is recovered even when the server's own parse of the Date: header failed (legacy locale dates such as jue ago 30 13:55:12 2007); both backends omit dateSent (rather than reporting it) when it is more than 7 days later than dateReceived (#234). Before 2.19.7 the AppleScript path carried only dateReceived. Sort order keys on the header date on both backends, which is the stable one.


send-email

Send a new email immediately.

⚠️ Safety: Sends real mail immediately and cannot be unsent. Confirm the recipients, subject, and body with the user before calling.

ParameterTypeRequiredDescription
tostring[]YesRecipient addresses
subjectstringYesEmail subject
bodystringYesEmail body (plain text)
ccstring[]NoCC recipients
bccstring[]NoBCC recipients
accountstringNoMail.app account label, or an email-form SMTP From override. An SMTP override must match APPLE_MAIL_MCP_SMTP_USER, APPLE_MAIL_MCP_SMTP_FROM, or an address in APPLE_MAIL_MCP_SMTP_ALLOWED_FROM
attachments(string | {filename, contentBase64})[]NoUp to 20 attachments: absolute file paths inside the configured read roots (e.g., "/Users/me/Documents/report.pdf") and/or inline {filename, contentBase64} objects up to 25 MiB decoded each
transport"applescript" | "smtp"NoSend transport. If omitted, SMTP is used automatically when configured (otherwise AppleScript). Pass "smtp" to require clean MIME, or "applescript" to force the Mail.app path — see SMTP transport

Example:

json
{
  "to": ["colleague@company.com"],
  "subject": "Meeting Tomorrow",
  "body": "Hi, just confirming our meeting at 2pm tomorrow.",
  "account": "Work",
  "attachments": ["/Users/me/Documents/agenda.pdf"]
}
SMTP transport

On macOS 15+ (Sequoia/Tahoe), Mail.app wraps any AppleScript-injected body in <blockquote type="cite"> under the Apple-Mail-URLShareWrapperClass template, so emails sent through the default applescript transport render to recipients as if they were quoted/forwarded (Apple radar FB11734014, open since Ventura). The SMTP transport bypasses Mail.app entirely and submits clean MIME directly. Once SMTP is configured, send-email uses it automatically (no need to pass transport per call); pass transport: "applescript" to force the Mail.app path.

Two differences to know when SMTP is auto-preferred:

  • Sent-folder copy is best-effort over IMAP. SMTP submission itself never touches IMAP, so since 2.18.0 the server files the sent message into the Sent mailbox of whichever configured IMAP account's login matches the SMTP identity (APPLE_MAIL_MCP_IMAP_* mirroring APPLE_MAIL_MCP_SMTP_*), flagged \Seen. The copy carries the same Message-ID that was delivered, so replies thread against it correctly, and it keeps the Bcc header the recipients never see — your own archive is exactly where that belongs. Results report sentCopy: true or sentCopy: false with sentCopyError; the field is absent when no configured IMAP account matches the SMTP identity, which is a skip, not a failure. A copy that fails never fails the send — the mail has already gone. Use transport: "applescript" if you want Mail.app itself to file the copy.
  • account is a From override, not account selection. Over SMTP, account is used as the From address only when it is an email address; a Mail.app account label (e.g. "Work") can't select an account over SMTP, so a call that passes one is left on the AppleScript path automatically. To force account selection, pass transport: "applescript" explicitly. For sender safety, an email-form override must match the SMTP login user, the configured APPLE_MAIL_MCP_SMTP_FROM, or an address listed in the comma-separated APPLE_MAIL_MCP_SMTP_ALLOWED_FROM; any other From address is rejected before connecting.

Both plain-text and HTML bodies are supported — over SMTP an HTML body (CLI --html-body-file) is sent as multipart/alternative with the plain-text fallback.

Configure SMTP via environment variables on the MCP server. The password is read from the macOS Keychain by default, so no secret goes in config:

Non-implicit-TLS SMTP connections fail closed if STARTTLS is unavailable. APPLE_MAIL_MCP_SMTP_ALLOW_PLAINTEXT=1 is a deliberate escape hatch for a trusted isolated server or test fixture; it disables the upgrade requirement and can expose credentials and message content. The server emits a warning when it is used. Keep the default unset.

VariableRequiredDefaultDescription
APPLE_MAIL_MCP_SMTP_HOSTYes—SMTP server hostname (e.g. smtp.fastmail.com)
APPLE_MAIL_MCP_SMTP_USERYes—SMTP username
APPLE_MAIL_MCP_SMTP_PORTNo465 if secure, else 587SMTP port
APPLE_MAIL_MCP_SMTP_SECURENofalsetrue for implicit TLS (port 465); otherwise STARTTLS
APPLE_MAIL_MCP_SMTP_ALLOW_PLAINTEXTNo0Set 1 only for an explicitly trusted plaintext test/server; otherwise STARTTLS is required
APPLE_MAIL_MCP_SMTP_FROMNo= userFrom address
APPLE_MAIL_MCP_SMTP_ALLOWED_FROMNo—Comma-separated sender aliases permitted as per-message From overrides
APPLE_MAIL_MCP_SMTP_PASSWORDNo—Password (if set, used instead of the Keychain)
APPLE_MAIL_MCP_SMTP_KEYCHAIN_SERVICENo= hostKeychain item service/server name
APPLE_MAIL_MCP_SMTP_KEYCHAIN_ACCOUNTNo= userKeychain item account

Store the password in the Keychain once (an app-specific password for Gmail/ iCloud). A generic-password item with an explicit service name keeps it from colliding with the system mail account password, and matches APPLE_MAIL_MCP_SMTP_KEYCHAIN_SERVICE:

bash
# Fastmail (Keychain service defaults to the host)
security add-internet-password -s smtp.fastmail.com -a you@example.com -w

# Gmail / Google Workspace, using a dedicated Keychain service name:
#   APPLE_MAIL_MCP_SMTP_HOST=smtp.gmail.com
#   APPLE_MAIL_MCP_SMTP_USER=you@gmail.com
#   APPLE_MAIL_MCP_SMTP_KEYCHAIN_SERVICE=apple-mail-mcp-smtp
security add-generic-password -s apple-mail-mcp-smtp -a you@gmail.com -w

Once the env vars are set, a plain send-email (no transport) already goes out clean:

json
{
  "to": ["colleague@company.com"],
  "subject": "Standings",
  "body": "Plain body — no blockquote wrapping."
}
apple-mail-send CLI (no MCP server required)

The package also installs an apple-mail-send binary — a standalone CLI over the same SMTP path, for cron jobs, scheduled tasks, and scripts that can't run an MCP session. It reads the identical APPLE_MAIL_MCP_SMTP_* env + Keychain config:

bash
apple-mail-send \
  --from you@example.com --to colleague@company.com \
  --subject "Standings" --body-file /tmp/body.txt \
  [--html-body-file /tmp/body.html] [--attach /tmp/report.pdf]

Repeatable --to/--cc/--bcc/--attach; an --html-body-file is sent as a multipart/alternative alongside the plain --body-file. Exit codes follow sysexits.h: 0 success, 64 usage error, 66 unreadable body file, 78 SMTP not configured.

IMAP backend — opt-in

📘 For step-by-step setup (app passwords, Keychain, config methods, multi-account, upgrading, troubleshooting), see the IMAP / SMTP Setup Guide. The summary below is the reference; the guide is the walkthrough.

AppleScript runs search/list predicates client-side over the Apple Event bridge, which is slow and can time out (false-empty) on large Gmail/IMAP mailboxes (see #24), and its delete/rename mailbox and draft handlers don't work on server-side accounts at all (#42). When an account is configured for IMAP, the MCP routes to a server-side IMAP backend (#43) that is fast and correct on exactly those mailboxes. This is opt-in and additive: any account without IMAP configured behaves exactly as before (AppleScript).

What routes to IMAP when an account is IMAP-configured:

  • Read: search-messages, list-messages (server-side SEARCH, typically sub-second), and get-message.
  • Folder ops: create-mailbox, rename-mailbox, delete-mailbox — IMAP's CREATE/RENAME/DELETE succeed on the iCloud/Gmail/Workspace/Exchange mailboxes Mail.app's AppleScript bridge can't touch (#42).
  • Message mutations: mark-as-read/unread, flag-message/unflag-message, move-message, delete-message.
  • Batch mutations (2.1): batch-mark-as-read/unread, batch-flag/unflag-messages, batch-move-messages, batch-delete-messages — imap: ids are grouped by mailbox and applied as a single UID STORE/UID MOVE; numeric ids in the same batch still use AppleScript.
  • Counts & stats (2.1): get-unread-count and list-mailboxes use STATUS; get-mail-stats uses STATUS + SEARCH SINCE — authoritative and fast even on huge mailboxes. As of v2.6.0 these prefer IMAP whenever it's configured (see Read routing below), merging across accounts when no account is given.
  • Attachments (2.1): list-attachments, save-attachment, fetch-attachment use BODYSTRUCTURE + FETCH BODY[part] for imap: ids — faster and able to see MIME-embedded attachments AppleScript misses.
  • Threading (2.1): get-thread links a conversation via References/Message-ID (HEADER SEARCH) for an imap: seed, falling back to subject grouping otherwise.

Message ids are backend-tagged. The IMAP read path emits self-describing ids of the form imap:<token> (the token encodes the account, mailbox path, and UID). Pass that id back to get-message, a message mutation, a batch op, or the attachment/thread tools and it routes to IMAP automatically; bare numeric ids continue to use AppleScript. So an agent never has to know which backend a message came from — the id carries it.

Read routing (v2.6.0): reads PREFER direct IMAP whenever IMAP is configured. The read tools — search-messages, get-thread, list-messages, list-mailboxes, get-unread-count, get-mail-stats — now go to IMAP whenever any APPLE_MAIL_MCP_IMAP_* account is configured, not just when an explicit matching account is passed. There are three cases:

  • Explicit IMAP account — single-account IMAP (fast server-side path).
  • Explicit non-IMAP account — AppleScript (that account isn't on IMAP).
  • No account given — merge across all accounts: the query fans out over every configured IMAP account, and AppleScript runs only for the accounts no IMAP config covers (the account list is partitioned — accounts already served by IMAP are not re-scanned via AppleScript). If every Mail account is IMAP-configured, AppleScript is skipped entirely. The results are merged so no account is dropped. Message lists still de-duplicate as a safety net (preferring the IMAP copy, which carries the round-trippable imap: id) and sort newest-first; count tools (get-unread-count, get-mail-stats) count each account via exactly one backend so a coverage mismatch can never double- (or under-) count.
    • An omitted mailbox on search-messages searches the account's entire store, not just one default folder (v2.17.1, #199). Per account, the fan-out uses the server-advertised RFC 6154 \All mailbox when one exists (Gmail/Workspace's [Gmail]/All Mail); otherwise it searches every selectable mailbox the server lists (iCloud, generic IMAP), merges the matches, de-duplicates by Message-ID, and sorts newest-first before applying limit/offset. A mailbox that can't be selected or searched is named in the result instead of silently dropping coverage. Scanning every mailbox on a large, deeply-nested account costs one SEARCH + a bounded FETCH per mailbox over the pooled IMAP connection — pin a mailbox to skip the fan-out when you already know where to look. list-messages (no query) still defaults an omitted mailbox to INBOX on every provider — only unscoped search scans the whole account.

If IMAP is not configured at all, every read behaves exactly as before (p

Installation

TypingMind
{
  "mcpServers": {
    "sweetrb-apple-mail-mcp": {
      "command": "npx",
      "args": [
        "apple-mail-mcp"
      ]
    }
  }
}

Use Apple Mail MCP Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Apple Mail MCP Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Apple Mail MCP Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Apple Mail MCP Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "sweetrb-apple-mail-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "apple-mail-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Apple Mail MCP Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Apple Mail MCP Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Apple Mail MCP Server to help me with this task?
Apple Mail MCP Server
Sure. I read it.
Here is what I found using Apple Mail MCP Server.

Frequently asked questions

What is the Apple Mail MCP Server MCP server used for?

Apple Mail MCP Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Apple Mail MCP Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Apple Mail MCP Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Apple Mail MCP Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Apple Mail MCP Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Apple Mail MCP Server MCP to TypingMind?

Apple Mail MCP Server runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Apple Mail MCP Server MCP provide in TypingMind?

Apple Mail MCP Server exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Apple Mail MCP Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Apple Mail MCP Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇