mac-mail-mcp 0.4.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.
@@ -0,0 +1,48 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ dist/
9
+ lib/
10
+ lib64/
11
+ parts/
12
+ sdist/
13
+ var/
14
+ wheels/
15
+ .installed.cfg
16
+
17
+ # Virtual environments
18
+ .venv/
19
+ venv/
20
+
21
+ # Testing
22
+ .coverage
23
+ .coverage.*
24
+ htmlcov/
25
+ .pytest_cache/
26
+
27
+ # Ruff
28
+ .ruff_cache/
29
+
30
+ # OS
31
+ .DS_Store
32
+
33
+ # Local config
34
+ .env
35
+ .env.local
36
+ *.local.md
37
+
38
+ # MkDocs
39
+ site/
40
+
41
+ # MCP Registry
42
+ mcp-publisher
43
+ .mcpregistry_*
44
+
45
+ # Benchmarks (regenerable outputs)
46
+ benchmarks/results/*.json
47
+ benchmarks/results/*.html
48
+ /benchmark_*.png
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.4
2
+ Name: mac-mail-mcp
3
+ Version: 0.4.0
4
+ Summary: Mac Mail MCP server with full-coverage FTS5 body search. Reliable on large mailboxes where AppleScript-based servers timeout.
5
+ Project-URL: Homepage, https://github.com/wagamama/apple-app-mcp
6
+ Project-URL: Documentation, https://wagamama.github.io/apple-app-mcp/
7
+ Project-URL: Repository, https://github.com/wagamama/apple-app-mcp
8
+ Project-URL: Issues, https://github.com/wagamama/apple-app-mcp/issues
9
+ Project-URL: Changelog, https://github.com/wagamama/apple-app-mcp/blob/main/CHANGELOG.md
10
+ Author-email: Ioan-Mihail Dinu <iodinu@icloud.com>
11
+ License-Expression: GPL-3.0-or-later
12
+ Keywords: anthropic,apple-mail,claude,claude-code,claude-desktop,email,emlx,fts5,full-text-search,llm,mac-mail-mcp,macos,mcp,model-context-protocol,search
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: MacOS X
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
17
+ Classifier: Operating System :: MacOS
18
+ Classifier: Programming Language :: JavaScript
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Communications :: Email
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.11
26
+ Requires-Dist: authlib>=1.6.11
27
+ Requires-Dist: beautifulsoup4>=4.12
28
+ Requires-Dist: cryptography>=46.0.7
29
+ Requires-Dist: cyclopts>=4.10
30
+ Requires-Dist: fastmcp<4,>=3.2.0
31
+ Requires-Dist: idna>=3.15
32
+ Requires-Dist: pyjwt>=2.12.0
33
+ Requires-Dist: python-dotenv>=1.2.2
34
+ Requires-Dist: python-multipart>=0.0.27
35
+ Requires-Dist: requests>=2.33.0
36
+ Requires-Dist: selectolax>=0.4.8
37
+ Requires-Dist: starlette>=1.0.1
38
+ Requires-Dist: urllib3>=2.7.0
39
+ Provides-Extra: watch
40
+ Requires-Dist: watchfiles>=1.0; extra == 'watch'
41
+ Description-Content-Type: text/markdown
42
+
43
+ # Mac Mail MCP
44
+
45
+ <!-- mcp-name: io.github.wagamama/mac-mail-mcp -->
46
+
47
+ <p align="center">
48
+ <img src="../../docs/assets/social-card.svg" alt="Mac Mail MCP — Full-coverage FTS5 body search" width="720">
49
+ </p>
50
+
51
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
52
+ [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
53
+ [![macOS](https://img.shields.io/badge/platform-macOS-lightgrey.svg)](https://www.apple.com/macos/)
54
+ [![MCP](https://img.shields.io/badge/MCP-compatible-green.svg)](https://modelcontextprotocol.io/)
55
+ [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
56
+ [![CI](https://github.com/wagamama/apple-app-mcp/actions/workflows/lint.yml/badge.svg)](https://github.com/wagamama/apple-app-mcp/actions/workflows/lint.yml)
57
+
58
+ The only Mac Mail MCP server with **full-coverage body search** — reliable on large mailboxes where AppleScript-based servers timeout. 8 tools for reading, searching, and extracting email content.
59
+
60
+ **[Read the docs](https://wagamama.github.io/apple-app-mcp/)** for the full guide.
61
+
62
+ ## Quick Start
63
+
64
+ ```bash
65
+ pipx install mac-mail-mcp
66
+ ```
67
+
68
+ Add to your MCP client:
69
+
70
+ ```json
71
+ {
72
+ "mcpServers": {
73
+ "mail": {
74
+ "command": "mac-mail-mcp"
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ ### Build the Search Index (Recommended)
81
+
82
+ ```bash
83
+ # Requires Full Disk Access for Terminal
84
+ # System Settings → Privacy & Security → Full Disk Access → Add Terminal
85
+
86
+ mac-mail-mcp index --verbose
87
+ ```
88
+
89
+ ### Configure (Optional)
90
+
91
+ ```bash
92
+ mac-mail-mcp init # writes ~/.mac-mail-mcp/config.toml
93
+ ```
94
+
95
+ Writes a commented config file you can edit to set defaults like your
96
+ primary account or mailbox. Every key has a matching `APPLE_MAIL_*` env
97
+ var if you prefer environment-based config. See
98
+ [Configuration](https://wagamama.github.io/apple-app-mcp/configuration/)
99
+ for the full schema and precedence rules.
100
+
101
+ ## Tools
102
+
103
+ | Tool | Purpose |
104
+ |------|---------|
105
+ | `list_accounts()` | List email accounts |
106
+ | `list_mailboxes(account?)` | List mailboxes |
107
+ | `get_emails(filter?, limit?)` | Get emails — all, unread, flagged, today, last_7_days |
108
+ | `get_email(message_id)` | Get single email with full content + attachments |
109
+ | `search(query, scope?, before?, after?, highlight?)` | Search — all, subject, sender, body, attachments |
110
+ | `get_email_links(message_id)` | Extract links from an email |
111
+ | `get_email_attachment(message_id, filename)` | Extract attachment content |
112
+ | `get_attachment(message_id, filename)` | *Deprecated* — use `get_email_attachment()` |
113
+
114
+ ## Performance
115
+
116
+ Tested against [6 other Mac Mail MCP servers](https://wagamama.github.io/apple-app-mcp/benchmarks/) on a real **~73K-message** mailbox:
117
+
118
+ - **Only server with full-coverage body search.** Most competitors don't support body search at all; the one that does (BastianZim) live-scans only the 5000 most recent messages — silent miss on anything older. Our FTS5 index covers the entire mailbox.
119
+ - **~3ms single email fetch** via disk-first `.emlx` reading (no JXA round-trip).
120
+ - **~1ms `list_accounts` and ~5ms 50-email listing** via direct Envelope-Index SQLite reads (0.4+) — same path BastianZim/rusty/pl-lyfx use, with JXA as the correctness fallback.
121
+ - **~7ms subject search** via FTS5 — competitive with native Rust on the same operation.
122
+ - **Reliable across all 6 benchmarked operations** on a 73K mailbox; AppleScript-based servers timeout, throw syntax errors, or skip operations they don't support.
123
+
124
+ ![Capability Matrix](../../docs/benchmark_overview.png)
125
+
126
+ ## Configuration
127
+
128
+ Mac Mail MCP works out of the box. To customize defaults, run
129
+ `mac-mail-mcp init` to generate a `config.toml` template — or use
130
+ the matching `APPLE_MAIL_*` environment variables. See the
131
+ [Configuration docs](https://wagamama.github.io/apple-app-mcp/configuration/)
132
+ for the full schema and the CLI > env > file > default precedence.
133
+
134
+ Per-client env overrides via the MCP client's launch config also work:
135
+
136
+ ```json
137
+ {
138
+ "mcpServers": {
139
+ "mail": {
140
+ "command": "mac-mail-mcp",
141
+ "args": ["--watch"],
142
+ "env": {
143
+ "APPLE_MAIL_DEFAULT_ACCOUNT": "Work"
144
+ }
145
+ }
146
+ }
147
+ }
148
+ ```
149
+
150
+ ## CLI Usage
151
+
152
+ All tools are also available as standalone CLI commands (no MCP server needed):
153
+
154
+ ```bash
155
+ mac-mail-mcp search "quarterly report" --scope subject
156
+ mac-mail-mcp search "invoice" --after 2026-01-01 --limit 10
157
+ mac-mail-mcp read 12345
158
+ mac-mail-mcp emails --filter unread --limit 10
159
+ mac-mail-mcp accounts
160
+ mac-mail-mcp mailboxes --account Work
161
+ mac-mail-mcp extract 12345 invoice.pdf
162
+ ```
163
+
164
+ All commands output JSON. Generate a [Claude Code skill](https://wagamama.github.io/apple-app-mcp/configuration/#cli-commands) for CLI-based access:
165
+
166
+ ```bash
167
+ mac-mail-mcp integrate claude > "$HOME/.claude/skills/mac-mail.md"
168
+ ```
169
+
170
+ ## Development
171
+
172
+ ```bash
173
+ git clone https://github.com/wagamama/apple-app-mcp
174
+ cd apple-app-mcp
175
+ uv sync
176
+ uv run ruff check packages/mac-mail-mcp/src
177
+ uv run --package mac-mail-mcp pytest packages/mac-mail-mcp/tests
178
+ ```
179
+
180
+ ## License
181
+
182
+ GPL-3.0-or-later
@@ -0,0 +1,140 @@
1
+ # Mac Mail MCP
2
+
3
+ <!-- mcp-name: io.github.wagamama/mac-mail-mcp -->
4
+
5
+ <p align="center">
6
+ <img src="../../docs/assets/social-card.svg" alt="Mac Mail MCP — Full-coverage FTS5 body search" width="720">
7
+ </p>
8
+
9
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
10
+ [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
11
+ [![macOS](https://img.shields.io/badge/platform-macOS-lightgrey.svg)](https://www.apple.com/macos/)
12
+ [![MCP](https://img.shields.io/badge/MCP-compatible-green.svg)](https://modelcontextprotocol.io/)
13
+ [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
14
+ [![CI](https://github.com/wagamama/apple-app-mcp/actions/workflows/lint.yml/badge.svg)](https://github.com/wagamama/apple-app-mcp/actions/workflows/lint.yml)
15
+
16
+ The only Mac Mail MCP server with **full-coverage body search** — reliable on large mailboxes where AppleScript-based servers timeout. 8 tools for reading, searching, and extracting email content.
17
+
18
+ **[Read the docs](https://wagamama.github.io/apple-app-mcp/)** for the full guide.
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ pipx install mac-mail-mcp
24
+ ```
25
+
26
+ Add to your MCP client:
27
+
28
+ ```json
29
+ {
30
+ "mcpServers": {
31
+ "mail": {
32
+ "command": "mac-mail-mcp"
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ### Build the Search Index (Recommended)
39
+
40
+ ```bash
41
+ # Requires Full Disk Access for Terminal
42
+ # System Settings → Privacy & Security → Full Disk Access → Add Terminal
43
+
44
+ mac-mail-mcp index --verbose
45
+ ```
46
+
47
+ ### Configure (Optional)
48
+
49
+ ```bash
50
+ mac-mail-mcp init # writes ~/.mac-mail-mcp/config.toml
51
+ ```
52
+
53
+ Writes a commented config file you can edit to set defaults like your
54
+ primary account or mailbox. Every key has a matching `APPLE_MAIL_*` env
55
+ var if you prefer environment-based config. See
56
+ [Configuration](https://wagamama.github.io/apple-app-mcp/configuration/)
57
+ for the full schema and precedence rules.
58
+
59
+ ## Tools
60
+
61
+ | Tool | Purpose |
62
+ |------|---------|
63
+ | `list_accounts()` | List email accounts |
64
+ | `list_mailboxes(account?)` | List mailboxes |
65
+ | `get_emails(filter?, limit?)` | Get emails — all, unread, flagged, today, last_7_days |
66
+ | `get_email(message_id)` | Get single email with full content + attachments |
67
+ | `search(query, scope?, before?, after?, highlight?)` | Search — all, subject, sender, body, attachments |
68
+ | `get_email_links(message_id)` | Extract links from an email |
69
+ | `get_email_attachment(message_id, filename)` | Extract attachment content |
70
+ | `get_attachment(message_id, filename)` | *Deprecated* — use `get_email_attachment()` |
71
+
72
+ ## Performance
73
+
74
+ Tested against [6 other Mac Mail MCP servers](https://wagamama.github.io/apple-app-mcp/benchmarks/) on a real **~73K-message** mailbox:
75
+
76
+ - **Only server with full-coverage body search.** Most competitors don't support body search at all; the one that does (BastianZim) live-scans only the 5000 most recent messages — silent miss on anything older. Our FTS5 index covers the entire mailbox.
77
+ - **~3ms single email fetch** via disk-first `.emlx` reading (no JXA round-trip).
78
+ - **~1ms `list_accounts` and ~5ms 50-email listing** via direct Envelope-Index SQLite reads (0.4+) — same path BastianZim/rusty/pl-lyfx use, with JXA as the correctness fallback.
79
+ - **~7ms subject search** via FTS5 — competitive with native Rust on the same operation.
80
+ - **Reliable across all 6 benchmarked operations** on a 73K mailbox; AppleScript-based servers timeout, throw syntax errors, or skip operations they don't support.
81
+
82
+ ![Capability Matrix](../../docs/benchmark_overview.png)
83
+
84
+ ## Configuration
85
+
86
+ Mac Mail MCP works out of the box. To customize defaults, run
87
+ `mac-mail-mcp init` to generate a `config.toml` template — or use
88
+ the matching `APPLE_MAIL_*` environment variables. See the
89
+ [Configuration docs](https://wagamama.github.io/apple-app-mcp/configuration/)
90
+ for the full schema and the CLI > env > file > default precedence.
91
+
92
+ Per-client env overrides via the MCP client's launch config also work:
93
+
94
+ ```json
95
+ {
96
+ "mcpServers": {
97
+ "mail": {
98
+ "command": "mac-mail-mcp",
99
+ "args": ["--watch"],
100
+ "env": {
101
+ "APPLE_MAIL_DEFAULT_ACCOUNT": "Work"
102
+ }
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## CLI Usage
109
+
110
+ All tools are also available as standalone CLI commands (no MCP server needed):
111
+
112
+ ```bash
113
+ mac-mail-mcp search "quarterly report" --scope subject
114
+ mac-mail-mcp search "invoice" --after 2026-01-01 --limit 10
115
+ mac-mail-mcp read 12345
116
+ mac-mail-mcp emails --filter unread --limit 10
117
+ mac-mail-mcp accounts
118
+ mac-mail-mcp mailboxes --account Work
119
+ mac-mail-mcp extract 12345 invoice.pdf
120
+ ```
121
+
122
+ All commands output JSON. Generate a [Claude Code skill](https://wagamama.github.io/apple-app-mcp/configuration/#cli-commands) for CLI-based access:
123
+
124
+ ```bash
125
+ mac-mail-mcp integrate claude > "$HOME/.claude/skills/mac-mail.md"
126
+ ```
127
+
128
+ ## Development
129
+
130
+ ```bash
131
+ git clone https://github.com/wagamama/apple-app-mcp
132
+ cd apple-app-mcp
133
+ uv sync
134
+ uv run ruff check packages/mac-mail-mcp/src
135
+ uv run --package mac-mail-mcp pytest packages/mac-mail-mcp/tests
136
+ ```
137
+
138
+ ## License
139
+
140
+ GPL-3.0-or-later
@@ -0,0 +1,82 @@
1
+ [project]
2
+ name = "mac-mail-mcp"
3
+ version = "0.4.0"
4
+ description = "Mac Mail MCP server with full-coverage FTS5 body search. Reliable on large mailboxes where AppleScript-based servers timeout."
5
+ readme = "README.md"
6
+ license = "GPL-3.0-or-later"
7
+ requires-python = ">=3.11"
8
+ authors = [
9
+ { name = "Ioan-Mihail Dinu", email = "iodinu@icloud.com" },
10
+ ]
11
+ keywords = [
12
+ "anthropic",
13
+ "apple-mail",
14
+ "mac-mail-mcp",
15
+ "claude",
16
+ "claude-code",
17
+ "claude-desktop",
18
+ "email",
19
+ "emlx",
20
+ "fts5",
21
+ "full-text-search",
22
+ "llm",
23
+ "macos",
24
+ "mcp",
25
+ "model-context-protocol",
26
+ "search",
27
+ ]
28
+ classifiers = [
29
+ "Development Status :: 4 - Beta",
30
+ "Environment :: MacOS X",
31
+ "Intended Audience :: Developers",
32
+ "License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
33
+ "Operating System :: MacOS",
34
+ "Programming Language :: JavaScript",
35
+ "Programming Language :: Python :: 3",
36
+ "Programming Language :: Python :: 3.11",
37
+ "Programming Language :: Python :: 3.12",
38
+ "Programming Language :: Python :: 3.13",
39
+ "Topic :: Communications :: Email",
40
+ "Topic :: Software Development :: Libraries :: Python Modules",
41
+ ]
42
+ dependencies = [
43
+ "authlib>=1.6.11",
44
+ "cryptography>=46.0.7",
45
+ "fastmcp>=3.2.0,<4",
46
+ "idna>=3.15",
47
+ "pyjwt>=2.12.0",
48
+ "python-dotenv>=1.2.2",
49
+ "python-multipart>=0.0.27",
50
+ "requests>=2.33.0",
51
+ "starlette>=1.0.1",
52
+ "urllib3>=2.7.0",
53
+ "cyclopts>=4.10",
54
+ "beautifulsoup4>=4.12",
55
+ "selectolax>=0.4.8",
56
+ ]
57
+
58
+ [project.optional-dependencies]
59
+ watch = ["watchfiles>=1.0"]
60
+
61
+ [project.urls]
62
+ Homepage = "https://github.com/wagamama/apple-app-mcp"
63
+ Documentation = "https://wagamama.github.io/apple-app-mcp/"
64
+ Repository = "https://github.com/wagamama/apple-app-mcp"
65
+ Issues = "https://github.com/wagamama/apple-app-mcp/issues"
66
+ Changelog = "https://github.com/wagamama/apple-app-mcp/blob/main/CHANGELOG.md"
67
+
68
+ [project.scripts]
69
+ mac-mail-mcp = "apple_mail_mcp:main"
70
+
71
+ [tool.hatch.build.targets.wheel]
72
+ packages = ["src/apple_mail_mcp"]
73
+
74
+ [tool.hatch.build.targets.sdist]
75
+ include = ["src/"]
76
+
77
+ [tool.hatch.build]
78
+ artifacts = ["src/**/*.js", "src/**/py.typed"]
79
+
80
+ [build-system]
81
+ requires = ["hatchling"]
82
+ build-backend = "hatchling.build"
@@ -0,0 +1,22 @@
1
+ """Mac Mail MCP — full-coverage FTS5 body search for Apple Mail.
2
+
3
+ Features:
4
+ - Disk-first email reading (~3ms via .emlx parsing, no JXA needed)
5
+ - Full-text body search via FTS5 index (~2ms with BM25 ranking)
6
+ - Reliable on large mailboxes (tested at ~72K messages) where
7
+ AppleScript-based servers time out
8
+
9
+ Usage:
10
+ mac-mail-mcp # Run MCP server (default)
11
+ mac-mail-mcp serve -r # Run in read-only mode
12
+ mac-mail-mcp --watch # Run with real-time index updates
13
+ mac-mail-mcp init # Write a config.toml template
14
+ mac-mail-mcp index # Build search index from disk
15
+ mac-mail-mcp status # Show index statistics
16
+ mac-mail-mcp rebuild # Force rebuild index
17
+ """
18
+
19
+ from .cli import main
20
+ from .server import mcp
21
+
22
+ __all__ = ["main", "mcp"]