Connect Claude to your iCloud Mail, Contacts, and Calendar
icloud-mcp
A Model Context Protocol (MCP) server that connects Claude to your iCloud account โ Mail, Contacts, and Calendar. Read, search, organize, send, and automate across the full iCloud suite.
Features
- ๐ฌ Read and paginate through any mailbox
- ๐ Search emails by keyword, sender, subject, body, date range, and more
- ๐งต Find email threads by References/In-Reply-To chain
- โ๏ธ Send emails, reply, forward, and save drafts via iCloud SMTP
- ๐ Create saved rules to auto-route emails on demand
- ๐๏ธ Bulk delete emails by any combination of filters
- ๐ Bulk move emails between folders with safe copy-verify-delete
- ๐ฆ Archive emails older than N days to any folder
- ๐ Analyze top senders and storage usage to identify inbox clutter
- ๐ข Count emails matching any filter before taking action
- โ Mark emails as read/unread, flag/unflag in bulk or individually
- ๐ List and download email attachments (supports paginated byte-range fetching for large files)
- ๐ Extract List-Unsubscribe links for AI-assisted cleanup
- ๐๏ธ List, create, rename, and delete mailboxes
- ๐ Dry run mode for bulk operations โ preview before committing
- ๐ Safe move โ emails are fingerprinted and verified in the destination before removal from source
- ๐ Session logging โ Claude tracks progress across long multi-step operations
- ๐ค Contacts โ list, search, create, update, and delete iCloud Contacts via CardDAV
- ๐ Calendar โ list calendars, query events by date, create/update/delete events via CalDAV
Prerequisites
- Claude Desktop or Claude Code
- Node.js v20 or higher
- An iCloud account with an app-specific password
Setup
1. Generate an Apple App-Specific Password
- Go to appleid.apple.com
- Sign in and navigate to Sign-In and Security โ App-Specific Passwords
- Click + to generate a new password
- Label it something like
Claude MCPand save the generated password
2. Install the package
npm install -g icloud-mcp
Then find the install location:
npm root -g
The path varies by setup:
| Setup | Typical path |
|---|---|
| Mac with Homebrew Node | /opt/homebrew/lib/node_modules |
| Mac with system Node | /usr/local/lib/node_modules |
| nvm | ~/.nvm/versions/node/v20.x.x/lib/node_modules |
3. Verify your setup
Before configuring Claude Desktop, run the doctor command to confirm everything is working:
IMAP_USER="you@icloud.com" IMAP_PASSWORD="your-app-specific-password" node $(npm root -g)/icloud-mcp/index.js --doctor
You should see:
icloud-mcp doctor
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
IMAP_USER is set
โ
IMAP_PASSWORD is set
โ
IMAP_USER looks like an email address
โ
Connected to imap.mail.me.com:993
โ
Authenticated as you@icloud.com
โ
INBOX opened (12453 messages)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
All checks passed. Ready to use with Claude Desktop.
If any step fails, a plain-English explanation and suggested fix will be shown.
4. Connect to Claude
Claude Desktop
Open your Claude Desktop config file:
open ~/Library/Application\ Support/Claude/claude_desktop_config.json
Add the following under mcpServers, replacing the path with your npm root from step 2:
{
"mcpServers": {
"icloud-mail": {
"command": "node",
"args": ["/opt/homebrew/lib/node_modules/icloud-mcp/index.js"],
"env": {
"IMAP_USER": "you@icloud.com",
"IMAP_PASSWORD": "your-app-specific-password"
}
}
}
}
Then fully quit Claude Desktop (Cmd+Q) and reopen it.
Claude Code
Run this command once to register the server for your user account (available across all projects):
claude mcp add icloud-mail \
--scope user \
-e IMAP_USER=you@icloud.com \
-e IMAP_PASSWORD=your-app-specific-password \
-- node $(npm root -g)/icloud-mcp/index.js
Or use npx to avoid needing a global install:
claude mcp add icloud-mail \
--scope user \
-e IMAP_USER=you@icloud.com \
-e IMAP_PASSWORD=your-app-specific-password \
-- npx -y icloud-mcp
Verify it registered correctly:
claude mcp list
Running from source? Copy
.mcp.json.exampleto.mcp.json, set your credentials in your shell, then runclaudefrom the repo directory. Claude Code will pick up the config automatically.
5. Add Custom Instructions (Recommended)
For large inbox operations, add the following to Claude Desktop's custom instructions to ensure Claude stays on track and checks in with you regularly. Go to Claude Desktop โ Settings โ Custom Instructions and add:
When using icloud-mail tools:
1. Before starting any multi-step operation, call log_clear then log_write with your full plan
2. After every single tool call, call log_write with what you
Tools (3)
mail_operationsRead, search, send, reply, forward, and organize emailscontact_operationsList, search, create, update, and delete iCloud Contactscalendar_operationsList calendars and query, create, update, or delete eventsEnvironment Variables
IMAP_USERrequiredYour iCloud email addressIMAP_PASSWORDrequiredYour iCloud app-specific passwordConfiguration
{"mcpServers": {"icloud-mail": {"command": "node", "args": ["/opt/homebrew/lib/node_modules/icloud-mcp/index.js"], "env": {"IMAP_USER": "you@icloud.com", "IMAP_PASSWORD": "your-app-specific-password"}}}}