@aidalinfo/icloud-mcp
v0.1.0
Published
iCloud Drive MCP server over rclone — one confined folder, browse/search/read/download, recent changes, readonly mode and two-step confirmed overwrites, moves and deletes
Downloads
334
Maintainers
Readme
@aidalinfo/icloud-mcp
MCP server giving bots access to one folder of an iCloud Drive, through
rclone (backend iclouddrive, rclone ≥ 1.69).
Apple publishes no API for iCloud Drive: rclone speaks the same private web API
as icloud.com, handles the 2FA and keeps the session.
Built for "a colleague's folder the bots must follow": browse it, search it, read or download its files, and ask what changed since X to refresh what the bot knows.
Tools
| Tool | Mode | Purpose |
|---|---|---|
| icloud_status | read | Folder, mode, rclone version, live check of the Apple session |
| icloud_list | read | List a folder (depth up to 10) |
| icloud_search | read | Find files/folders by name (case and accent insensitive) |
| icloud_changes | read | Files added or modified since 24h, 7d, 2w or a date, newest first |
| icloud_info | read | Size, modification time, type of one item |
| icloud_read_text | read | Inline a text file (capped, refuses binaries) |
| icloud_download | read | Copy a file (PDF, image, Office…) to the transfer directory, return its local path |
| icloud_mkdir | readwrite | Create a folder |
| icloud_write_text | readwrite | Create a text file; overwriting = two steps |
| icloud_upload | readwrite | Upload a file from the transfer directory; overwriting = two steps |
| icloud_move | readwrite | Move / rename — two steps |
| icloud_delete | readwrite | Delete a file or a whole folder — two steps |
ICLOUD_MODE=readonly (the default) hides every write tool.
Two steps: without confirmToken the tool only previews and returns a token (HMAC, per
process, 5 min, single use) bound to the exact arguments and to the state of the targets
(size, modification time; for a folder, its file count and total size). If the file changed in
between, the token is refused and the preview must be run again. Same scheme as email-mcp and
m365-mcp.
Confinement: every path is relative to ICLOUD_ROOT; .. is refused, a leading / means the
root, the root itself can be neither moved nor deleted. Uploads only read files inside
ICLOUD_TRANSFER_DIR (symlinks resolved), so a bot cannot push arbitrary host files to iCloud.
icloud_changes limits: it relies on modification times, so it reports additions and
modifications, not deletions. A file moved without being modified keeps its old date.
Configuration
| Variable | Default | |
|---|---|---|
| ICLOUD_ROOT | — (required) | Folder inside iCloud Drive, e.g. Documents/Dossier partagé. / = the whole drive (avoid). |
| ICLOUD_RCLONE_REMOTE | icloud | Name of the rclone remote |
| ICLOUD_MODE | readonly | readonly or readwrite |
| ICLOUD_TRANSFER_DIR | $TMPDIR/icloud-mcp | Where downloads land (downloads/<iCloud path>) and uploads must come from |
| ICLOUD_MAX_DOWNLOAD_BYTES | 500 MiB | Larger files are refused |
| ICLOUD_TIMEOUT_MS | 120000 | Per rclone call |
| RCLONE_BIN | rclone | Path to the rclone binary |
| RCLONE_CONFIG | rclone's default | rclone reads it directly; the file must stay writable (rclone refreshes the session cookies in it) |
Setting up the account (once, by a human)
On the iPhone of the account owner: Settings → [name] → iCloud → "Access iCloud Data on the Web" must be ON. If Advanced Data Protection is on, Apple will also ask for an approval on a trusted device during the setup.
On the bot host:
rclone version # ≥ 1.69
rclone config # n → name "icloud" → type "iclouddrive"
# apple_id, password (the normal one: app-specific passwords are refused)
# then the 2FA code shown on the owner's device (or "sms")
rclone lsd "icloud:" # check: lists the top folders
rclone lsjson "icloud:Documents/Dossier partagé" | head # check the folder to exposeThe owner of the account must be present for the 2FA code. Store the rclone config on the host
only (never in the repo); its password is obscured, not encrypted — protect the file
(chmod 600) or use rclone config encryption.
Every 30 days: renew the session
Apple's trust token lasts 30 days. When it expires, the tools answer auth_expired and the
bots are told to stop and call a human. Then, with the account owner available for the code:
rclone config reconnect icloud:Put a reminder in the calendar (every ~25 days) rather than waiting for the error.
Usage
claude mcp add icloud --scope user \
-e ICLOUD_RCLONE_REMOTE=icloud \
-e ICLOUD_ROOT="Documents/Dossier partagé" \
-e ICLOUD_MODE=readonly \
-e ICLOUD_TRANSFER_DIR=/var/lib/icloud-mcp \
-- npx -y @aidalinfo/icloud-mcpSeveral folders or accounts = several instances (one remote and one ICLOUD_ROOT each), so each
bot only sees what it needs.
Typical refresh loop for a bot: icloud_changes { since: "24h" } once a day (or since its last
run), then icloud_read_text / icloud_download on what changed.
Writes are logged as one JSON line per change on stderr ([icloud-mcp] {"tool":…}), without
file contents.
