My iCloud Mail as an MCP server for Claude. It can list folders, search, read messages and their attachments, save drafts, move and flag. It can't send mail and can't permanently delete anything.
Links
Why it's built this way
- No sending, no delete. Email is untrusted input, so a prompt injection hidden in one can at worst leave a draft for me to review, or move a message to Trash, which iCloud keeps for 30 days.
- Reading changes nothing. Folders open read-only and bodies are fetched without marking them read.
- Hidden text is stripped. HTML is reduced to plain text without link targets, and text a reader would never see (hidden, zero-size, off-screen) is dropped, since that's where instructions aimed at an AI usually hide.
- Attachments are read safely. Images, PDFs, Word, Excel and PowerPoint files become something Claude can read, with limits against decompression bombs, and PDFs parsed in a separate, time- and memory-capped process.
- Stateless. No database and no sessions: each call opens its own IMAP connection and logs out.
- Replies read like Mail's. Drafts thread, quote and address the way Apple Mail's Reply does.
