Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
6f53b5a
Merge pull request #14 from patrickfreyer/refactor/modular-mcp-personal
patrickfreyer Feb 10, 2026
e21bf6e
feat: add send parameter to reply_to_email for save-as-draft support
rhlsthrm Feb 23, 2026
8ed556c
fix reply_to_email draft saving: include quoted original message
rhlsthrm Feb 23, 2026
edae837
fix: sanitize AppleScript output to prevent JSON serialization errors
Mar 1, 2026
2b8bfe6
Merge pull request #17 from intivalderas/fix/sanitize-applescript-out…
patrickfreyer Mar 10, 2026
0e08da4
Merge pull request #16 from rhlsthrm/feat/reply-save-as-draft
patrickfreyer Mar 10, 2026
c887fac
fix: escape newlines and tabs in escape_applescript()
patrickfreyer Mar 10, 2026
b477bc0
fix: add safety guards for destructive email operations
patrickfreyer Mar 10, 2026
a6707a4
fix: cap entire_mailbox export with max_emails parameter
patrickfreyer Mar 10, 2026
178c126
fix: pin dependency versions in requirements.txt
patrickfreyer Mar 10, 2026
c08eb15
docs: add v1.6.1 security fixes to CHANGELOG
patrickfreyer Mar 10, 2026
f4652b2
Merge pull request #20 from patrickfreyer/fix/security-issues-19-v2
patrickfreyer Mar 10, 2026
6f84223
refactor: extract common AppleScript patterns into reusable helpers (…
patrickfreyer Mar 10, 2026
43f27bb
feat: add JSON output format option to key tools (#9)
patrickfreyer Mar 10, 2026
33e2e22
feat: add create_mailbox, archive_emails, and search_emails_advanced …
patrickfreyer Mar 10, 2026
46abec1
Merge pull request #23 from patrickfreyer/feat/infrastructure-improve…
patrickfreyer Mar 10, 2026
506bf7b
feat: add bulk email operations (mark, delete, move)
patrickfreyer Mar 10, 2026
b54aeec
Merge pull request #21 from patrickfreyer/feat/bulk-operations
patrickfreyer Mar 10, 2026
e696854
feat: add smart inbox tools for follow-up tracking, response detectio…
patrickfreyer Mar 10, 2026
cf8e63f
Merge pull request #22 from patrickfreyer/feat/smart-inbox
patrickfreyer Mar 10, 2026
ae25919
feat: add attachment support to compose_email and reply_to_email
patrickfreyer Mar 10, 2026
fefb31c
Merge pull request #24 from patrickfreyer/feat/attachment-support
patrickfreyer Mar 10, 2026
901f8db
perf: replace per-message iteration with AppleScript whose clause fil…
patrickfreyer Mar 10, 2026
4d87da3
Merge pull request #25 from patrickfreyer/feat/whose-clause-perf
patrickfreyer Mar 10, 2026
1354ae7
feat: add "open" mode to compose, reply, and manage_drafts
patrickfreyer Mar 11, 2026
0a5470c
fix: use native Mail.app quoting for open mode replies
patrickfreyer Mar 11, 2026
92a3573
fix: prepend reply body to preserve quoted original in open mode
patrickfreyer Mar 11, 2026
69fdfc3
fix: use System Events keystroke for open mode replies
patrickfreyer Mar 11, 2026
5a0bc15
chore: update manifest.json to v2.0.0 with all 35 tools
patrickfreyer Mar 11, 2026
34aa7ae
feat: add HTML email support via NSPasteboard clipboard injection
patrickfreyer Mar 11, 2026
a4af837
fix: use temp files for reply body to prevent AppleScript syntax errors
patrickfreyer Mar 12, 2026
fc26c6d
fix: move body search to native whose clause to prevent timeouts
patrickfreyer Mar 12, 2026
2c17706
chore: update manifest and imports for consolidated search tool
patrickfreyer Mar 12, 2026
7415013
fix: add missing 'and' in AppleScript reply-to-all syntax
patrickfreyer Mar 13, 2026
74dd7eb
Add --read-only flag to disable email sending tools
aicayzer Mar 10, 2026
d295032
Merge pull request #26 from aicayzer/feat/read-only-flag
patrickfreyer Mar 18, 2026
1b2f07e
fix: use HTML picture element for star history chart on GitHub
patrickfreyer Mar 22, 2026
fa72f44
feat: add rich draft workflow and structured mail search
Mar 22, 2026
687f9d3
fix: add path validation to export_emails to prevent directory traversal
jzkelter Mar 23, 2026
bdb924a
Merge pull request #27 from kkugot/feat/rich-draft-structured-search
patrickfreyer Mar 23, 2026
1d3fc7f
Fix: preserve Unicode in MCP output instead of forcing ASCII
na-bal Mar 26, 2026
45a9dce
Merge pull request #28 from jzkelter/fix/add-path-validation-to-expor…
patrickfreyer Mar 27, 2026
196214a
Merge pull request #29 from na-bal/fix/cyrillic-support
patrickfreyer Mar 27, 2026
562f857
chore: remove CHANGELOG.md
patrickfreyer Mar 27, 2026
59d5a05
fix: preserve email thread history in reply and forward operations
patrickfreyer Mar 27, 2026
2ba97ad
Merge pull request #32 from patrickfreyer/fix/reply-preserves-email-h…
patrickfreyer Mar 27, 2026
df38814
refactor: consolidate 10 search tools into 2 (search_emails + get_ema…
patrickfreyer Mar 28, 2026
a4643ef
refactor: consolidate inbox tools — merge get_recent_emails and get_u…
patrickfreyer Mar 28, 2026
5c3e058
refactor: consolidate manage + bulk tools — remove bulk.py, merge int…
patrickfreyer Mar 28, 2026
299fb91
refactor: trim verbose tool responses to reduce token waste
patrickfreyer Mar 28, 2026
c7c5101
chore: cleanup unused imports and update README tool listing
patrickfreyer Mar 28, 2026
ffaaf2a
fix: remove Cmd+A before HTML paste to preserve attachments
gerryke Apr 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .claude/worktrees/agent-a88053b6
Submodule agent-a88053b6 added at ae2591
235 changes: 0 additions & 235 deletions CHANGELOG.md

This file was deleted.

72 changes: 54 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@

## Star History

[![Star History Chart](https://api.star-history.com/svg?repos=patrickfreyer/apple-mail-mcp&type=Date)](https://star-history.com/#patrickfreyer/apple-mail-mcp&Date)
<a href="https://star-history.com/#patrickfreyer/apple-mail-mcp&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=patrickfreyer/apple-mail-mcp&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=patrickfreyer/apple-mail-mcp&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=patrickfreyer/apple-mail-mcp&type=Date" />
</picture>
</a>

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](https://github.com/jlowin/fastmcp).

Expand Down Expand Up @@ -39,47 +45,49 @@ Restart Claude Desktop and grant Mail.app permissions when prompted.

> **Tip:** An `.mcpb` bundle is also available on the [Releases](https://github.com/patrickfreyer/apple-mail-mcp/releases) page for one-click install in Claude Desktop.

## Tools (26)
## Tools (22)

### Reading & Search
| Tool | Description |
|------|-------------|
| `get_inbox_overview` | Dashboard with unread counts, folders, and recent emails |
| `list_inbox_emails` | List emails with account/read-status filtering |
| `get_email_with_content` | Search emails with full content preview |
| `get_unread_count` | Unread count per account |
| `list_inbox_emails` | List emails with account/read-status filtering and optional content preview |
| `get_mailbox_unread_counts` | Unread counts per mailbox or per-account summary |
| `list_accounts` | List all configured Mail accounts |
| `get_recent_emails` | Recent emails from a specific account |
| `get_recent_from_sender` | Recent emails from a sender with time-range filters |
| `search_emails` | Advanced multi-criteria search (subject, sender, dates, attachments) |
| `search_by_sender` | Find all emails from a specific sender |
| `search_email_content` | Full-text search in email bodies |
| `search_all_accounts` | Cross-account unified search |
| `get_newsletters` | Detect newsletter and subscription emails |
| `search_emails` | Unified search — subject, sender, body text, dates, attachments, cross-account |
| `get_email_thread` | Conversation thread view |

### Organization
| Tool | Description |
|------|-------------|
| `list_mailboxes` | Folder hierarchy with message counts |
| `move_email` | Move emails between folders (supports nested paths) |
| `update_email_status` | Batch mark read/unread, flag/unflag |
| `manage_trash` | Soft delete, permanent delete, empty trash |
| `create_mailbox` | Create new mailboxes (supports nested paths) |
| `move_email` | Move/archive emails with filters (subject, sender, date, read status, dry-run) |
| `update_email_status` | Mark read/unread, flag/unflag — by filters or message IDs |
| `manage_trash` | Soft delete, permanent delete, empty trash (with dry-run) |

### Composition
| Tool | Description |
|------|-------------|
| `compose_email` | Send new emails (TO, CC, BCC) |
| `reply_to_email` | Reply or reply-all with optional CC/BCC |
| `compose_email` | Send new emails (plain text or HTML body) |
| `reply_to_email` | Reply or reply-all with optional HTML body |
| `forward_email` | Forward with optional message, CC/BCC |
| `manage_drafts` | Create, list, send, and delete drafts |
| `create_rich_email_draft` | Build a rich HTML `.eml` draft, open it in Mail, and optionally save it to Drafts |

### Attachments
| Tool | Description |
|------|-------------|
| `list_email_attachments` | List attachments with names and sizes |
| `save_email_attachment` | Save attachments to disk |

### Smart Inbox
| Tool | Description |
|------|-------------|
| `get_awaiting_reply` | Find sent emails that haven't received a reply |
| `get_needs_response` | Identify emails that likely need your response |
| `get_top_senders` | Analyse most frequent senders by count or domain |

### Analytics & Export
| Tool | Description |
|------|-------------|
Expand All @@ -89,6 +97,21 @@ Restart Claude Desktop and grant Mail.app permissions when prompted.

## 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.

```json
{
"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:
Expand Down Expand Up @@ -129,8 +152,20 @@ 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](skill-email-management/) is included that teaches Claude expert email workflows (Inbox Zero, daily triage, folder organization). Install it alongside the MCP for intelligent, multi-step email management:
Expand All @@ -157,12 +192,13 @@ See [skill-email-management/README.md](skill-email-management/README.md) for det
| Slow searches | Set `include_content: false` and lower `max_results` |
| Mailbox not found | Use exact folder names; nested folders use `/` separator (e.g., `Projects/Alpha`) |
| Permission errors | Grant access in **System Settings > Privacy & Security > Automation** |
| Rich draft shows raw HTML | Use `create_rich_email_draft` instead of pasting HTML into `manage_drafts` or AppleScript `content` |

## Project Structure

```
apple-mail-mcp/
├── apple_mail_mcp.py # Main MCP server (26 tools)
├── apple_mail_mcp.py # Main MCP server (27 tools)
├── requirements.txt # Python dependencies
├── apple-mail-mcpb/ # MCP Bundle build files
├── skill-email-management/ # Email Management Expert Skill
Expand Down
Loading