mcp-apple-mail 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. mcp_apple_mail-2.2.0/.claude-plugin/marketplace.json +22 -0
  2. mcp_apple_mail-2.2.0/.gitignore +48 -0
  3. mcp_apple_mail-2.2.0/LICENSE +21 -0
  4. mcp_apple_mail-2.2.0/PKG-INFO +303 -0
  5. mcp_apple_mail-2.2.0/README.md +277 -0
  6. mcp_apple_mail-2.2.0/apple-mail-mcpb/build-mcpb.sh +333 -0
  7. mcp_apple_mail-2.2.0/apple-mail-mcpb/manifest.json +149 -0
  8. mcp_apple_mail-2.2.0/claude_desktop_config_example.json +10 -0
  9. mcp_apple_mail-2.2.0/email-management-skill.zip +0 -0
  10. mcp_apple_mail-2.2.0/plugin/.claude-plugin/plugin.json +18 -0
  11. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/__init__.py +19 -0
  12. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/__main__.py +34 -0
  13. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/constants.py +31 -0
  14. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/core.py +346 -0
  15. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/server.py +14 -0
  16. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/tools/__init__.py +0 -0
  17. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/tools/analytics.py +787 -0
  18. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/tools/compose.py +1487 -0
  19. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/tools/inbox.py +632 -0
  20. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/tools/manage.py +852 -0
  21. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/tools/search.py +735 -0
  22. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp/tools/smart_inbox.py +581 -0
  23. mcp_apple_mail-2.2.0/plugin/apple_mail_mcp.py +6 -0
  24. mcp_apple_mail-2.2.0/plugin/commands/email-management.md +16 -0
  25. mcp_apple_mail-2.2.0/plugin/requirements.txt +2 -0
  26. mcp_apple_mail-2.2.0/plugin/skills/email-management/README.md +259 -0
  27. mcp_apple_mail-2.2.0/plugin/skills/email-management/SKILL.md +345 -0
  28. mcp_apple_mail-2.2.0/plugin/skills/email-management/examples/email-triage.md +387 -0
  29. mcp_apple_mail-2.2.0/plugin/skills/email-management/examples/folder-organization.md +655 -0
  30. mcp_apple_mail-2.2.0/plugin/skills/email-management/examples/inbox-zero-workflow.md +286 -0
  31. mcp_apple_mail-2.2.0/plugin/skills/email-management/templates/common-workflows.md +824 -0
  32. mcp_apple_mail-2.2.0/plugin/skills/email-management/templates/search-patterns.md +796 -0
  33. mcp_apple_mail-2.2.0/plugin/start_mcp.sh +43 -0
  34. mcp_apple_mail-2.2.0/plugin/ui/__init__.py +4 -0
  35. mcp_apple_mail-2.2.0/plugin/ui/dashboard.py +64 -0
  36. mcp_apple_mail-2.2.0/plugin/ui/templates/dashboard.html +849 -0
  37. mcp_apple_mail-2.2.0/pyproject.toml +52 -0
  38. mcp_apple_mail-2.2.0/tests/test_bulk_helpers.py +95 -0
  39. mcp_apple_mail-2.2.0/tests/test_compose_tools.py +91 -0
  40. mcp_apple_mail-2.2.0/tests/test_mail_search_tools.py +255 -0
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "apple-mail-mcp",
3
+ "owner": {
4
+ "name": "Patrick Freyer",
5
+ "email": "freyer.patrick@bcg.com"
6
+ },
7
+ "metadata": {
8
+ "description": "Apple Mail MCP — natural language email management for Claude Code",
9
+ "version": "1.0.0"
10
+ },
11
+ "plugins": [
12
+ {
13
+ "name": "apple-mail",
14
+ "source": "./plugin",
15
+ "description": "Natural language interface for Apple Mail — search, compose, triage, organize, and analyze email with 24 MCP tools and an expert email management skill",
16
+ "version": "3.1.0",
17
+ "author": {
18
+ "name": "Patrick Freyer"
19
+ }
20
+ }
21
+ ]
22
+ }
@@ -0,0 +1,48 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+ *.egg
11
+
12
+ # Virtual Environment
13
+ venv/
14
+ env/
15
+ ENV/
16
+ .venv
17
+
18
+ # IDE
19
+ .vscode/
20
+ .idea/
21
+ *.swp
22
+ *.swo
23
+ *~
24
+
25
+ # macOS
26
+ .DS_Store
27
+ .AppleDouble
28
+ .LSOverride
29
+ ._*
30
+
31
+ # MCP Development
32
+ .mcp.json
33
+ .claude/settings.local.json
34
+ .claude/worktrees/
35
+ docs/superpowers/plans/
36
+
37
+ # Build artifacts
38
+ apple-mail-mcpb/build/
39
+ *.mcpb
40
+
41
+ # Archive
42
+ archive/
43
+
44
+ # Logs
45
+ *.log
46
+
47
+ # Personal configuration examples (keep templates only)
48
+ claude_desktop_config.json
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Patrick Freyer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,303 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-apple-mail
3
+ Version: 2.2.0
4
+ Summary: MCP server giving AI assistants full access to Apple Mail - read, search, compose, organize & analyze emails
5
+ Project-URL: Homepage, https://github.com/patrickfreyer/apple-mail-mcp
6
+ Project-URL: Repository, https://github.com/patrickfreyer/apple-mail-mcp
7
+ Project-URL: Issues, https://github.com/patrickfreyer/apple-mail-mcp/issues
8
+ Project-URL: Changelog, https://github.com/patrickfreyer/apple-mail-mcp/blob/main/CHANGELOG.md
9
+ Author: Patrick Freyer
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: ai,apple-mail,applescript,automation,claude,email,macos,mcp,mcp-server
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Communications :: Email
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: fastmcp>=3.1.0
25
+ Description-Content-Type: text/markdown
26
+
27
+ # Apple Mail MCP Server
28
+
29
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
30
+ [![PyPI](https://img.shields.io/pypi/v/apple-mail-mcp)](https://pypi.org/project/apple-mail-mcp/)
31
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
32
+ [![MCP](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io)
33
+ [![GitHub stars](https://img.shields.io/github/stars/patrickfreyer/apple-mail-mcp?style=social)](https://github.com/patrickfreyer/apple-mail-mcp/stargazers)
34
+
35
+ ## Star History
36
+
37
+ <a href="https://star-history.com/#patrickfreyer/apple-mail-mcp&Date">
38
+ <picture>
39
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=patrickfreyer/apple-mail-mcp&type=Date&theme=dark" />
40
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=patrickfreyer/apple-mail-mcp&type=Date" />
41
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=patrickfreyer/apple-mail-mcp&type=Date" />
42
+ </picture>
43
+ </a>
44
+
45
+ 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).
46
+
47
+ ## Quick Install
48
+
49
+ **Prerequisites:** macOS with Apple Mail configured, Python 3.10+
50
+
51
+ ### Claude Code Plugin (Recommended)
52
+
53
+ Two commands — gets you the MCP server, `/email-management` slash command, and the Email Management Expert skill:
54
+
55
+ ```bash
56
+ claude plugin marketplace add patrickfreyer/apple-mail-mcp
57
+ claude plugin install apple-mail@apple-mail-mcp
58
+ ```
59
+
60
+ Then restart Claude Code.
61
+
62
+ ### Other Install Methods
63
+
64
+ <details>
65
+ <summary><strong>uvx (zero install, MCP server only)</strong></summary>
66
+
67
+ ```bash
68
+ claude mcp add apple-mail -- uvx apple-mail-mcp
69
+ ```
70
+
71
+ Or for Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json`):
72
+
73
+ ```json
74
+ {
75
+ "mcpServers": {
76
+ "apple-mail": {
77
+ "command": "uvx",
78
+ "args": ["apple-mail-mcp"]
79
+ }
80
+ }
81
+ }
82
+ ```
83
+
84
+ </details>
85
+
86
+ <details>
87
+ <summary><strong>pip install (MCP server only)</strong></summary>
88
+
89
+ ```bash
90
+ pip install apple-mail-mcp
91
+ claude mcp add apple-mail -- apple-mail-mcp
92
+ ```
93
+
94
+ </details>
95
+
96
+ <details>
97
+ <summary><strong>Claude Desktop MCPB</strong></summary>
98
+
99
+ 1. Download `apple-mail-mcp-v2.2.0.mcpb` from [Releases](https://github.com/patrickfreyer/apple-mail-mcp/releases)
100
+ 2. Open Claude Desktop → Settings → Developer → MCP Servers → Install from file
101
+ 3. Select the `.mcpb` file and grant Mail.app permissions
102
+
103
+ </details>
104
+
105
+ <details>
106
+ <summary><strong>Manual setup</strong></summary>
107
+
108
+ ```bash
109
+ git clone https://github.com/patrickfreyer/apple-mail-mcp.git
110
+ cd apple-mail-mcp/plugin
111
+ python3 -m venv venv
112
+ venv/bin/pip install -r requirements.txt
113
+
114
+ claude mcp add apple-mail -- /bin/bash $(pwd)/start_mcp.sh
115
+ ```
116
+
117
+ </details>
118
+
119
+ ## Tools (22)
120
+
121
+ ### Reading & Search
122
+ | Tool | Description |
123
+ |------|-------------|
124
+ | `get_inbox_overview` | Dashboard with unread counts, folders, and recent emails |
125
+ | `list_inbox_emails` | List emails with account/read-status filtering and optional content preview |
126
+ | `get_mailbox_unread_counts` | Unread counts per mailbox or per-account summary |
127
+ | `list_accounts` | List all configured Mail accounts |
128
+ | `search_emails` | Unified search — subject, sender, body text, dates, attachments, cross-account |
129
+ | `get_email_thread` | Conversation thread view |
130
+
131
+ ### Organization
132
+ | Tool | Description |
133
+ |------|-------------|
134
+ | `list_mailboxes` | Folder hierarchy with message counts |
135
+ | `create_mailbox` | Create new mailboxes (supports nested paths) |
136
+ | `move_email` | Move/archive emails with filters (subject, sender, date, read status, dry-run) |
137
+ | `update_email_status` | Mark read/unread, flag/unflag — by filters or message IDs |
138
+ | `manage_trash` | Soft delete, permanent delete, empty trash (with dry-run) |
139
+
140
+ ### Composition
141
+ | Tool | Description |
142
+ |------|-------------|
143
+ | `compose_email` | Send new emails (plain text or HTML body) |
144
+ | `reply_to_email` | Reply or reply-all with optional HTML body |
145
+ | `forward_email` | Forward with optional message, CC/BCC |
146
+ | `manage_drafts` | Create, list, send, and delete drafts |
147
+ | `create_rich_email_draft` | Build a rich HTML `.eml` draft, open it in Mail, and optionally save it to Drafts |
148
+
149
+ ### Attachments
150
+ | Tool | Description |
151
+ |------|-------------|
152
+ | `list_email_attachments` | List attachments with names and sizes |
153
+ | `save_email_attachment` | Save attachments to disk |
154
+
155
+ ### Smart Inbox
156
+ | Tool | Description |
157
+ |------|-------------|
158
+ | `get_awaiting_reply` | Find sent emails that haven't received a reply |
159
+ | `get_needs_response` | Identify emails that likely need your response |
160
+ | `get_top_senders` | Analyse most frequent senders by count or domain |
161
+
162
+ ### Analytics & Export
163
+ | Tool | Description |
164
+ |------|-------------|
165
+ | `get_statistics` | Email analytics (volume, top senders, read ratios) |
166
+ | `export_emails` | Export single emails or mailboxes to TXT/HTML |
167
+ | `inbox_dashboard` | Interactive UI dashboard (requires mcp-ui-server) |
168
+
169
+ ## Configuration
170
+
171
+ ### Read-Only Mode
172
+
173
+ 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.
174
+
175
+ ```json
176
+ {
177
+ "mcpServers": {
178
+ "apple-mail": {
179
+ "command": "/path/to/venv/bin/python3",
180
+ "args": ["/path/to/apple_mail_mcp.py", "--read-only"]
181
+ }
182
+ }
183
+ }
184
+ ```
185
+
186
+ ### User Preferences (Optional)
187
+
188
+ Set the `USER_EMAIL_PREFERENCES` environment variable to give the assistant context about your workflow:
189
+
190
+ ```json
191
+ {
192
+ "mcpServers": {
193
+ "apple-mail": {
194
+ "command": "/path/to/venv/bin/python3",
195
+ "args": ["/path/to/apple_mail_mcp.py"],
196
+ "env": {
197
+ "USER_EMAIL_PREFERENCES": "Default to BCG account, show max 50 emails, prefer Archive and Projects folders"
198
+ }
199
+ }
200
+ }
201
+ }
202
+ ```
203
+
204
+ For `.mcpb` installs, configure this in Claude Desktop under **Developer > MCP Servers > Apple Mail MCP**.
205
+
206
+ ### Safety Limits
207
+
208
+ Batch operations have conservative defaults to prevent accidental bulk actions:
209
+
210
+ | Operation | Default Limit |
211
+ |-----------|---------------|
212
+ | `update_email_status` | 10 emails |
213
+ | `manage_trash` | 5 emails |
214
+ | `move_email` | 1 email |
215
+
216
+ Override via function parameters when needed.
217
+
218
+ ## Usage Examples
219
+
220
+ ```
221
+ Show me an overview of my inbox
222
+ Search for emails about "project update" in my Gmail
223
+ Reply to the email about "Domain name" with "Thanks for the update!"
224
+ Move emails with "invoice" in the subject to my Archive folder
225
+ Show me email statistics for the last 30 days
226
+ Create a rich HTML draft for a weekly update and open it in Mail
227
+ ```
228
+
229
+ ### Rich HTML Drafts
230
+
231
+ Use `create_rich_email_draft` when you need a visually formatted email, newsletter, or leadership update.
232
+
233
+ - It generates an unsent `.eml` file with multipart plain-text + HTML bodies
234
+ - It can open the draft directly in Mail for editing
235
+ - It can optionally ask Mail to save the opened compose window into Drafts
236
+ - It accepts partial details, so you can start with just an account and subject and fill in the rest later
237
+
238
+ This is more reliable than injecting raw HTML into AppleScript `content`, which Mail often stores as literal markup.
239
+
240
+ ## Email Management Skill
241
+
242
+ A companion [Claude Code Skill](plugin/skills/email-management/) 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:
243
+
244
+ ```bash
245
+ cp -r plugin/skills/email-management ~/.claude/skills/email-management
246
+ ```
247
+
248
+ ## Requirements
249
+
250
+ - macOS with Apple Mail configured
251
+ - Python 3.7+
252
+ - `fastmcp` (+ optional `mcp-ui-server` for dashboard)
253
+ - Claude Desktop or any MCP-compatible client
254
+ - Mail.app permissions: Automation + Mail Data Access (grant in **System Settings > Privacy & Security > Automation**)
255
+
256
+ ## Troubleshooting
257
+
258
+ | Issue | Fix |
259
+ |-------|-----|
260
+ | Mail.app not responding | Ensure Mail.app is running; check Automation permissions in System Settings |
261
+ | Slow searches | Set `include_content: false` and lower `max_results` |
262
+ | Mailbox not found | Use exact folder names; nested folders use `/` separator (e.g., `Projects/Alpha`) |
263
+ | Permission errors | Grant access in **System Settings > Privacy & Security > Automation** |
264
+ | Rich draft shows raw HTML | Use `create_rich_email_draft` instead of pasting HTML into `manage_drafts` or AppleScript `content` |
265
+
266
+ ## Project Structure
267
+
268
+ ```
269
+ apple-mail-mcp/
270
+ ├── .claude-plugin/
271
+ │ └── marketplace.json # Marketplace manifest (for plugin distribution)
272
+ ├── plugin/ # Claude Code plugin
273
+ │ ├── .claude-plugin/
274
+ │ │ └── plugin.json # Plugin manifest
275
+ │ ├── commands/ # /email-management slash command
276
+ │ ├── skills/ # Email Management Expert skill
277
+ │ ├── apple_mail_mcp/ # Python MCP server package (24 tools)
278
+ │ ├── apple_mail_mcp.py # Entry point
279
+ │ ├── start_mcp.sh # Startup wrapper (auto-creates venv)
280
+ │ └── requirements.txt
281
+ ├── apple-mail-mcpb/ # MCPB build files (Claude Desktop)
282
+ ├── LICENSE
283
+ └── README.md
284
+ ```
285
+
286
+ ## Contributing
287
+
288
+ 1. Fork the repository
289
+ 2. Create a feature branch (`git checkout -b feature/my-feature`)
290
+ 3. Commit and push
291
+ 4. Open a Pull Request
292
+
293
+ ## License
294
+
295
+ MIT -- see [LICENSE](LICENSE).
296
+
297
+ ## Links
298
+
299
+ - [Changelog](CHANGELOG.md)
300
+ - [Issues](https://github.com/patrickfreyer/apple-mail-mcp/issues)
301
+ - [Discussions](https://github.com/patrickfreyer/apple-mail-mcp/discussions)
302
+ - [FastMCP](https://github.com/jlowin/fastmcp)
303
+ - [Model Context Protocol](https://modelcontextprotocol.io)
@@ -0,0 +1,277 @@
1
+ # Apple Mail MCP Server
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+ [![PyPI](https://img.shields.io/pypi/v/apple-mail-mcp)](https://pypi.org/project/apple-mail-mcp/)
5
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
6
+ [![MCP](https://img.shields.io/badge/MCP-Compatible-green.svg)](https://modelcontextprotocol.io)
7
+ [![GitHub stars](https://img.shields.io/github/stars/patrickfreyer/apple-mail-mcp?style=social)](https://github.com/patrickfreyer/apple-mail-mcp/stargazers)
8
+
9
+ ## Star History
10
+
11
+ <a href="https://star-history.com/#patrickfreyer/apple-mail-mcp&Date">
12
+ <picture>
13
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=patrickfreyer/apple-mail-mcp&type=Date&theme=dark" />
14
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=patrickfreyer/apple-mail-mcp&type=Date" />
15
+ <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=patrickfreyer/apple-mail-mcp&type=Date" />
16
+ </picture>
17
+ </a>
18
+
19
+ 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).
20
+
21
+ ## Quick Install
22
+
23
+ **Prerequisites:** macOS with Apple Mail configured, Python 3.10+
24
+
25
+ ### Claude Code Plugin (Recommended)
26
+
27
+ Two commands — gets you the MCP server, `/email-management` slash command, and the Email Management Expert skill:
28
+
29
+ ```bash
30
+ claude plugin marketplace add patrickfreyer/apple-mail-mcp
31
+ claude plugin install apple-mail@apple-mail-mcp
32
+ ```
33
+
34
+ Then restart Claude Code.
35
+
36
+ ### Other Install Methods
37
+
38
+ <details>
39
+ <summary><strong>uvx (zero install, MCP server only)</strong></summary>
40
+
41
+ ```bash
42
+ claude mcp add apple-mail -- uvx apple-mail-mcp
43
+ ```
44
+
45
+ Or for Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json`):
46
+
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "apple-mail": {
51
+ "command": "uvx",
52
+ "args": ["apple-mail-mcp"]
53
+ }
54
+ }
55
+ }
56
+ ```
57
+
58
+ </details>
59
+
60
+ <details>
61
+ <summary><strong>pip install (MCP server only)</strong></summary>
62
+
63
+ ```bash
64
+ pip install apple-mail-mcp
65
+ claude mcp add apple-mail -- apple-mail-mcp
66
+ ```
67
+
68
+ </details>
69
+
70
+ <details>
71
+ <summary><strong>Claude Desktop MCPB</strong></summary>
72
+
73
+ 1. Download `apple-mail-mcp-v2.2.0.mcpb` from [Releases](https://github.com/patrickfreyer/apple-mail-mcp/releases)
74
+ 2. Open Claude Desktop → Settings → Developer → MCP Servers → Install from file
75
+ 3. Select the `.mcpb` file and grant Mail.app permissions
76
+
77
+ </details>
78
+
79
+ <details>
80
+ <summary><strong>Manual setup</strong></summary>
81
+
82
+ ```bash
83
+ git clone https://github.com/patrickfreyer/apple-mail-mcp.git
84
+ cd apple-mail-mcp/plugin
85
+ python3 -m venv venv
86
+ venv/bin/pip install -r requirements.txt
87
+
88
+ claude mcp add apple-mail -- /bin/bash $(pwd)/start_mcp.sh
89
+ ```
90
+
91
+ </details>
92
+
93
+ ## Tools (22)
94
+
95
+ ### Reading & Search
96
+ | Tool | Description |
97
+ |------|-------------|
98
+ | `get_inbox_overview` | Dashboard with unread counts, folders, and recent emails |
99
+ | `list_inbox_emails` | List emails with account/read-status filtering and optional content preview |
100
+ | `get_mailbox_unread_counts` | Unread counts per mailbox or per-account summary |
101
+ | `list_accounts` | List all configured Mail accounts |
102
+ | `search_emails` | Unified search — subject, sender, body text, dates, attachments, cross-account |
103
+ | `get_email_thread` | Conversation thread view |
104
+
105
+ ### Organization
106
+ | Tool | Description |
107
+ |------|-------------|
108
+ | `list_mailboxes` | Folder hierarchy with message counts |
109
+ | `create_mailbox` | Create new mailboxes (supports nested paths) |
110
+ | `move_email` | Move/archive emails with filters (subject, sender, date, read status, dry-run) |
111
+ | `update_email_status` | Mark read/unread, flag/unflag — by filters or message IDs |
112
+ | `manage_trash` | Soft delete, permanent delete, empty trash (with dry-run) |
113
+
114
+ ### Composition
115
+ | Tool | Description |
116
+ |------|-------------|
117
+ | `compose_email` | Send new emails (plain text or HTML body) |
118
+ | `reply_to_email` | Reply or reply-all with optional HTML body |
119
+ | `forward_email` | Forward with optional message, CC/BCC |
120
+ | `manage_drafts` | Create, list, send, and delete drafts |
121
+ | `create_rich_email_draft` | Build a rich HTML `.eml` draft, open it in Mail, and optionally save it to Drafts |
122
+
123
+ ### Attachments
124
+ | Tool | Description |
125
+ |------|-------------|
126
+ | `list_email_attachments` | List attachments with names and sizes |
127
+ | `save_email_attachment` | Save attachments to disk |
128
+
129
+ ### Smart Inbox
130
+ | Tool | Description |
131
+ |------|-------------|
132
+ | `get_awaiting_reply` | Find sent emails that haven't received a reply |
133
+ | `get_needs_response` | Identify emails that likely need your response |
134
+ | `get_top_senders` | Analyse most frequent senders by count or domain |
135
+
136
+ ### Analytics & Export
137
+ | Tool | Description |
138
+ |------|-------------|
139
+ | `get_statistics` | Email analytics (volume, top senders, read ratios) |
140
+ | `export_emails` | Export single emails or mailboxes to TXT/HTML |
141
+ | `inbox_dashboard` | Interactive UI dashboard (requires mcp-ui-server) |
142
+
143
+ ## Configuration
144
+
145
+ ### Read-Only Mode
146
+
147
+ 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.
148
+
149
+ ```json
150
+ {
151
+ "mcpServers": {
152
+ "apple-mail": {
153
+ "command": "/path/to/venv/bin/python3",
154
+ "args": ["/path/to/apple_mail_mcp.py", "--read-only"]
155
+ }
156
+ }
157
+ }
158
+ ```
159
+
160
+ ### User Preferences (Optional)
161
+
162
+ Set the `USER_EMAIL_PREFERENCES` environment variable to give the assistant context about your workflow:
163
+
164
+ ```json
165
+ {
166
+ "mcpServers": {
167
+ "apple-mail": {
168
+ "command": "/path/to/venv/bin/python3",
169
+ "args": ["/path/to/apple_mail_mcp.py"],
170
+ "env": {
171
+ "USER_EMAIL_PREFERENCES": "Default to BCG account, show max 50 emails, prefer Archive and Projects folders"
172
+ }
173
+ }
174
+ }
175
+ }
176
+ ```
177
+
178
+ For `.mcpb` installs, configure this in Claude Desktop under **Developer > MCP Servers > Apple Mail MCP**.
179
+
180
+ ### Safety Limits
181
+
182
+ Batch operations have conservative defaults to prevent accidental bulk actions:
183
+
184
+ | Operation | Default Limit |
185
+ |-----------|---------------|
186
+ | `update_email_status` | 10 emails |
187
+ | `manage_trash` | 5 emails |
188
+ | `move_email` | 1 email |
189
+
190
+ Override via function parameters when needed.
191
+
192
+ ## Usage Examples
193
+
194
+ ```
195
+ Show me an overview of my inbox
196
+ Search for emails about "project update" in my Gmail
197
+ Reply to the email about "Domain name" with "Thanks for the update!"
198
+ Move emails with "invoice" in the subject to my Archive folder
199
+ Show me email statistics for the last 30 days
200
+ Create a rich HTML draft for a weekly update and open it in Mail
201
+ ```
202
+
203
+ ### Rich HTML Drafts
204
+
205
+ Use `create_rich_email_draft` when you need a visually formatted email, newsletter, or leadership update.
206
+
207
+ - It generates an unsent `.eml` file with multipart plain-text + HTML bodies
208
+ - It can open the draft directly in Mail for editing
209
+ - It can optionally ask Mail to save the opened compose window into Drafts
210
+ - It accepts partial details, so you can start with just an account and subject and fill in the rest later
211
+
212
+ This is more reliable than injecting raw HTML into AppleScript `content`, which Mail often stores as literal markup.
213
+
214
+ ## Email Management Skill
215
+
216
+ A companion [Claude Code Skill](plugin/skills/email-management/) 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:
217
+
218
+ ```bash
219
+ cp -r plugin/skills/email-management ~/.claude/skills/email-management
220
+ ```
221
+
222
+ ## Requirements
223
+
224
+ - macOS with Apple Mail configured
225
+ - Python 3.7+
226
+ - `fastmcp` (+ optional `mcp-ui-server` for dashboard)
227
+ - Claude Desktop or any MCP-compatible client
228
+ - Mail.app permissions: Automation + Mail Data Access (grant in **System Settings > Privacy & Security > Automation**)
229
+
230
+ ## Troubleshooting
231
+
232
+ | Issue | Fix |
233
+ |-------|-----|
234
+ | Mail.app not responding | Ensure Mail.app is running; check Automation permissions in System Settings |
235
+ | Slow searches | Set `include_content: false` and lower `max_results` |
236
+ | Mailbox not found | Use exact folder names; nested folders use `/` separator (e.g., `Projects/Alpha`) |
237
+ | Permission errors | Grant access in **System Settings > Privacy & Security > Automation** |
238
+ | Rich draft shows raw HTML | Use `create_rich_email_draft` instead of pasting HTML into `manage_drafts` or AppleScript `content` |
239
+
240
+ ## Project Structure
241
+
242
+ ```
243
+ apple-mail-mcp/
244
+ ├── .claude-plugin/
245
+ │ └── marketplace.json # Marketplace manifest (for plugin distribution)
246
+ ├── plugin/ # Claude Code plugin
247
+ │ ├── .claude-plugin/
248
+ │ │ └── plugin.json # Plugin manifest
249
+ │ ├── commands/ # /email-management slash command
250
+ │ ├── skills/ # Email Management Expert skill
251
+ │ ├── apple_mail_mcp/ # Python MCP server package (24 tools)
252
+ │ ├── apple_mail_mcp.py # Entry point
253
+ │ ├── start_mcp.sh # Startup wrapper (auto-creates venv)
254
+ │ └── requirements.txt
255
+ ├── apple-mail-mcpb/ # MCPB build files (Claude Desktop)
256
+ ├── LICENSE
257
+ └── README.md
258
+ ```
259
+
260
+ ## Contributing
261
+
262
+ 1. Fork the repository
263
+ 2. Create a feature branch (`git checkout -b feature/my-feature`)
264
+ 3. Commit and push
265
+ 4. Open a Pull Request
266
+
267
+ ## License
268
+
269
+ MIT -- see [LICENSE](LICENSE).
270
+
271
+ ## Links
272
+
273
+ - [Changelog](CHANGELOG.md)
274
+ - [Issues](https://github.com/patrickfreyer/apple-mail-mcp/issues)
275
+ - [Discussions](https://github.com/patrickfreyer/apple-mail-mcp/discussions)
276
+ - [FastMCP](https://github.com/jlowin/fastmcp)
277
+ - [Model Context Protocol](https://modelcontextprotocol.io)