Sandbox
@patrickfreyer/apple-mail-mcp

Apple Mail MCP server for Claude Code and MCP clients

This project connects Apple Mail to AI assistants through MCP. It exposes tools for inbox review, search, drafting, mailbox organization, attachments, summaries, and export, so the assistant can work with your mail instead of only talking about it.

207 stars53 forksPythonUpdated 1mo ago
Who it's for

Builders who want their assistant to manage Apple Mail, triage inboxes, and draft replies.

What it delivers

You can ask your assistant to handle email work in Apple Mail without leaving the chat.

What it does

Inbox and search tools

Shows inbox overviews, unread counts, mailbox lists, threads, and cross-account search across subject, sender, body, dates, attachments, flags, and colors.

Composition tools

Creates new emails, replies, forwards, drafts, and rich HTML `.eml` drafts that open in Mail.

Organization tools

Creates mailboxes, moves emails, marks read or unread, flags messages, and manages trash with dry-run safeguards.

Attachment tools

Lists email attachments and saves them to disk.

Smart inbox analysis

Finds messages awaiting reply, messages that likely need a response, and frequent senders or domains.

Analytics and export

Reports email statistics and exports emails or mailboxes to TXT or HTML.

Claude Code plugin and skill

Includes a marketplace plugin, a `/email-management` slash command, and an Email Management Expert skill for Claude Code.

How to get it

  1. 1Two commands — gets you the MCP server, /email-management slash command, and the Email…
    claude plugin marketplace add patrickfreyer/apple-mail-mcp
    claude plugin install apple-mail@apple-mail-mcp
  2. 2Run
    claude mcp add apple-mail -- uvx mcp-apple-mail
  3. 3Run
    pip install mcp-apple-mail
    claude mcp add apple-mail -- mcp-apple-mail
  4. 4Select the .mcpb file and grant Mail.app permissions
    git clone https://github.com/patrickfreyer/apple-mail-mcp.git
    cd apple-mail-mcp/plugin
    python3 -m venv venv
    venv/bin/pip install -r requirements.txt
    
    claude mcp add apple-mail -- /bin/bash $(pwd)/start_mcp.sh
  5. 5Run
    Show me an overview of my inbox
    Search for emails about "project update" in my Gmail
    Reply to the email about "Domain name" with "Thanks for the update!"
    Move emails with "invoice" in the subject to my Archive folder
    Show me email statistics for the last 30 days
    Create a rich HTML draft for a weekly update and open it in Mail

README

Apple Mail MCP Server

License: MIT PyPI Python 3.10+ MCP GitHub stars

Star History

Star History ChartStar History Chart

An MCP server that gives AI assistants full access to Apple Mail -- read, search, compose, organize, and analyze emails via natural language. Built with FastMCP.

Quick Install

Prerequisites: macOS with Apple Mail configured, Python 3.10+

Claude Code Plugin (Recommended)

Two commands — gets you the MCP server, /email-management slash command, and the Email Management Expert skill:

claude plugin marketplace add patrickfreyer/apple-mail-mcp
claude plugin install apple-mail@apple-mail-mcp

Then restart Claude Code.

Other Install Methods

uvx (zero install, MCP server only)
claude mcp add apple-mail -- uvx mcp-apple-mail

Or for Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "apple-mail": {
      "command": "uvx",
      "args": ["mcp-apple-mail"]
    }
  }
}
pip install (MCP server only)
pip install mcp-apple-mail
claude mcp add apple-mail -- mcp-apple-mail
Claude Desktop MCPB
  1. Download the latest apple-mail-mcp-vX.Y.Z.mcpb from Releases
  2. Open Claude Desktop → Settings → Developer → MCP Servers → Install from file
  3. Select the .mcpb file and grant Mail.app permissions
Manual setup
git clone https://github.com/patrickfreyer/apple-mail-mcp.git
cd apple-mail-mcp/plugin
python3 -m venv venv
venv/bin/pip install -r requirements.txt

claude mcp add apple-mail -- /bin/bash $(pwd)/start_mcp.sh

Tools (22)

Reading & Search

ToolDescription
get_inbox_overviewDashboard with unread counts, folders, and recent emails
list_inbox_emailsList emails with account/read-status filtering and optional content preview
get_mailbox_unread_countsUnread counts per mailbox or per-account summary
list_accountsList all configured Mail accounts
search_emailsUnified search — subject, sender, body text, dates, attachments, flag status/color, cross-account
get_email_threadConversation thread view

Organization

ToolDescription
list_mailboxesFolder hierarchy with message counts
create_mailboxCreate new mailboxes (supports nested paths)
move_emailMove/archive emails with filters (subject, sender, date, read status, dry-run)
update_email_statusMark read/unread, flag/unflag (optional flag color) — by filters or message IDs
manage_trashSoft delete, permanent delete, empty trash (with dry-run)

Composition

ToolDescription
compose_emailSend new emails (plain text or HTML body)
reply_to_emailReply or reply-all with optional HTML body
forward_emailForward with optional message, CC/BCC
manage_draftsCreate, list, send, and delete drafts
create_rich_email_draftBuild a rich HTML .eml draft, open it in Mail, and optionally save it to Drafts

Attachments

ToolDescription
list_email_attachmentsList attachments with names and sizes
save_email_attachmentSave attachments to disk

Smart Inbox

ToolDescription
get_awaiting_replyFind sent emails that haven't received a reply
get_needs_responseIdentify emails that likely need your response
get_top_sendersAnalyse most frequent senders by count or domain

Analytics & Export

ToolDescription
get_statisticsEmail analytics (volume, top senders, read ratios)
export_emailsExport single emails or mailboxes to TXT/HTML
inbox_dashboardInteractive UI dashboard (requires mcp-ui-server)

Configuration

Read-Only Mode

Pass --read-only to disable tools that send email (compose_email, reply_to_email, forward_email). Draft management remains available (list, create, delete) but sending a draft via manage_drafts is blocked.

{
  "mcpServers": {
    "apple-mail": {
      "command": "/path/to/venv/bin/python3",
      "args": ["/path/to/apple_mail_mcp.py", "--read-only"]
    }
  }
}

User Preferences (Optional)

Set the USER_EMAIL_PREFERENCES environment variable to give the assistant context about your workflow:

{
  "mcpServers": {
    "apple-mail": {
      "command": "/path/to/venv/bin/python3",
      "args": ["/path/to/apple_mail_mcp.py"],
      "env": {
        "USER_EMAIL_PREFERENCES": "Default to BCG account, show max 50 emails, prefer Archive and Projects folders"
      }
    }
  }
}

For .mcpb installs, configure this in Claude Desktop under Developer > MCP Servers > Apple Mail MCP.

Safety Limits

Batch operations have conservative defaults to prevent accidental bulk actions:

OperationDefault Limit
update_email_status10 emails
manage_trash5 emails
move_email1 email

Override via function parameters when needed.

Usage Examples

Show me an overview of my inbox
Search for emails about "project update" in my Gmail
Reply to the email about "Domain name" with "Thanks for the update!"
Move emails with "invoice" in the subject to my Archive folder
Show me email statistics for the last 30 days
Create a rich HTML draft for a weekly update and open it in Mail

Rich HTML Drafts

Use create_rich_email_draft when you need a visually formatted email, newsletter, or leadership update.

  • It generates an unsent .eml file with multipart plain-text + HTML bodies
  • It can open the draft directly in Mail for editing
  • It can optionally ask Mail to save the opened compose window into Drafts
  • It accepts partial details, so you can start with just an account and subject and fill in the rest later

This is more reliable than injecting raw HTML into AppleScript content, which Mail often stores as literal markup.

Email Management Skill

A companion Claude Code Skill is included that teaches Claude expert email workflows (Inbox Zero, daily triage, folder organization). When installed as a plugin, the skill is loaded automatically. For standalone MCP installs, copy it manually:

cp -r plugin/skills/email-management ~/.claude/skills/email-management

Requirements

  • macOS with Apple Mail configured
  • Python 3.7+
  • fastmcp (+ optional mcp-ui-server for dashboard)
  • Claude Desktop or any MCP-compatible client
  • Mail.app permissions: Automation + Mail Data Access (grant in System Settings > Privacy & Security > Automation)

Troubleshooting

IssueFix
Mail.app not respondingEnsure Mail.app is running; check Automation permissions in System Settings
Slow searchesSet include_content: false and lower max_results
Mailbox not foundUse exact folder names; nested folders use / separator (e.g., Projects/Alpha)
Permission errorsGrant access in System Settings > Privacy & Security > Automation
Rich draft shows raw HTMLUse create_rich_email_draft instead of pasting HTML into manage_drafts or AppleScript content

Project Structure

apple-mail-mcp/
├── .claude-plugin/
│   └── marketplace.json       # Marketplace manifest (for plugin distribution)
├── plugin/                    # Claude Code plugin
│   ├── .claude-plugin/
│   │   └── plugin.json        # Plugin manifest
│   ├── skills/                # Email Management Expert skill (also invocable as /email-management)
│   ├── apple_mail_mcp/        # Python MCP server package (24 tools)
│   ├── apple_mail_mcp.py      # Entry point
│   ├── start_mcp.sh           # Startup wrapper (auto-creates venv)
│   └── requirements.txt
├── apple-mail-mcpb/           # MCPB build files (Claude Desktop)
├── LICENSE
└── README.md

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Commit and push
  4. Open a Pull Request

Releasing

Follow these steps when cutting a new release to keep all version strings in sync:

  1. Bump __version__ in plugin/apple_mail_mcp/__init__.py to the new version.
  2. Update apple-mail-mcpb/manifest.json ("version" field) to match.
  3. Update pyproject.toml (version = ... under [project]) to match.
  4. Update both version fields in server.json ("version" and "packages"[0]["version"]) to match.
  5. Run python3 scripts/check_versions.py — it must print OK before you proceed.
  6. Commit, tag, and push: git tag vX.Y.Z && git push origin vX.Y.Z.
  7. Create a GitHub release from the tag.
  8. Build and publish to PyPI: python -m build && twine upload dist/* (requires PyPI credentials).

The test suite also enforces version consistency (tests/test_version_consistency.py), so any CI run on a branch with mismatched versions will fail fast.

License

MIT -- see LICENSE.

Links

Files in the repo

Repository payload13 top-level entries
  • .claude-plugin
  • .github
  • apple-mail-mcpb
  • plugin
  • scripts
  • tests
  • .gitignore
  • CHANGELOG.md
  • LICENSE
  • pyproject.toml
  • README.md
  • RELEASING.md
  • server.json

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface

86k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
noskillish/
bankmcp

BankMCP™: your AI can now read your bank. Self-hosted, read-only MCP server for your own bank accounts via open banking (Enable Banking). Standard MCP; tested with Claude and Ollama.

177

Open-source auth gateway connecting 1400+ SaaS providers to AI agents through SDK, CLI, MCP, HTTP, and OpenAPI.

5.7k

Open-source 3D architectural editor with a local CLI, MCP tools, and practical workflows for humans and AI agents.

23k
cinderline/
northcinder

Open-source MCP server for comparing products and asking the buyer before purchase.

1.2k