icloud-mcp 1.9.0 โ 2.2.0
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.
- package/.claude/settings.local.json +26 -0
- package/.mcp.json.example +12 -0
- package/README.md +146 -48
- package/index.js +334 -1561
- package/lib/imap.js +1944 -0
- package/lib/mime.js +134 -0
- package/lib/session.js +28 -0
- package/lib/smtp.js +220 -0
- package/package.json +3 -2
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"mcp__icloud-mail__list_mailboxes",
|
|
5
|
+
"mcp__icloud-mail__get_top_senders",
|
|
6
|
+
"mcp__icloud-mail__get_unread_senders",
|
|
7
|
+
"mcp__icloud-mail__get_storage_report",
|
|
8
|
+
"mcp__icloud-mail__get_mailbox_summary",
|
|
9
|
+
"mcp__icloud-mail__create_mailbox",
|
|
10
|
+
"mcp__icloud-mail__bulk_move",
|
|
11
|
+
"mcp__icloud-mail__delete_mailbox",
|
|
12
|
+
"mcp__icloud-mail__get_inbox_summary",
|
|
13
|
+
"mcp__icloud-mail__abandon_move",
|
|
14
|
+
"mcp__icloud-mail__search_emails",
|
|
15
|
+
"mcp__icloud-mail__count_emails",
|
|
16
|
+
"mcp__icloud-mail__archive_older_than",
|
|
17
|
+
"mcp__icloud-mail__bulk_move_by_sender",
|
|
18
|
+
"mcp__icloud-mail__get_move_status",
|
|
19
|
+
"mcp__icloud-mail__bulk_move_by_domain"
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"enableAllProjectMcpServers": true,
|
|
23
|
+
"enabledMcpjsonServers": [
|
|
24
|
+
"icloud-mail"
|
|
25
|
+
]
|
|
26
|
+
}
|
package/README.md
CHANGED
|
@@ -1,24 +1,30 @@
|
|
|
1
1
|
# icloud-mcp
|
|
2
2
|
|
|
3
|
-
A Model Context Protocol (MCP) server that connects Claude
|
|
3
|
+
A Model Context Protocol (MCP) server that connects Claude to your iCloud Mail account. Read, search, organize, send, and automate your inbox directly through Claude.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- ๐ฌ Read and paginate through
|
|
8
|
-
- ๐ Search emails by keyword, sender, date range, and more
|
|
7
|
+
- ๐ฌ Read and paginate through any mailbox
|
|
8
|
+
- ๐ Search emails by keyword, sender, subject, body, date range, and more
|
|
9
|
+
- ๐งต Find email threads by References/In-Reply-To chain
|
|
10
|
+
- โ๏ธ Send emails, reply, forward, and save drafts via iCloud SMTP
|
|
11
|
+
- ๐ Create saved rules to auto-route emails on demand
|
|
9
12
|
- ๐๏ธ Bulk delete emails by any combination of filters
|
|
10
|
-
- ๐ Bulk move emails between folders with
|
|
11
|
-
-
|
|
13
|
+
- ๐ Bulk move emails between folders with safe copy-verify-delete
|
|
14
|
+
- ๐ฆ Archive emails older than N days to any folder
|
|
15
|
+
- ๐ Analyze top senders and storage usage to identify inbox clutter
|
|
12
16
|
- ๐ข Count emails matching any filter before taking action
|
|
13
17
|
- โ
Mark emails as read/unread, flag/unflag in bulk or individually
|
|
18
|
+
- ๐ List and download email attachments (supports paginated byte-range fetching for large files)
|
|
19
|
+
- ๐ Extract List-Unsubscribe links for AI-assisted cleanup
|
|
14
20
|
- ๐๏ธ List, create, rename, and delete mailboxes
|
|
15
21
|
- ๐ Dry run mode for bulk operations โ preview before committing
|
|
16
|
-
- ๐ Safe move โ emails are fingerprinted and verified in the destination before
|
|
22
|
+
- ๐ Safe move โ emails are fingerprinted and verified in the destination before removal from source
|
|
17
23
|
- ๐ Session logging โ Claude tracks progress across long multi-step operations
|
|
18
24
|
|
|
19
25
|
## Prerequisites
|
|
20
26
|
|
|
21
|
-
- [Claude Desktop](https://claude.ai/download)
|
|
27
|
+
- [Claude Desktop](https://claude.ai/download) or Claude Code
|
|
22
28
|
- Node.js v20 or higher
|
|
23
29
|
- An iCloud account with an app-specific password
|
|
24
30
|
|
|
@@ -76,7 +82,9 @@ All checks passed. Ready to use with Claude Desktop.
|
|
|
76
82
|
|
|
77
83
|
If any step fails, a plain-English explanation and suggested fix will be shown.
|
|
78
84
|
|
|
79
|
-
### 4.
|
|
85
|
+
### 4. Connect to Claude
|
|
86
|
+
|
|
87
|
+
#### Claude Desktop
|
|
80
88
|
|
|
81
89
|
Open your Claude Desktop config file:
|
|
82
90
|
|
|
@@ -101,6 +109,38 @@ Add the following under `mcpServers`, replacing the path with your npm root from
|
|
|
101
109
|
}
|
|
102
110
|
```
|
|
103
111
|
|
|
112
|
+
Then fully quit Claude Desktop (Cmd+Q) and reopen it.
|
|
113
|
+
|
|
114
|
+
#### Claude Code
|
|
115
|
+
|
|
116
|
+
Run this command once to register the server for your user account (available across all projects):
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
claude mcp add icloud-mail \
|
|
120
|
+
--scope user \
|
|
121
|
+
-e IMAP_USER=you@icloud.com \
|
|
122
|
+
-e IMAP_PASSWORD=your-app-specific-password \
|
|
123
|
+
-- node $(npm root -g)/icloud-mcp/index.js
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Or use `npx` to avoid needing a global install:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
claude mcp add icloud-mail \
|
|
130
|
+
--scope user \
|
|
131
|
+
-e IMAP_USER=you@icloud.com \
|
|
132
|
+
-e IMAP_PASSWORD=your-app-specific-password \
|
|
133
|
+
-- npx -y icloud-mcp
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Verify it registered correctly:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
claude mcp list
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
> **Running from source?** Copy `.mcp.json.example` to `.mcp.json`, set your credentials in your shell, then run `claude` from the repo directory. Claude Code will pick up the config automatically.
|
|
143
|
+
|
|
104
144
|
### 5. Add Custom Instructions (Recommended)
|
|
105
145
|
|
|
106
146
|
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:
|
|
@@ -114,51 +154,110 @@ When using icloud-mail tools:
|
|
|
114
154
|
5. If you are ever unsure what you have done so far, call log_read before proceeding
|
|
115
155
|
```
|
|
116
156
|
|
|
117
|
-
### 6.
|
|
157
|
+
### 6. Start using it
|
|
158
|
+
|
|
159
|
+
You're all set. Try asking Claude:
|
|
160
|
+
|
|
161
|
+
- *"Show me the top senders in my iCloud inbox"*
|
|
162
|
+
- *"How many unread emails do I have?"*
|
|
118
163
|
|
|
119
|
-
|
|
164
|
+
## Available Tools (55)
|
|
120
165
|
|
|
121
|
-
|
|
166
|
+
### Read & Search
|
|
122
167
|
|
|
123
168
|
| Tool | Description |
|
|
124
169
|
|------|-------------|
|
|
125
170
|
| `get_inbox_summary` | Total, unread, and recent email counts for INBOX |
|
|
126
171
|
| `get_mailbox_summary` | Total, unread, and recent email counts for any folder |
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
172
|
+
| `list_mailboxes` | List all folders in your iCloud Mail |
|
|
173
|
+
| `read_inbox` | Paginated inbox with sender, subject, date (supports unread filter) |
|
|
174
|
+
| `get_email` | Full email content by UID โ MIME-aware, returns body + attachments list; supports `maxChars`, `includeHeaders` |
|
|
175
|
+
| `get_email_raw` | Raw RFC 2822 source as base64 (headers + MIME body, 1 MB cap) |
|
|
131
176
|
| `get_emails_by_sender` | All emails from a specific address |
|
|
132
177
|
| `get_emails_by_date_range` | Emails between two dates |
|
|
133
|
-
| `search_emails` | Search by keyword with
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
141
|
-
| `
|
|
142
|
-
|
|
178
|
+
| `search_emails` | Search by keyword with filters; supports `subjectQuery`, `bodyQuery`, `fromQuery`, `queryMode` (and/or), `includeSnippet` |
|
|
179
|
+
| `get_thread` | Find all emails in the same thread (subject + References/In-Reply-To matching) |
|
|
180
|
+
| `count_emails` | Count emails matching any combination of filters |
|
|
181
|
+
| `get_top_senders` | Top senders by volume from a sample of recent emails |
|
|
182
|
+
| `get_unread_senders` | Top senders of unread emails |
|
|
183
|
+
| `get_storage_report` | Estimate storage usage by size bucket and identify top large-email senders |
|
|
184
|
+
| `get_unsubscribe_info` | Extract List-Unsubscribe links (email + URL) from an email |
|
|
185
|
+
| `list_attachments` | List all attachments in an email (filename, MIME type, size, partId) |
|
|
186
|
+
| `get_attachment` | Download an attachment as base64 (max 20 MB); supports `offset`/`length` for paginated byte-range fetching |
|
|
187
|
+
|
|
188
|
+
### Send & Draft
|
|
189
|
+
|
|
190
|
+
| Tool | Description |
|
|
191
|
+
|------|-------------|
|
|
192
|
+
| `compose_email` | Send a new email via iCloud SMTP; supports plain text, HTML, cc, bcc, replyTo |
|
|
193
|
+
| `reply_to_email` | Reply to an email with correct In-Reply-To + References threading; supports `replyAll` |
|
|
194
|
+
| `forward_email` | Forward an email with an optional prepended note |
|
|
195
|
+
| `save_draft` | Save a draft to your Drafts folder without sending; supports plain text and HTML |
|
|
196
|
+
|
|
197
|
+
### Write
|
|
198
|
+
|
|
199
|
+
| Tool | Description |
|
|
200
|
+
|------|-------------|
|
|
143
201
|
| `flag_email` | Flag or unflag a single email |
|
|
144
202
|
| `mark_as_read` | Mark a single email as read or unread |
|
|
145
203
|
| `delete_email` | Move an email to Deleted Messages |
|
|
146
|
-
| `move_email` | Move a single email to
|
|
204
|
+
| `move_email` | Move a single email to any folder |
|
|
205
|
+
|
|
206
|
+
### Bulk Operations
|
|
207
|
+
|
|
208
|
+
| Tool | Description |
|
|
209
|
+
|------|-------------|
|
|
210
|
+
| `bulk_move` | Move emails matching any combination of filters (safe copy-verify-delete); supports `dryRun`, `limit` |
|
|
211
|
+
| `bulk_move_by_sender` | Move all emails from a sender to a folder; supports `dryRun` |
|
|
212
|
+
| `bulk_move_by_domain` | Move all emails from a domain to a folder; supports `dryRun` |
|
|
213
|
+
| `archive_older_than` | Safely move emails older than N days to an archive folder; supports `dryRun` |
|
|
214
|
+
| `bulk_delete` | Delete emails matching any combination of filters; supports `dryRun` |
|
|
215
|
+
| `bulk_delete_by_sender` | Delete all emails from a sender |
|
|
216
|
+
| `bulk_delete_by_subject` | Delete all emails matching a subject keyword |
|
|
147
217
|
| `delete_older_than` | Delete all emails older than N days |
|
|
148
|
-
| `
|
|
218
|
+
| `bulk_mark_read` | Mark all (or all from a sender) as read |
|
|
219
|
+
| `bulk_mark_unread` | Mark all (or all from a sender) as unread |
|
|
220
|
+
| `mark_older_than_read` | Mark all unread emails older than N days as read |
|
|
221
|
+
| `bulk_flag` | Flag or unflag emails matching any combination of filters |
|
|
222
|
+
| `bulk_flag_by_sender` | Flag or unflag all emails from a specific sender |
|
|
223
|
+
| `empty_trash` | Permanently delete all emails in trash; supports `dryRun` |
|
|
224
|
+
|
|
225
|
+
### Mailbox Management
|
|
226
|
+
|
|
227
|
+
| Tool | Description |
|
|
228
|
+
|------|-------------|
|
|
149
229
|
| `create_mailbox` | Create a new folder |
|
|
150
230
|
| `rename_mailbox` | Rename an existing folder |
|
|
151
231
|
| `delete_mailbox` | Delete a folder (must be empty first) |
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
232
|
+
|
|
233
|
+
### Move Tracking
|
|
234
|
+
|
|
235
|
+
| Tool | Description |
|
|
236
|
+
|------|-------------|
|
|
237
|
+
| `get_move_status` | Check the status of the current or most recent bulk move; includes stale warning for operations >24h old |
|
|
238
|
+
| `abandon_move` | Abandon an in-progress move so a new one can start |
|
|
239
|
+
|
|
240
|
+
### Saved Rules
|
|
241
|
+
|
|
242
|
+
| Tool | Description |
|
|
243
|
+
|------|-------------|
|
|
244
|
+
| `create_rule` | Create a named rule with filters + action (move/delete/mark_read/mark_unread/flag/unflag) |
|
|
245
|
+
| `list_rules` | List all saved rules with last-run time and run count |
|
|
246
|
+
| `run_rule` | Run a specific rule by name; supports `dryRun` |
|
|
247
|
+
| `run_all_rules` | Run all saved rules in sequence; supports `dryRun` |
|
|
248
|
+
| `delete_rule` | Delete a saved rule by name |
|
|
249
|
+
|
|
250
|
+
### Session Log
|
|
251
|
+
|
|
252
|
+
| Tool | Description |
|
|
253
|
+
|------|-------------|
|
|
155
254
|
| `log_write` | Write a step to the session log |
|
|
156
|
-
| `log_read` | Read the session log
|
|
255
|
+
| `log_read` | Read the session log |
|
|
157
256
|
| `log_clear` | Clear the session log and start fresh |
|
|
158
257
|
|
|
159
|
-
##
|
|
258
|
+
## Filters
|
|
160
259
|
|
|
161
|
-
`bulk_move`, `bulk_delete`, `bulk_flag`, `search_emails`,
|
|
260
|
+
`bulk_move`, `bulk_delete`, `bulk_flag`, `search_emails`, `count_emails`, and rules all accept any combination of these filters:
|
|
162
261
|
|
|
163
262
|
| Filter | Type | Description |
|
|
164
263
|
|--------|------|-------------|
|
|
@@ -171,36 +270,35 @@ Fully quit Claude Desktop (Cmd+Q) and reopen it. You should now be able to manag
|
|
|
171
270
|
| `flagged` | boolean | `true` for flagged only, `false` for unflagged only |
|
|
172
271
|
| `larger` | number | Only emails larger than this size in KB |
|
|
173
272
|
| `smaller` | number | Only emails smaller than this size in KB |
|
|
174
|
-
| `hasAttachment` | boolean | Only emails with attachments |
|
|
175
|
-
|
|
176
|
-
## Dry Run Mode
|
|
177
|
-
|
|
178
|
-
Pass `dryRun: true` to `bulk_move` or `bulk_delete` to preview how many emails would be affected without making any changes:
|
|
179
|
-
|
|
180
|
-
> *"How many emails would be deleted if I removed everything from linkedin.com before 2022?"*
|
|
273
|
+
| `hasAttachment` | boolean | Only emails with attachments (requires narrow pre-filters โ scans up to 500 candidates) |
|
|
181
274
|
|
|
182
275
|
## Safe Move
|
|
183
276
|
|
|
184
|
-
All bulk move operations
|
|
277
|
+
All bulk move operations (`bulk_move`, `bulk_move_by_sender`, `bulk_move_by_domain`, `archive_older_than`) use a three-phase copy-verify-delete approach:
|
|
185
278
|
|
|
186
|
-
|
|
279
|
+
1. **Copy** โ all emails are copied to the destination in chunks
|
|
280
|
+
2. **Verify** โ every email is fingerprinted and confirmed present in the destination
|
|
281
|
+
3. **Delete** โ source emails are removed in a single EXPUNGE only after verification passes
|
|
187
282
|
|
|
188
|
-
|
|
283
|
+
A persistent manifest at `~/.icloud-mcp-move-manifest.json` tracks progress so a crash or dropped connection never results in data loss. Use `get_move_status` to inspect any operation and `abandon_move` to clear a stuck one.
|
|
189
284
|
|
|
190
285
|
## Example Usage
|
|
191
286
|
|
|
192
287
|
Once configured, you can ask Claude things like:
|
|
193
288
|
|
|
194
289
|
- *"Show me the top senders in my iCloud inbox"*
|
|
290
|
+
- *"What's eating the most storage in my inbox?"*
|
|
195
291
|
- *"How many unread emails do I have from substack.com?"*
|
|
196
|
-
- *"
|
|
292
|
+
- *"Find all emails in this thread and summarize the conversation"*
|
|
197
293
|
- *"Move all emails from substack.com older than 2023 to my Newsletters folder"*
|
|
294
|
+
- *"Archive everything in my inbox older than 1 year"*
|
|
198
295
|
- *"Delete all unread emails from linkedin.com before 2022"*
|
|
199
|
-
- *"
|
|
200
|
-
- *"
|
|
296
|
+
- *"What's the unsubscribe link for this newsletter?"*
|
|
297
|
+
- *"Show me the 3 largest attachments in my inbox this month"*
|
|
201
298
|
- *"Flag all unread emails from my bank"*
|
|
202
|
-
- *"
|
|
203
|
-
- *"
|
|
299
|
+
- *"Create a rule that moves all emails from spotify.com to bulk-mail/services"*
|
|
300
|
+
- *"Reply to the last email from John and cc Sarah"*
|
|
301
|
+
- *"Draft a follow-up email to the team about the Q1 report"*
|
|
204
302
|
|
|
205
303
|
## Security
|
|
206
304
|
|