Skip to main content
Glama
nurked

imail-mcp

by nurked

imail-mcp

πŸ‡·πŸ‡Ί ДокумСнтация Π½Π° русском: README.ru.md

An MCP server that connects Claude (Cowork / Claude Code / Claude Desktop) to your email account so it can read, search, send, and organize your mail β€” directly from a conversation.

iCloud Mail is the first supported provider. The internals are written against a provider-agnostic interface, so Gmail / Microsoft 365 adapters can be added later without touching a single tool.


Highlights

  • πŸ“₯ Read & search β€” list folders, search by sender/subject/text/date, read full messages and whole threads, download attachments.

  • βœ‰οΈ Send & reply β€” compose, reply, reply-all, and forward with correct threading headers set automatically.

  • πŸ—‚οΈ Organize β€” move, archive, delete, and mark messages read/unread or flagged.

  • πŸ”’ Credentials stay local β€” stored in the macOS Keychain, never in a plaintext file or env var.

  • πŸ›‘ Never sends silently β€” Claude is instructed to always preview an email and get your explicit approval before anything leaves your outbox.


Related MCP server: mcp-imap-server

Why a one-time setup (and no "Sign in with Apple" button)

Apple does not offer an OAuth / consent flow for third-party access to iCloud Mail. The only supported path is standard IMAP + SMTP with an app-specific password (required because every iCloud account uses 2FA).

So setup is a one-time step: generate that password once, hand it to the server, done. It is verified with a live IMAP login and then stored in your macOS Keychain β€” not on disk, not in your shell profile.

Platform note: credential storage uses the built-in macOS security CLI, so the server currently targets macOS. (A different keystore backend is all that's needed to support Linux/Windows.)


Install & connect

Requires Node.js β‰₯ 18.

git clone git@github.com:nurked/icloud-mail-mcp.git
cd icloud-mail-mcp
npm install
npm run build
npm run setup          # or: node dist/bin/setup.js

setup opens a local page at http://127.0.0.1:4577 (bound to localhost only β€” never exposed off your machine). The page:

  1. Links you to Apple's app-specific password page.

  2. Takes your iCloud address + the 16-character password you generate.

  3. Does a live IMAP test login to verify it works.

  4. Saves the credentials to your Keychain.

Generating the app-specific password

  1. Open appleid.apple.com β†’ Sign-In and Security β†’ App-Specific Passwords.

  2. Click Generate an app-specific password, name it imail-mcp.

  3. Copy the 16-character password and paste it into the setup page.


Wire it into Claude

Add the server to your MCP config (Claude Desktop / Cowork / Claude Code mcpServers):

{
  "mcpServers": {
    "imail": {
      "command": "node",
      "args": ["/absolute/path/to/icloud-mail-mcp/dist/index.js"]
    }
  }
}

If you install the package globally (npm link or npm i -g), you can use "command": "imail-mcp" with no args instead.

Restart Claude and the imail tools become available.


Tools

Tool

What it does

list_mailboxes

List folders with their IMAP paths and special-use roles

search_messages

Search by from / to / subject / text / date / unread (filters AND together)

get_message

Full headers, text + HTML body, attachment metadata

get_thread

The whole conversation, oldest β†’ newest

download_attachment

Save an attachment to a temp file, return its path

compose_preview

Build an email for review β€” does not send

send_email

Send now (only after your approval)

save_draft

Put it in Drafts for you to send yourself

reply

Reply / reply-all, threading headers set from the original

forward

Forward to new recipients with a quoted header

move_message

Move a message to another mailbox

set_flags

Mark read/unread, flag/unflag

archive_message

Move to Archive

delete_message

Move to Trash (expunge if already there)

Sending is never silent

The server ships an instruction telling Claude to always show you a compose_preview and get your explicit go-ahead before calling send_email (or reply / forward). If you'd rather send it yourself, ask Claude to save_draft instead and the message lands in your Drafts folder.


How it works

Claude  ──stdio──▢  imail-mcp  ──IMAP (imap.mail.me.com:993)──▢  iCloud
                       β”‚        └─SMTP (smtp.mail.me.com:587)──▢  iCloud
                       └─ credentials ◀── macOS Keychain
  • IMAP (imapflow) handles reading and organizing; SMTP (nodemailer) handles sending; bodies are parsed with mailparser.

  • The provider connects lazily on the first tool call, so adding the server to Claude doesn't touch your mailbox until you actually use it.

  • The MCP stdio transport owns stdout, so all logging goes to stderr to keep the protocol stream clean.

Project layout

src/
  index.ts              MCP server + tool definitions
  bin/setup.ts          `imail-mcp-setup` entry point
  auth/
    setup-server.ts     local connect page + live IMAP verification
    keychain.ts         macOS Keychain storage (via `security` CLI)
  providers/
    types.ts            provider-agnostic MailProvider contract
    icloud.ts           iCloud IMAP/SMTP implementation

Adding another provider

The tools only ever talk to the MailProvider interface, so a new backend is one new file:

  1. Implement MailProvider (see src/providers/types.ts) in a new file under src/providers/.

  2. Select it in src/index.ts.

The tools stay unchanged.


Troubleshooting

  • "No iCloud credentials found" β€” run npm run setup first; the server reads from the Keychain on first tool use.

  • "Login failed" during setup β€” make sure you used an app-specific password, not your normal Apple ID password.

  • Re-connecting / changing accounts β€” just run npm run setup again; it overwrites the stored credentials (-U update) after a fresh verification.


License

PolyForm Noncommercial License 1.0.0 β€” this is source-available, not OSI open source.

  • βœ… Free for any noncommercial purpose β€” personal use, study, research, hobby projects, and use by nonprofits, schools, and government bodies.

  • βœ… You may read, modify, and redistribute it; the copyright notice must stay intact, so your work is always credited.

  • πŸ’Ό Commercial use requires a separate license. If you want to use imail-mcp to make money β€” in a product, a paid service, or inside a for-profit company β€” contact Investment Fidelity Company at ceo@investmentfidelity.company to arrange a commercial license.

See LICENSE.md for the full terms.

Install Server
F
license - not found
B
quality
B
maintenance

Maintenance

–Maintainers
–Response time
–Release cycle
–Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nurked/icloud-mail-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server