Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/androidua/apple-mail-mcp/claude-mdgit clone --depth 1 https://github.com/androidua/apple-mail-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/androidua/apple-mail-mcp/claude-md)<a href="https://agentmods.dev/instructions/androidua/apple-mail-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/androidua/apple-mail-mcp/claude-md.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.02316 | $0.02316 |
| Opus 5 | $0.01158 | $0.01158 |
| Sonnet 5 | $0.00463 | $0.00463 |
| Haiku 4.5 | $0.00232 | $0.00232 |
Grade A, and why
apple-mail-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 135 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md — Apple Mail MCP Server
Project overview
Read-only Apple Mail MCP server. Exposes three tools to Claude Desktop via stdio transport. Uses AppleScript via subprocess — no third-party email libraries, no network calls.
Commands
# Start the server manually (for testing)
venv/bin/python apple_mail_mcp.py
# Syntax check
venv/bin/python -m py_compile apple_mail_mcp.py && echo "OK"
# Run the unit test suite (pure functions — no live Mail needed)
venv/bin/python -m pytest -q
# Reinstall dependencies into a fresh venv (runtime + dev)
python3 -m venv venv
venv/bin/pip install -r requirements.txt -r requirements-dev.txt
# Freeze current deps (after adding a new package)
venv/bin/pip freeze > requirements.txt
Architecture
Single file: all server logic lives in apple_mail_mcp.py. Do not split into multiple files.
Transport: stdio only. The server never opens a network socket.
AppleScript execution:
- Run via
asyncio.create_subprocess_exec("osascript", "-e", script) - 60-second async timeout with
proc.kill()on expiry - All user strings pass through
_sanitize_for_applescript()before embedding - Line continuation: AppleScript uses
¬(U+00AC), NOT\. When scripts are passed viaosascript -e, the parser is strict — a\at end of line produces error -2741 ("Expected expression but found unknown token"). Always use sequential assignment statements instead of multi-line expressions.
Search strategy (mail_search_emails):
- Pipeline (v1.3.0): each mailbox emits up to
limitnewest matches (per-mailbox cap, NOT per-account) → Python_parse_search_rows()parses the delimited rows →_merge_results()dedups by(account, message_id), sorts newest-first, truncates tolimit. This replaced the old "concatenate per-account outputs, truncate at limit in account order" loop, which let the first responding account fill the whole result list and silently drop other accounts (bug B1). Any message in the true global top-limitis within the newestlimitof its own mailbox, so per-mailbox collection + global sort is exact. - Sortable timestamp: each row carries a relative-seconds field
(date received) - refDate, whererefDate = (current date)is captured once at script start. It is always a small negative integer. Never emit absolute epochs — AppleScript mangles large integers (32-bit/scientific-notation hazard); relative seconds avoid that and need no GMT correction._parse_search_rowsreads it viaint(float(...)). - Skip list (default):
Trash, Deleted Messages, Deleted Items, Junk, Junk Email, Junk E-mail, Spam, Bulk Mail, Bulk, All Mail, [Gmail]All Mail, Important, Starred, Outbox. Covers real-world junk/trash names across iCloud/Yahoo/Gmail/Hotmail plus Gmail duplicate-view mailboxes (fixes B2/B3).include_all_mailboxes=trueopts back in; an explicitmailbox_namebypasses the skip list. whoseclause builds its predicate dynamically from active filters (keyword,since_days,before_days). Whywhoseinstead ofsearch: Mail 16 (macOS 26) removed thesearch <mailbox> for <keyword>command.whoseis O(n) per mailbox at the Objective-C layer (~0.5–1.5k msgs/sec) — it fully materialises the match list before the per-mailbox cap applies. Lowlimitreduces output size, not scan cost. Because there is no global early-exit anymore, all non-skipped mailboxes are scanned; date-only wide-window searches are the slow case.before_daysbounds the near edge of the window (date received <= (current date) - (N * days)); requiressince_daysand must be< since_days(enforced by the validator). Use it to page older mail without re-fetching.- Multi-account parallel execution: when no
accountfilter is set, the tool first calls_SCRIPT_LIST_ACCOUNTSto enumerate accounts, then runs one search script per account viaasyncio.gather(return_exceptions=True)with a 45 s per-account timeout. A slow/offline IMAP account cannot block or crash results from other accounts. Timed-out accounts are listed as a warning in the response. - When
accountis specified, a single script runs with a 60 s timeout (no gather overhead). - Do NOT call
proc.stdout.close()orproc.stderr.close()on timeout —asyncio.StreamReaderhas no.close()method. Use onlyproc.kill()+await proc.wait().
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 135 lines · 2,316 tokens per session scan A f5893f55a65e
apple-mail-mcp CLAUDE.md is an instructions file published in the GitHub repository androidua/apple-mail-mcp (0 stars, last pushed 1mo ago), licensed MIT. It adds 2,316 tokens to every session, about $0.0116 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
deepseek-harness AGENTS.md
AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.