apple-photos-mcp
apple-photos-mcp is a Model Context Protocol server that lets AI assistants query, search, browse, export, inspect, and (opt-in) lightly modify the macOS Apple Photos library.
Search photos with combinable filters: album, keyword, person, ML label, place, GPS radius, folder, taken/import date ranges, year, file size, media type (screenshot, selfie, panorama, live, portrait, burst, etc.), aesthetic score, OCR text, favorite/hidden flags, title/description substring
Get full photo metadata (EXIF camera data, location, albums, keywords, persons, ML score, OCR text, iCloud shared-album social data, type flags, file paths) for one UUID or a batch of up to 50
See photos inline via
get-thumbnail, returning viewable preview images without exportingRead the current Photos.app selection — turning "these photos" into UUIDs
Find exact duplicates using Photos' own fingerprint detection
Browse the library: list albums, folders, keywords, and persons; get overall library stats
Export photos to disk — originals or edited versions, optionally with live-photo video and raw files, with automatic iCloud download fallback
Run diagnostics: health-check and a six-check doctor (Python, osxphotos, sidecar, write gate, library readability, Full Disk Access)
Opt-in write tools (behind
APPLE_PHOTOS_MCP_ENABLE_WRITES=1): create albums/folders, add/remove photos from albums, set titles/descriptions/favorites, merge keywords, fix photo dates (dry-run by default), and import files — all add-only, never deletingExpose MCP resources and prompts for library context and common workflows (find, export, photo summary)
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@apple-photos-mcp Find my photos from Paris last summer"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Apple Photos MCP Server
A Model Context Protocol (MCP) server that enables AI assistants like Claude to query, search, export, and inspect the macOS Apple Photos library — plus opt-in album and metadata write tools — backed by the osxphotos library.
Read-only by default. Out of the box the library is never modified — exports write files to a directory you choose, nothing more. A set of opt-in write tools (albums, titles, descriptions, keywords, favorites, dates, imports — never deletion) unlocks only when you explicitly set
APPLE_PHOTOS_MCP_ENABLE_WRITES=1; without that flag, 2.x behaves exactly like the read-only 1.x releases.
What is This?
This server acts as a bridge between AI assistants and Apple Photos. Once configured, you can ask Claude (or any MCP-compatible AI) to:
"Find all my photos from our trip to Spain in 2023"
"Show me my favorite sunset photos" — and actually see them (
get-thumbnailreturns viewable images)"How many photos do I have? What are my top keywords?"
"Find photos of Sarah from last summer and export them to ~/Desktop/sarah-summer"
"What did I import this week?" (
addedInLast), "Find my screenshots from 2024""Do I have duplicate photos?" (
find-duplicatesgroups exact duplicates)"List my albums"
"Tell me everything about photo UUID ABC-123" — including EXIF camera data
With writes enabled: "File these into a Trailcam album", "Tag them all
deer", "Favorite the best one and caption it"
The AI assistant communicates with this server, which uses osxphotos to read the Photos library SQLite database directly. All data stays local on your machine.
Related MCP server: mcp-osxphotos
Quick Start
Using Claude Code (Easiest)
If you're using Claude Code (in Terminal or VS Code), just ask Claude to install it:
Install the sweetrb/apple-photos-mcp MCP server so you can help me query my Apple Photos libraryClaude will handle the installation and configuration automatically. Or register it yourself with one deterministic command:
claude mcp add apple-photos -s user -- npx -y apple-photos-mcpThe Python osxphotos dependency installs automatically on first use (a one-time, ~minute-long setup), so the only manual step is granting Full Disk Access — see Requirements below.
Using the Plugin Marketplace
Install as a Claude Code plugin for automatic configuration and enhanced AI behavior:
/plugin marketplace add sweetrb/apple-photos-mcp
/plugin install apple-photosThis method also installs a skill that teaches Claude when and how to use Apple Photos effectively.
A few things to know about the plugin install:
The plugin is a git clone under
~/.claude/plugins/marketplaces/apple-photos-mcp/, and the server runs straight from that clone (no build step needed).The first tool call auto-bootstraps a Python venv with
osxphotosinside that clone — a one-time, ~minute-long setup that requires Python 3.11+ on your PATH (stock macOS ships 3.9;brew install python@3.12).Full Disk Access must be granted to the HOST app running Claude Code (Terminal, iTerm, VS Code, Claude Desktop) — see Requirements below.
Using the Codex Marketplace
The same plugin is available for Codex. Add the marketplace and install the plugin:
codex plugin marketplace add sweetrb/apple-photos-mcp
codex plugin add apple-photos@apple-photos-mcpThe Codex plugin runs the published apple-photos-mcp server through npx and ships the same Apple Photos skill, so behavior matches the Claude Code plugin. Because the server is a Python-sidecar (osxphotos) server, the first tool call after an npx launch auto-bootstraps a project-local Python venv with osxphotos (a one-time, ~minute-long setup), and the host process still needs Full Disk Access — see Requirements below.
Other Hosts (Hermes, Antigravity)
Two more hosts can run the same apple-photos MCP server (npx -y apple-photos-mcp). As a Python-sidecar (osxphotos) server it also needs Full Disk Access; see Requirements.
Hermes Agent (NousResearch) — Hermes has no plugin/marketplace drop-in, so there is nothing in this repo to install from. Register the server with the CLI:
hermes mcp add apple-photos --command npx --args -y apple-photos-mcpOr add it to
~/.hermes/config.yamlby hand:mcp_servers: apple-photos: command: npx args: ["-y", "apple-photos-mcp"]Restart your Hermes session afterward so the tools load.
Antigravity (Google) — add the server entry from
.antigravity-plugin/mcp_config.jsonto~/.gemini/config/mcp_config.json(or via Antigravity's MCP settings).
Manual Installation
1. Install the server:
npm install -g apple-photos-mcp2. Python deps install automatically. The first tool call auto-bootstraps a project-local Python venv with osxphotos (a one-time setup that can take ~a minute; progress is logged to stderr). You do not need to install anything by hand.
To skip the first-call delay, you can pre-warm the venv ahead of time:
pnpm run setup # optional — pre-installs osxphotos so the first tool call is instantAuto-setup needs Python 3, pip, and network access. If any are missing — or you disabled auto-setup via APPLE_PHOTOS_MCP_NO_AUTO_SETUP=1 — run pnpm run setup (or pip3 install osxphotos) yourself. See Configuration and Troubleshooting.
3. Add to Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"apple-photos": {
"command": "npx",
"args": ["apple-photos-mcp"]
}
}
}4. Grant Full Disk Access to the app hosting the MCP server (Claude Desktop, Terminal, VS Code, etc.) — see Full Disk Access below.
5. Restart Claude Desktop and start using natural language:
"How many photos are in my library?"Requirements
macOS - The Photos library is macOS-only
Node.js 20+ - Required for the MCP server
Python 3.11+ - The server uses osxphotos under the hood and installs it automatically on first use into a project-local venv (one-time, ~a minute). You only need Python 3.11+,
pip, and a network connection available. osxphotos requires Python ≥ 3.10 and the date filters need 3.11; macOS ships 3.9, so install a newer Python first (e.g.brew install python@3.12). Pre-warm it withpnpm run setupif you'd rather not wait on the first call.Apple Photos - Must have a Photos library (default location:
~/Pictures/Photos Library.photoslibrary)Full Disk Access - The Photos library lives in a protected directory. The host app needs Full Disk Access — see below and the Full Disk Access Setup Guide.
Features
Querying
Feature | Description |
Library Stats | Total counts of photos, movies, albums, folders, keywords, persons |
Query | Search by taken-date or import-date range ( |
Photo Details | Full metadata for one photo: dimensions, location, place, EXIF camera data (make/model, lens, ISO, aperture, shutter speed, focal length), Photos' ML intelligence (aesthetic |
Batch Details |
|
Selection Bridge |
|
Thumbnails |
|
Find Duplicates |
|
List Albums | All albums with their folder paths and photo counts |
List Folders | All folders with parent and album/subfolder counts |
List Keywords | Keywords sorted by usage count |
List Persons | People detected by Photos face recognition, sorted by photo count |
Export
Feature | Description |
Export Originals | Copy original photos to a destination directory |
Export Edited | Copy the edited version instead of the original |
Live Photos | Optionally include the live-photo video alongside the still |
Raw Files | Optionally include the raw (NEF, CR2, etc.) sidecar |
Multi-photo Export | Export multiple UUIDs in a single call |
Auto iCloud Download | If an original isn't on disk, export falls back to Photos.app to download it on demand — no extra parameter needed |
Write tools (opt-in — read-only by default)
Feature | Description |
Create Album |
|
Add to Album |
|
Remove from Album |
|
Set Metadata |
|
Set Keywords |
|
Set Date |
|
Import |
|
All seven are disabled unless APPLE_PHOTOS_MCP_ENABLE_WRITES=1 — see Write tools (opt-in). None of them can delete a photo.
Diagnostics
Feature | Description |
Health Check | Verify osxphotos is installed and the library can be opened |
Doctor | Richer setup diagnostic — six checks: Python interpreter (path + version), osxphotos install, sidecar mode (persistent vs one-shot fallback), the write-tools gate (enabled/disabled + backend readiness), Photos library readability, and Full Disk Access, each reported ok / warn / fail with actionable advice |
Read tools also return structured JSON (structuredContent) alongside the human-readable text, so agents can consume results without parsing prose.
MCP resources & prompts
Resources expose read-only context the client can attach without a tool call:
photos://library, photos://albums, photos://persons, photos://keywords,
and the photos://photo/{uuid} template (full metadata for one photo). Prompts
package common workflows: find-photos, export-photos, photo-summary.
Write tools (opt-in)
The server is read-only by default — nothing changes for existing users. Version 2.0.0 added five tools that can modify the Photos library (create-album, add-to-album, remove-from-album, set-photo-metadata, set-keywords), and 2.1.0 adds two more (set-photo-date, import-photos) behind the same gate. Every one of them is refused with a clear error until you opt in:
Enable via environment variable (e.g. in your MCP server config's env block, where the host honors it):
{ "env": { "APPLE_PHOTOS_MCP_ENABLE_WRITES": "1" } }Or via the config file (recommended for Claude Desktop, which strips env) — ~/Library/Application Support/apple-photos-mcp/config.json:
{
"APPLE_PHOTOS_MCP_ENABLE_WRITES": "1"
}Then restart the MCP server (restart the host app, or the conversation in hosts that spawn per-conversation servers). The doctor tool reports the gate state either way — run it first if a write tool returns "Write tools are disabled".
The write tools stay registered even while disabled (MCP clients cache the tool list at startup, so hiding them would only hurt discoverability — a gated call returns the exact opt-in recipe instead).
Safety design
No deletion, ever. There is deliberately no tool that deletes a photo, an album, or a folder.
remove-from-albumchanges album membership only — the photos stay in All Photos and every other album. For actual deletion, quarantine photos into an album (the dedupe pattern) and delete inside Photos.app, where Recently Deleted gives you a 30-day safety net. The same no-delete rule cuts the other way forimport-photos: an import cannot be programmatically undone (Photos' AppleScript has no photo-delete verb), so removing a mistaken import is a by-hand operation in Photos.app.Explicit targets only. Every write takes explicit UUIDs, names, or file paths — there are no wildcard/all-photos operations, and every target is validated to exist before anything is modified (unknown UUIDs come back as clear errors or per-UUID
notFoundlists; import source paths must exist under the same allowlist roots as export).Bounded batches. Album operations accept at most 100 UUIDs per call; imports at most 50 files.
Reversible by design. Metadata writes echo before/after values so an agent can revert;
set-keywordsuses union semantics (read-merge-write) so keywords you don't mention are never clobbered; album adds are idempotent;set-photo-dateis a dry run by default — it writes nothing until you passdryRun: false, and always echoes before/after so an applied change can be reverted.The mechanism: writes drive Photos.app via AppleScript (the photoscript library). Photos is launched if it isn't running, and macOS asks for Automation permission for the host app with a one-time system prompt on the first write. Writes always target the library currently open in Photos.app (normally the system library) — the
libraryparameter of the read tools does not apply. (Reads, by contrast, go through osxphotos straight to the Photos database — fast and prompt-free. Why writes can't use that same path — and why osxphotos/PhotoKit aren't an escape from AppleScript — is spelled out in docs/WRITE-BACKEND.md.)One quirk to know: Photos' AppleScript dictionary has no "remove from album" verb, so
remove-from-albumrebuilds the album (same name, remaining photos): the album's UUID changes (the response reports old and new) and any custom manual sort order is lost.
Tool Reference
This section documents all available tools. AI agents should use these tool names and parameters exactly as specified.
Discovery
health-check
Verify osxphotos is installed and the Photos library can be opened.
Parameters: None
Returns: osxphotos version, library path, and total photo count — or an error if the library is inaccessible.
doctor
Run a full setup diagnostic — six checks: the resolved Python interpreter (path + version — warns when it's older than the required 3.11, with brew install python@3.12 advice), osxphotos installation, sidecar mode (persistent vs one-shot fallback, plus the last respawn), the write-tools gate (enabled/disabled, with the opt-in recipe and — when enabled — whether the photoscript backend and Photos.app look usable), Photos library readability, and Full Disk Access — each reported as ok / warn / fail with an actionable message. This is the richer counterpart to health-check; reach for it first when a tool returns a permission or "unable to open" error.
Parameters: None
Returns: A per-check report. The structuredContent carries the raw { healthy, checks[] }, where each check has name, status (ok/warn/fail), and detail. The Full Disk Access check explicitly reports whether the host process can read the library — see Full Disk Access.
library-info
High-level stats about the Photos library.
Parameter | Type | Required | Description |
| string | No | Path to a non-default |
Returns: Library path, Photos DB version, Photos.app version, counts of photos / movies / albums / folders / keywords / persons.
Query
query
Search the library with combinable filters. Returns photo summaries with UUIDs — use get-photo for full details on a specific match.
For the full filter syntax — accepted date forms, AND/OR combination semantics, exact-vs-substring matching, result ordering, and what is not filterable — see the Query Guide.
Parameter | Type | Required | Description |
| string[] | No | Specific UUIDs to fetch (max 1000 entries, each ≤ 256 chars) |
| string[] | No | Album name(s); ANY-match, exact full folder path + name (max 100 entries) |
| string[] | No | Keyword(s); ANY-match, exact whole-string (max 100 entries) |
| string[] | No | Person name(s); ANY-match, exact whole-string (max 100 entries) |
| string | No | ISO 8601 inclusive lower bound on photo date (e.g. |
| string | No | ISO 8601 upper bound on photo date. A bare date (e.g. |
| boolean | No | Only favorites |
| boolean | No | Exclude favorites |
| boolean | No | Only hidden photos |
| boolean | No | Exclude hidden photos (default behavior) |
| boolean | No | Include still photos |
| boolean | No | Include movies |
| string | No | Substring match on title (case-sensitive, ≤ 1024 chars) |
| string | No | Substring match on description (case-sensitive, ≤ 2048 chars) |
| string | No | ISO 8601 inclusive lower bound on IMPORT date ( |
| string | No | ISO 8601 upper bound on import date; a bare date includes that whole day |
| string | No | Imported within a trailing window — |
| string[] | No | ML classification label(s) Photos computed (the |
| string[] | No | Folder name(s)/path(s) — photos in albums inside the folder; ANY-match (max 100) |
| string[] | No | Place-name substring(s) from reverse geocoding (city, region, landmark). Multiple values are ANDed, not ORed (max 100) |
| boolean | No |
|
| string | No | GPS-radius filter: |
| number[] | No | Taken in calendar year(s); ANY-match (max 100) |
| number | No | Original file size at least this many bytes |
| number | No | Original file size at most this many bytes |
| boolean | No | Only photos carrying no keyword at all |
| boolean | No | Only burst photos |
| boolean | No | Media-type filters — each |
| boolean | No | Only videos/movies (alias of |
| number | No | Only photos whose Photos-computed overall aesthetic score (0–1) is at least this (e.g. |
| string | No | Case-insensitive substring over the text Photos' own OCR indexed per photo (macOS 13+) — receipts, signs, screenshots. Post-filter that reads per-photo search info, so combine with narrowing filters on big libraries |
| boolean | No | Sort by taken date, newest first, before |
| number | No | Cap the number of results returned (default |
| string | No | Path to a non-default |
Exceeding a cap rejects the call at the input schema, before the library is opened — chunk larger UUID batches across multiple calls.
Example - Recent favorites of Sarah:
{
"person": ["Sarah"],
"favorite": true,
"fromDate": "2025-06-01",
"limit": 50
}Example - Sunset keyword across two albums:
{
"keyword": ["sunset"],
"album": ["Vacation 2024", "Beach Trips"]
}Example - The 20 most recent imports:
{
"addedInLast": "7d",
"newestFirst": true,
"limit": 20
}Example - 2024 screenshot cleanup candidates:
{
"screenshot": true,
"year": [2024]
}Example - The best shots taken near the cabin:
{
"near": "46.51,-87.42,5",
"minScore": 0.6,
"newestFirst": true,
"limit": 20
}Returns: count (the total number of matches), returned (the number of summaries in this response — capped at limit, default 500), and photo summaries (UUID, filename, date, dimensions, favorite/hidden flags, albums, keywords, persons).
get-photo
Get full metadata for a single photo by UUID.
Parameter | Type | Required | Description |
| string | Yes | Photo UUID, as returned by |
| boolean | No |
|
| string | No | Path to a non-default |
Example:
{
"uuid": "33AC0410-D367-43AE-A839-12C7EF482020"
}Returns: All metadata for the photo: dimensions, original dimensions, dates (taken/added/modified), title, description, location (lat/lon), place (name/country), albums, keywords, persons, labels, an exif object (camera make/model, lens, ISO, aperture, shutter speed, focal length, exposure bias, flash, and duration/fps/codec for video — null when Photos recorded no EXIF, e.g. manufacturer-app uploads and scans), Photos' ML intelligence (score — the overall aesthetic score 0–1; detectedText — the text Photos' OCR indexed, macOS 13+; both null on library versions without them), iCloud shared-album social data (owner, comments, likes — only populated for shared assets), type flags (HDR / live / raw / edited / portrait / panorama / selfie / screenshot / slow-mo / time-lapse / burst), file paths (original, edited, raw, live-photo video), file size, UTI.
Recently Deleted: get-photo falls back to the trash, so it returns full metadata even for a photo sitting in Recently Deleted. query and export read the main library only — so a UUID that get-photo resolves may return nothing from query, and export will skip it with reason UUID not found (deleted or in trash).
get-photos
Get full metadata for a batch of photos (up to 50) in one call — the batch equivalent of get-photo, for dedupe reviews, EXIF audits, and captioning passes.
Parameter | Type | Required | Description |
| string[] | Yes | 1–50 photo UUIDs, as returned by |
| string | No | Path to a non-default |
Example:
{
"uuid": [
"33AC0410-D367-43AE-A839-12C7EF482020",
"1EB2B765-0765-43BA-A90C-0F0AE547B343"
]
}Returns: count, photos (full per-photo detail — the same shape as get-photo, including the exif object, score, detectedText, shared-album owner/comments/likes, and the Recently-Deleted fallback), and notFound listing any requested UUIDs that matched nothing. Unknown UUIDs never fail the batch.
get-selected-photos
Get the photos currently selected in the Photos.app window — the bridge from "act on these photos" to UUIDs you can feed into get-photos, get-thumbnail, export, or add-to-album.
No parameters.
Requirements & behavior:
Photos.app must be running with a visible selection; the tool returns a clear error otherwise, and never launches Photos itself.
Read-only and not gated behind the writes flag, but it reads the selection over AppleScript, so the host app needs macOS Automation permission for Photos (one-time system prompt on first use).
The selection comes from the library currently open in Photos.app; there is no
libraryparameter.
Returns: count, photos (the same summary shape as query results — UUID, filename, date, dimensions, flags), and notFound for selected items the library index doesn't know yet (e.g. a just-finished import Photos hasn't checkpointed — reported with their filenames).
get-thumbnail
Return one photo as an inline viewable image — an MCP image content block (base64 JPEG/PNG) that vision-capable clients render directly. Serves the preview derivatives Photos has already generated, so nothing is exported and originals aren't transferred. Prefer this over export whenever the goal is to look at a photo rather than to obtain the file.
Parameter | Type | Required | Description |
| string | Yes | Photo UUID, as returned by |
| number | No | Smallest acceptable long-edge size in pixels (default |
| string | No | Path to a non-default |
Returns: An image content block plus structured metadata: uuid, source path, width/height, mimeType, byteSize, and isDerivative (false means no suitable derivative existed and the image was rendered from the original via sips — never upscaled). Movies get a thumbnail only when Photos generated a poster-frame derivative; an iCloud-only photo with no local derivative or original returns an error suggesting export (which downloads on demand). Responses are capped at 8 MB: derivative selection pre-filters on that cap, but a sips-rendered fallback from a very high-resolution original can still exceed it and returns thumbnail is <n> bytes (cap 8388608); request a smaller minSize — lower minSize, or use export for the full file.
find-duplicates
Group exact duplicates using Photos' own fingerprint-based detection — the same data behind Photos' Duplicates album, no export or hashing required.
Parameter | Type | Required | Description |
| number | No | Max duplicate groups to return (default |
| string | No | Path to a non-default |
Returns: groupCount (total groups), returned, and groups ordered newest-first — each with the member uuids and per-member filename, date, size, width/height, and isMovie. Hidden and Recently-Deleted photos are never group members.
Exact means exact: the fingerprint matches identical image data only — edited copies, resized versions, and burst siblings will NOT group. Use get-thumbnail on a group's members to eyeball them before acting. This server cannot delete photos (Photos exposes no scriptable delete) — to act on duplicates, quarantine the extra copies into an album (create-album + add-to-album when writes are enabled, otherwise by hand in Photos.app) and review/delete inside Photos.app. See the dedupe pattern.
Browse
list-albums
List all albums in the library.
Parameter | Type | Required | Description |
| string | No | Path to a non-default |
Returns: Each album's title, folder path, photo count, shared status, and UUID. iCloud Shared Albums are included and flagged isShared: true.
list-folders
List all folders in the library.
Parameter | Type | Required | Description |
| string | No | Path to a non-default |
Returns: Each folder's title, parent folder, album count, and subfolder count.
list-keywords
List keywords sorted by usage count.
Parameter | Type | Required | Description |
| number | No | Cap to top-N keywords (max |
| string | No | Path to a non-default |
Returns: Keywords with their photo counts, sorted descending.
list-persons
List people detected by Photos face recognition, sorted by photo count.
Parameter | Type | Required | Description |
| number | No | Cap to top-N persons (max |
| string | No | Path to a non-default |
Returns: Persons with their photo counts, sorted descending. Unidentified faces appear as _UNKNOWN_.
Export
export
Export one or more photos by UUID to a destination directory.
Parameter | Type | Required | Description |
| string[] | Yes | Photo UUID(s) to export (1–1000 entries, each ≤ 256 chars) |
| string | Yes | Destination directory (created if missing). Must resolve — after expanding |
| boolean | No | Export the edited version instead of the original |
| boolean | No | Also export the live-photo video |
| boolean | No | Also export the raw image |
| boolean | No | Overwrite existing files at the destination. Without it, a photo whose file already exists is skipped (reported per-UUID) — never duplicated |
| string | No | Path to a non-default |
Example - Originals to a folder:
{
"uuid": ["33AC0410-...", "EEFCEF1D-..."],
"dest": "~/Desktop/exports"
}Example - Edited versions plus raw and live-photo video:
{
"uuid": ["33AC0410-..."],
"dest": "~/Desktop/exports",
"edited": true,
"raw": true,
"live": true,
"overwrite": true
}Returns: Destination path, count of files exported, count skipped, list of exported file paths, and a per-UUID reason for every skip (file already exists, UUID not found / in Recently Deleted, iCloud download failed, ...). Every requested UUID is accounted for in exported + skipped. Note that export reads the main library only: a photo in Recently Deleted is skipped with UUID not found (deleted or in trash) even though get-photo still resolves it (that tool falls back to the trash).
Destination allowlist: the destination is canonicalized (leading ~ expanded, .. normalized, symlinks resolved — including a not-yet-existing final directory) and must land under the home directory, /tmp, /private/tmp, or /Volumes. The check is segment-aware (/Volumesx does not pass as /Volumes), and the canonical path is what's exported into, so a symlink under an allowed root can't redirect the write outside it.
Filename collisions: Files keep the photo's original filename. If a file of that name already exists at the destination and overwrite is not set, the photo is skipped with reason already exists at destination — re-running an export never creates IMG_1234 (1).jpg-style duplicates. Pass overwrite: true to replace in place.
iCloud-only originals: If a photo's original isn't on disk (Photos is using "Optimize Mac Storage"), the export automatically falls back to Photos.app via AppleScript, which downloads the original on demand — same behavior as opening the photo in Photos. This is slower than a direct file copy; expect waits proportional to download size for large batches. Photos that genuinely can't be exported (e.g. edited=true requested but no edits exist) are still skipped with a per-UUID reason.
Progress notifications: For batch exports, the server emits one MCP progress notification per photo (progress/total plus a message naming the file being exported) when the client's request includes a progressToken — so hosts that surface progress can show a live counter instead of a silent multi-minute call. Clients that don't send a token simply get the final result, as before. (Progress requires the persistent sidecar; in the rare one-shot fallback mode the export still works but reports no intermediate progress.)
Write (opt-in — see Write tools)
All seven tools below require APPLE_PHOTOS_MCP_ENABLE_WRITES=1 and return a clear opt-in error otherwise. They drive Photos.app via AppleScript (macOS Automation permission; Photos is launched if needed), always target the library currently open in Photos.app (no library parameter), and can never delete photos.
create-album
Create an album — or return the existing one of that name (created: false), so re-running a filing workflow never piles up duplicates.
Parameter | Type | Required | Description |
| string | Yes | Album name (≤ 255 chars) |
| string | No | Folder path to nest the album under, |
Returns: album {uuid, name, path} and created. Without folder, the idempotency check matches an album of that name anywhere in the library; with folder, only inside that folder.
add-to-album
Add photos (by UUID) to an album (by name or UUID). Idempotent — Photos albums are sets.
Parameter | Type | Required | Description |
| string | Yes | Album name or UUID (UUID-looking values try the id lookup first, then fall back to a name match) |
| string[] | Yes | Photo UUID(s) to add (1–100) |
Returns: album {uuid, name, path}, addedCount, added, alreadyPresent (members already in the album), and notFound (UUIDs that don't exist in the library). Fails only when the album doesn't exist or no requested photo exists.
remove-from-album
Remove photos from an album — never from the library (they remain in All Photos and every other album).
Parameter | Type | Required | Description |
| string | Yes | Album name or UUID |
| string[] | Yes | Photo UUID(s) to remove from the album (1–100) |
Returns: the album after the operation, removedCount, removed, notInAlbum (requested UUIDs that weren't members — harmless no-ops), albumRecreated, and previousAlbumUuid.
Album rebuild caveat: Photos' AppleScript has no remove verb, so removal rebuilds the album (create replacement → copy the kept photos → delete the original → rename). The album's UUID changes (use album.uuid from the response) and custom manual sort order is lost. When none of the UUIDs are members, nothing is rebuilt (albumRecreated: false).
If a rebuild is interrupted: the replacement is built under a scratch name apple-photos-mcp-tmp-<hex> and renamed last. If the call is killed mid-rebuild — e.g. the 10-minute rebuild budget expires while copying a very large album — the original album and every photo are safe, but an apple-photos-mcp-tmp-… album may be left behind; delete it in Photos.app. In the rare case the kill lands in the brief window after the original was deleted, the kept photos are still safe under that scratch name — rename it back. The scratch name is picked fresh (and collision-checked) per call, so repeatedly retrying a timing-out removal strands a distinct album each time.
set-photo-metadata
Set a photo's title, description, and/or favorite flag. Only the fields you pass are touched.
Parameter | Type | Required | Description |
| string | Yes | Photo UUID |
| string | No | New title (≤ 255 chars; empty string clears it) |
| string | No | New description (≤ 2048 chars; empty string clears it) |
| boolean | No | Set or clear the favorite flag |
Returns: uuid, updated (which fields were written), and full before / after values of all three fields — revert a change by writing the before values back.
set-keywords
Add and/or remove keywords on a photo with union semantics: the photo's current keywords are read first and the edits merged in, so keywords you don't mention are always preserved — never a blind replace.
Parameter | Type | Required | Description |
| string | Yes | Photo UUID |
| string[] | No | Keywords to add (≤ 100 entries, each ≤ 255 chars; created in Photos if new) |
| string[] | No | Keywords to remove from this photo (≤ 100 entries, each ≤ 255 chars; exact match) |
At least one of add / remove is required; a keyword in both is rejected.
Returns: uuid, before / after keyword lists, added / removed (what actually changed — adding an existing keyword is a no-op), and changed. If the merge changes nothing, no write is performed.
set-photo-date
Fix a photo's date/time — set an absolute date or shift by a number of seconds. Dry run by default: nothing is written until you pass dryRun: false. This rewrites the date in the Photos library database only (the same thing Photos.app's Adjust Date & Time does) — the file's EXIF is never modified.
Parameter | Type | Required | Description |
| string | Yes | Photo UUID |
| string | * | Absolute new date-time, ISO 8601 (e.g. |
| number | * | Shift the current date by this many seconds (negative = earlier; |
| boolean | No | Default |
* Exactly one of date / shiftSeconds is required.
Returns: uuid, before, after (the would-be date on a dry run), shiftSeconds (the effective delta), applied, and dryRun. Revert an applied change by re-running with date = the echoed before and dryRun: false.
import-photos
Import image/video files from disk into the Photos library, optionally straight into an existing album. Add-only: nothing is modified or deleted, and source files stay where they are (Photos copies them in).
Parameter | Type | Required | Description |
| string[] | Yes | 1–50 absolute (or |
| string | No | Existing album (name or UUID) to file the imports into — create it with |
| boolean | No | Default |
Returns: requestedCount, importedCount, imported (uuid + filename per new item), and album when one was targeted. importedCount < requestedCount usually means Photos skipped duplicates.
Cannot be undone programmatically: Photos' AppleScript has no photo-delete verb, so removing a mistaken import means deleting it by hand in Photos.app.
Usage Patterns
Getting query filters right (date forms, AND/OR semantics, exact-match rules, ordering, paging) is covered in the Query Guide.
Basic Workflow
User: "How many photos do I have?"
AI: [calls library-info]
"You have 30,968 items: 30,435 photos and 533 movies across 46 albums..."
User: "Find my favorite sunset photos"
AI: [calls query with keyword=["sunset"], favorite=true]
"Found 12 favorite sunset photos. Here are the most recent..."
User: "Tell me about the first one"
AI: [calls get-photo with uuid="..."]
"Taken on 2025-09-14 at 19:47, in Big Sur..."Two-step: Query then Export
User: "Export all photos of Mollee from the beach to ~/Desktop/mollee-beach"
AI: [calls query with person=["Mollee"], keyword=["beach"]]
"Found 109 photos."
AI: [calls export with the UUIDs and dest="~/Desktop/mollee-beach"]
"Exported 109 files to ~/Desktop/mollee-beach."Seeing Photos: Query then Thumbnail
User: "Show me the best photo from Saturday"
AI: [calls query with fromDate/toDate for Saturday, newestFirst=true]
"Found 14 photos from Saturday."
AI: [calls get-thumbnail on a few candidates — the images render inline]
"This one of the lake at sunset is the standout..."Reviewing Recent Imports
User: "What came off the camera this week?"
AI: [calls query with addedInLast="7d", newestFirst=true, limit=20]
"23 items imported in the last 7 days; here are the 20 newest..."
User: "Which of those have no keyword yet?"
AI: [calls query with addedInLast="7d", noKeyword=true]
"9 of them are untagged."Duplicate Cleanup
User: "Do I have duplicate photos?"
AI: [calls find-duplicates]
"312 groups of exact duplicates."
AI: [calls get-thumbnail on members of the first few groups to verify visually]
"Each group is byte-identical — e.g. IMG_3588.HEIC appears twice..."
AI: "I can't delete photos (read-only) — collect one copy of each into a
quarantine album in Photos.app and delete from there."With writes enabled, the AI can build that quarantine album itself — the album-quarantine pattern (deletion still happens only in Photos.app, with its 30-day Recently Deleted safety net):
User: "Quarantine the duplicate extras for me."
AI: [calls create-album name="Duplicates — review & delete"]
AI: [calls add-to-album with every group's extra copies (keeping the best of each)]
"312 extra copies are in 'Duplicates — review & delete'.
Review the album in Photos.app and delete from there."Tagging and Filing (write tools)
User: "Tag this week's trailcam imports and file them into the Trailcam album"
AI: [calls query addedInLast="7d"] → UUIDs
AI: [calls create-album name="Trailcam"] (idempotent — returns the existing album)
AI: [calls add-to-album album="Trailcam" uuid=[...]]
AI: [calls set-keywords per photo, add=["trailcam"]]
"Filed 34 photos and tagged them 'trailcam' — existing keywords untouched
(set-keywords merges, never replaces)."Fixing Wrong Dates (write tools — dry-run first)
User: "Those trailcam photos are stamped with the upload time, not the capture
time. The strip in the image says 05/14/2026 06:32."
AI: [calls set-photo-date uuid=... date="2026-05-14T06:32:00"] (dryRun defaults to TRUE)
"Preview: 2026-07-09T21:14:03 → 2026-05-14T06:32:00. Apply?"
User: "Yes"
AI: [calls set-photo-date uuid=... date="2026-05-14T06:32:00" dryRun=false]
"Done — and the response echoed the old date, so I can revert if needed."Whole batches with the same clock offset shift with shiftSeconds instead of an absolute date. Only the Photos-library date changes — the file's EXIF is untouched (same as Photos.app's Adjust Date & Time).
Acting on the Photos.app Selection
User: [selects six photos in Photos.app] "Add these to the Yearbook album"
AI: [calls get-selected-photos] → 6 UUIDs
AI: [calls add-to-album album="Yearbook" uuid=[...]]
"Filed the 6 selected photos into Yearbook."Browsing Library Structure
User: "What are my top 10 keywords?"
AI: [calls list-keywords with limit=10]
"Photo Stream (1561), Mollee (109), beach (109), 2015 Feb Keweenaw..."
User: "Who appears most in my photos?"
AI: [calls list-persons with limit=10]
"Rita Sweet (29), Robert B Sweet (28), Jennifer Sweet (24)..."Targeting a Different Library
By default, all operations use the system Photos library. To work with a different .photoslibrary:
User: "Show albums in my old archive at /Volumes/Archive/Photos.photoslibrary"
AI: [calls list-albums with library="/Volumes/Archive/Photos.photoslibrary"]
"32 albums in the archive..."Installation Options
npm (Recommended)
npm install -g apple-photos-mcposxphotos installs automatically on the first tool call — no separate pip3 install needed.
From Source (with Project-Local venv)
git clone https://github.com/sweetrb/apple-photos-mcp.git
cd apple-photos-mcp
pnpm install
pnpm run setup # OPTIONAL — pre-builds ./venv with osxphotos; otherwise it's built on first use
pnpm run buildThe pnpm run setup step is optional: if you skip it, the server auto-bootstraps the venv on the first tool call (one-time, ~a minute). Running it ahead of time just avoids that first-call delay.
You can also install straight from GitHub with npm install -g github:sweetrb/apple-photos-mcp — but this builds from source at install time (requires pnpm), so prefer the registry install above unless you specifically want an unreleased commit.
If installed from source, use this configuration:
{
"mcpServers": {
"apple-photos": {
"command": "node",
"args": ["/path/to/apple-photos-mcp/build/index.js"]
}
}
}The server prefers a project-local venv at ./venv/bin/python3 if present, and otherwise falls back to system python3. If neither has osxphotos, the server auto-builds the venv on first use (unless APPLE_PHOTOS_MCP_NO_AUTO_SETUP=1). The venv is also self-healing: it's picked up as soon as it exists — no server restart needed if you build or repair it while the server is running — and is rebuilt automatically if a package update changes its requirements.
Running from a clone in Claude Code (project-scope .mcp.json)
This repo ships a .mcp.json at its root so that, when you run claude from inside a clone, the server is registered automatically as a project-scope server — no manual config needed. Before launching, you must:
pnpm run build— compile the TypeScript tobuild/index.js.pnpm run setup— optional; pre-builds the project-local venv at./venvwithosxphotos(the server prefers./venv/bin/python3). Skip it and the server builds the venv on the first tool call.Grant Full Disk Access to the app hosting Claude Code (Terminal, iTerm, VS Code, etc.) — the Photos library SQLite is in a protected directory and osxphotos reads it directly. See Full Disk Access.
Then launch Claude Code from the repo directory and approve the server when prompted.
The entrypoint is written as:
"args": ["${CLAUDE_PROJECT_DIR:-.}/build/index.js"]CLAUDE_PROJECT_DIR is the variable Claude Code injects into a project/user-scoped server's environment, and it resolves to the repo root. You must launch claude from inside the repo for this to work — the bare . fallback is only a last resort and is not reliable, because it resolves against the launching process's working directory, not the repo.
Why not
${CLAUDE_PLUGIN_ROOT}?CLAUDE_PLUGIN_ROOTis set only for marketplace plugin installs, never for a project-scope clone, so it can't drive the clone workflow. Conversely, a plugin install can't useCLAUDE_PROJECT_DIR(in a plugin, that points at the user's project, not the plugin's own directory). Claude Code does not support nested defaults like${CLAUDE_PLUGIN_ROOT:-${CLAUDE_PROJECT_DIR:-.}}, so a single entrypoint string cannot serve both contexts. The two distribution paths are therefore decoupled: the plugin carries its own MCP config in.claude-plugin/plugin.json(using${CLAUDE_PLUGIN_ROOT}), while the root.mcp.jsonis dedicated to the clone workflow (using${CLAUDE_PROJECT_DIR:-.}). Becauseplugin.jsondeclares its ownmcpServers, the plugin does not also auto-load the root.mcp.json, so there is no double-registration.
Heads-up on scope precedence: project-scope (
.mcp.json) outranks user-scope. If you also have anapple-photosentry registered at user scope (e.g. an absolute path in~/.claude.json), the project-scope entry wins and the user-scope one is ignored entirely. Pick one — for local development on this repo, the project-scope.mcp.jsonis the intended source. To pin a specific local build instead, register it at local scope (claude mcp add apple-photos -s local -- node /abs/path/build/index.js), which outranks project scope.
Full Disk Access
The Photos library SQLite database lives in a protected directory (~/Pictures/Photos Library.photoslibrary/database/). osxphotos reads this database directly — it does not go through Photos.app — so the host process needs Full Disk Access.
How to Grant Full Disk Access
Open System Settings (or System Preferences on older macOS)
Go to Privacy & Security > Full Disk Access
Click the + button
Add the application that hosts the MCP server:
Claude Desktop: Add
/Applications/Claude.appTerminal: Add
/Applications/Utilities/Terminal.appVS Code: Add
/Applications/Visual Studio Code.appiTerm: Add
/Applications/iTerm.app
Restart the application after granting access
Verifying it worked
Run the doctor tool — it explicitly reports the Full Disk Access check (alongside the Python interpreter version, osxphotos install, and library readability) as ok / warn / fail, so it's the best way to confirm the grant took effect. health-check and library-info also work as a quick smoke test.
For the full why-and-how walkthrough, see the Full Disk Access Setup Guide.
Without Full Disk Access
The health-check tool will fail and report a permissions error, and doctor's Full Disk Access check will report fail. No tool will be able to open the library.
Configuration
All configuration is optional — the server works out of the box.
Environment variables
Variable | Default | Description |
| unset (read-only) | Set to |
|
| Max bytes captured from the Python sidecar's stdout. Raise it if a very large library/query is truncated; lower it to cap memory. |
|
| Default per-command timeout, in milliseconds, for the Python sidecar. The first (cold) call parses the whole Photos database, and on very large libraries (100k+ photos) that load alone can exceed 60 s — raise this if tools report "Operation timed out". It sets only the DEFAULT budget — it applies to |
| unset (off) | Set to |
| unset (persistent mode on) | Set to |
|
| How long the persistent sidecar may sit idle before it's killed to free memory (a resident parsed library holds hundreds of MB for large libraries). The next call transparently respawns it, re-paying the one-time parse. |
| unset (auto-setup on) | Set to |
|
| Max time, in milliseconds, the automatic venv bootstrap may run before it's aborted. Raise it on slow networks where the |
|
| Path to the JSON config file (see below). |
Configuration file (when the host strips env)
Some host apps (e.g. Claude Desktop) launch the MCP server with a scrubbed
environment and ignore the env block in their server config, so there's no way
to pass APPLE_PHOTOS_MCP_* settings through it. In that case, put them in a JSON
file the host doesn't manage — APPLE_PHOTOS_MCP_CONFIG_FILE, or by default
~/Library/Application Support/apple-photos-mcp/config.json:
{
"APPLE_PHOTOS_MCP_MAX_BUFFER": "209715200",
"APPLE_PHOTOS_MCP_ENABLE_WRITES": "1"
}(The second line opts in to the write tools — omit it to keep the server read-only.)
The server reads it at startup and merges values into the environment without
overriding anything already set there (so an explicit env still wins). This
is the recommended way to configure the server under Claude Desktop. Keep only
non-secret config here.
Architecture
This package is a TypeScript MCP server with a Python sidecar:
The MCP server (Node) speaks the Model Context Protocol over stdio. Every tool's
inputSchemaandoutputSchemais advertised as JSON Schema 2020-12 — the dialect MCP standardized on and the only one modern clients will validate against. The MCP SDK's zod converter still emits draft-07, so the outgoingtools/listpayload is normalized at the transport boundary (src/utils/jsonSchemaDialect.ts).A bundled Python script (
src/utils/photos_reader.py) usesosxphotosto read the Photos library and returns JSON.The sidecar runs as a persistent process (
photos_reader.py --serve): the TypeScript side spawns it once on first use and sends it line-delimited JSON requests over stdin, behind a serial gate (exactly one request in flight at a time). The Node event loop stays free, so the server keeps answering MCP traffic (pings,health-check,doctor) even during a longqueryor a minutes-long iCloudexport.If serve mode is unavailable (old script, broken environment), the server transparently falls back to spawning a fresh one-shot Python process per call — same results, same error messages, just slower.
doctor'ssidecar_modecheck reports which mode is active.
Performance
Opening a Photos library is expensive: python startup + import osxphotos + a
full parse of the library database — about 4 seconds on a ~30k-photo
library, and it grows with library size. The persistent sidecar pays that
cost once: the parsed library stays resident, and follow-up calls complete
in milliseconds (measured: ~4.5 s cold, then 6–160 ms warm on a 31k-photo
library). Freshness is preserved — before every request the sidecar checks the
library's Photos.sqlite modification time and re-parses automatically the
moment the library changes (an import, an edit, an album rename). An idle
sidecar is killed after APPLE_PHOTOS_MCP_SIDECAR_IDLE_MS (default 5 min) to
free memory, and the next call respawns it — so the ~4 s cost recurs only on
the first call after a quiet period or a library change.
This is the same TS + Python-sidecar pattern used by apple-numbers-mcp for the numbers-parser Python library.
Security and Privacy
Local only — All operations happen locally via osxphotos. No data is sent to external servers.
Read-only by default — the library is never modified unless you explicitly set
APPLE_PHOTOS_MCP_ENABLE_WRITES=1(see Write tools (opt-in)). Even with writes enabled, the tools are limited to album membership, photo metadata (titles, keywords, favorites, dates), and add-only imports — nothing can delete a photo — and every write requires explicit UUIDs/names/paths (no wildcard operations).Exports write to disk —
exportwrites files to the destination directory you specify, and only into an allowlisted location: the destination must resolve (symlinks included) to a path under your home directory,/tmp,/private/tmp, or/Volumes. Confirm destinations before running on shared machines.No credential storage — The server doesn't store any passwords or authentication tokens.
Known Limitations
For the full rundown — read-only scope, iCloud export caveats, face/album behavior, and library lag — see docs/LIMITATIONS.md. For what query can and cannot filter by (and how), see docs/QUERY-GUIDE.md. The summary below is the quick version.
Limitation | Reason |
macOS only | Apple Photos and osxphotos are macOS-specific |
Read-only by default | osxphotos reads the Photos library directly; the write tools are opt-in ( |
No photo deletion | Deliberate: no tool deletes photos, albums, or folders — quarantine into an album and delete in Photos.app |
| Photos' AppleScript has no remove verb — the album's UUID changes and manual sort order is lost |
Writes target the open library | AppleScript talks to whatever library Photos.app has open — the |
Writes need Automation permission | Driving Photos.app via AppleScript triggers a one-time macOS Automation prompt for the host app |
Full Disk Access required | The Photos library SQLite database is in a protected directory |
iCloud-only export is slower | Originals that aren't on disk are downloaded on demand via Photos.app/AppleScript. The export still succeeds, but takes longer than a local copy and requires Photos.app to be installed and signed in to iCloud |
Photos.app may lock the library | If Photos.app is mid-write, opening the library can fail; close Photos.app and retry |
Person filter requires named faces | osxphotos cannot filter by unnamed/unrecognized faces |
Troubleshooting
The first tool call is slow / "setting up the Python venv" in the logs
This is expected: it's the one-time automatic venv build (creating
./venvand installingosxphotos). It can take ~a minute and logs progress to stderr. Subsequent calls are fast. Pre-warm withpnpm run setupto avoid it.If the build keeps hitting a timeout on a slow network, raise
APPLE_PHOTOS_MCP_SETUP_TIMEOUT(milliseconds; default 5 min).
"osxphotos not installed"
Most common cause: your
python3is older than 3.11. Stock macOS ships Python 3.9, which is too old for the automatic venv setup to succeed. Install a newer Python (brew install python@3.12), then simply retry the tool call — the venv rebuilds automatically.Auto-setup also can't run when
pipor network access is unavailable, or when you setAPPLE_PHOTOS_MCP_NO_AUTO_SETUP=1. Fix the missing piece (or unset the variable) and retry — or install by hand withpip3 install osxphotos(global) orscripts/setup.sh/pnpm run setupfrom a repo checkout (project-local venv).Run the
doctortool for a per-check diagnosis of what's missing.If you used a virtualenv, make sure it's the one at
./venv/in the project directory.
"Library not found" or permission errors
Grant Full Disk Access to the host app — see Full Disk Access.
Verify the library path: default is
~/Pictures/Photos Library.photoslibrary.
Photo not found / "Photo not found: "
The UUID may be wrong — re-run
queryto get current UUIDs.The photo may have been permanently deleted from the library.
exportsays "UUID not found (deleted or in trash)" butget-photoreturns the photo? The photo is in Recently Deleted:get-photofalls back to the trash, whilequeryandexportread the main library only. Restore the photo in Photos.app to export it.
Exports skip files with "missing"
Since 0.1.3, the export auto-downloads iCloud-only originals via Photos.app, so this skip should be rare. If it still happens:
"original not downloaded from iCloud (download attempt returned no files)" — Photos.app couldn't fetch it. Check iCloud connectivity, that you're signed in, and that the photo isn't excluded by a Photos sync setting.
"Photo does not have adjustments..." —
edited=truewas requested but the photo has no edited version. Retry without that flag."raw component not on disk (Photos.app fallback cannot fetch raw originals)" —
raw=truewas requested but the raw file isn't downloaded locally. Retry without the flag, or download the original in Photos.app first (File → Download Originals to this Mac).
"Write tools are disabled — apple-photos-mcp is read-only by default"
Working as designed: the write tools require an explicit opt-in. Set
APPLE_PHOTOS_MCP_ENABLE_WRITES=1in the server's environment or in~/Library/Application Support/apple-photos-mcp/config.json, then restart the MCP server — see Write tools (opt-in).Run the
doctortool to confirm the gate state (itswritescheck reports enabled/disabled and, when enabled, whether the photoscript backend and Photos.app look usable).
Write tools fail with an AppleScript / "not authorized" error
The host app needs macOS Automation permission to control Photos.app. The first write normally triggers a one-time system prompt — click OK. If it was denied, re-enable it under System Settings → Privacy & Security → Automation → (your host app) → Photos, then retry.
In headless contexts (no GUI session) the prompt can't be shown and the write fails with error
-1743; run the first write from a normal GUI session once to grant it.Writes launch Photos.app if it isn't running — the first write after a reboot can take noticeably longer while Photos starts.
Photos.app errors when running
Closing Photos.app may resolve database-lock errors. osxphotos opens the library in read-only mode but still requires that no writer holds an exclusive lock.
Every tool is rejected: "invalid outputSchema … unsupported dialect"
The full message is
Tool '<name>' has an invalid outputSchema: JSON Schema declares an unsupported dialect ("$schema": "http://json-schema.org/draft-07/schema#"). The default validator supports JSON Schema 2020-12 only.The server connects, but no tool is usable.Upgrade to apple-photos-mcp 2.1.10 or later (
npx -y apple-photos-mcp@latest, orpnpm run buildfrom a clone) and restart the host app. Versions up to 2.1.9 advertised draft-07 schemas because the MCP SDK's zod converter emits that dialect; 2.1.10 normalizes every advertised schema to 2020-12.Nothing else changes — no tool, parameter, or result differs between the two dialects for this server.
apple-photos server fails to connect when run from a clone
Launch
claudefrom inside the repo directory soCLAUDE_PROJECT_DIRresolves to the repo root. The bare.fallback resolves against the launching process's working directory, not the repo, and is unreliable.Run
pnpm run buildfirst — the entrypoint${CLAUDE_PROJECT_DIR:-.}/build/index.jswon't exist until you compile.The
./venvwithosxphotosbuilds automatically on the first tool call; runpnpm run setuponly to pre-warm it, or if you've setAPPLE_PHOTOS_MCP_NO_AUTO_SETUP=1.Grant Full Disk Access to the host app (Terminal, iTerm, VS Code, etc.) — see Full Disk Access.
Run
claude mcp listand check for conflicting scopes. Project-scope (.mcp.json) outranks user-scope; a stale user-scopeapple-photosentry pointing at a bad path can mask the project-scope one. To pin a specific build, register it at local scope:claude mcp add apple-photos -s local -- node /abs/path/build/index.js.If the server shows as pending, approve the project-scope server when Claude Code prompts you.
Development
pnpm install # Install dependencies
pnpm run setup # Create ./venv with osxphotos
pnpm run build # Compile TypeScript
pnpm test # Run unit tests
pnpm run test:integration # Run integration tests against the real Photos library
pnpm run test:all # Unit + integration
pnpm run test:coverage # Unit tests with coverage report
pnpm run typecheck # Type-check without emitting
pnpm run lint # Check code style
pnpm run format # Format codeThe Python sidecar is a thin CLI that the TypeScript layer shells out to:
./venv/bin/python3 src/utils/photos_reader.py library-info
./venv/bin/python3 src/utils/photos_reader.py query --keyword sunset --limit 5
./venv/bin/python3 src/utils/photos_reader.py export --uuid <uuid> --dest /tmp/outAuthor
Rob Sweet - President, Superior Technologies Research
A software consulting, contracting, and development company.
Email: rob@superiortech.io
GitHub: @sweetrb
License
MIT License - see LICENSE for details. This project is not affiliated with Apple Inc. or the osxphotos project.
Contributing
Contributions are welcome! Please open an issue or PR at github.com/sweetrb/apple-photos-mcp.
Related Projects
Part of a family of macOS MCP servers:
apple-mail-mcp — MCP server for Apple Mail (read, search, send, and organize email)
apple-notes-mcp — MCP server for Apple Notes (create, search, update, and export notes)
apple-numbers-mcp — MCP server for Apple Numbers (read and write .numbers spreadsheets)
osxphotos — The Python library that powers this server
Recurring macOS permission prompts
If macOS keeps re-prompting for Full Disk Access or Automation for node (often after a brew upgrade), see docs/NODE-RUNTIME-AND-TCC-PERMISSIONS.md — the fix is to run this server under the official, Developer-ID-signed Node so the grant survives Node updates.
Available Tools
21 toolsadd-to-albumA
Use when: you have photo UUIDs (from query / find-duplicates) and want to file them into an album — e.g. collecting duplicate extras into a quarantine album, or filing a trip's photos. Returns: the album {uuid, name, path}, addedCount, added (UUIDs newly added), alreadyPresent (UUIDs that were already members — adding is idempotent), and notFound (requested UUIDs that don't exist in the library). Fails only when the album doesn't exist or NO requested photo exists. Do not use when: the album doesn't exist yet — call create-album first; or you want photos OUT of an album — use remove-from-album. Safety: WRITE tool — disabled unless APPLE_PHOTOS_MCP_ENABLE_WRITES=1 (run doctor to check). Changes album membership only: photos are never copied, modified, or deleted, and each target is validated to exist first. Max 100 UUIDs per call. Drives Photos.app via AppleScript (launches it if needed; requires macOS Automation permission — one-time prompt). Writes target the library currently open in Photos.app.
Inputs: uuid (required), album (required). Returns: added, album, notFound, addedCount, +1 more
create-albumA
Use when: you need an album to file photos into — a new album by name, optionally nested inside a folder path (e.g. for a quarantine album before a dedupe review, or a per-trip album). Returns: album {uuid, name, path} and created — false means an album of that name already existed and was returned instead of creating a duplicate (idempotent: safe to re-run; without folder the name is matched anywhere in the library, with folder only inside that folder). Do not use when: you want to list existing albums — use list-albums; or you want to put photos into the album — follow up with add-to-album. Safety: WRITE tool — disabled unless APPLE_PHOTOS_MCP_ENABLE_WRITES=1 (run doctor to check). Only creates albums/folders; never deletes, moves, or modifies photos. Drives Photos.app via AppleScript: Photos is launched if not running, and macOS Automation permission is required (one-time system prompt on first write). Writes always target the library currently open in Photos.app — there is no library parameter.
Inputs: name (required), folder. Returns: album, created
doctorA
Use when: a tool returns a permission, 'unable to open', or 'write tools are disabled' error, or you want a full setup diagnostic before querying, exporting, or writing. Returns: six checks — Python interpreter (path + version; warns below 3.11), osxphotos install, sidecar mode (persistent vs one-shot, plus last respawn), the write-tools gate (enabled/disabled, with the opt-in recipe and — when enabled — whether the photoscript backend and Photos.app look usable), Photos library readability, and Full Disk Access — each reported ok/warn/fail with actionable advice. Do not use when: you only need the lightweight is-it-working smoke test — use health-check instead.
Inputs: no named parameters. Returns: checks, healthy
exportA
Use when: you want to copy one or more photos (by UUID, typically from query) out to a destination directory on disk. By default exports the original; set edited=true for the edited version, live=true to also include the live-photo video, raw=true to also include the raw image. Large batches report per-photo MCP progress notifications when the request carries a progressToken. Returns: the destination path, counts of files exported and skipped, the exported file paths, and a per-UUID reason for anything skipped (e.g. file already exists at the destination, UUID not found / in trash, iCloud download failed). Do not use when: you only need metadata or file paths rather than copies on disk — use get-photo; or you're still figuring out which photos to export — use query first. Safety: the only side-effecting tool on the read path — it writes files into the destination directory (created if missing); the opt-in write tools (APPLE_PHOTOS_MCP_ENABLE_WRITES=1) can also modify the library, but nothing else here writes anywhere. dest must resolve (after expanding ~ and following symlinks) to a path under your home directory, /tmp, /private/tmp, or /Volumes; anything else is rejected. With overwrite=true it OVERWRITES existing files of the same name in place; without it, existing files are skipped and reported per-UUID. If an original isn't on disk (iCloud 'Optimize Mac Storage'), the export falls back to driving Photos.app via AppleScript to download it on demand — this is slow for large batches and requires Photos.app installed, signed in to iCloud, and Automation permission granted.
Inputs: dest (required), uuid (required), raw, live, +3 more. Returns: skipped, exported, destination, skippedCount, +1 more
find-duplicatesA
Use when: you want to find exact duplicates across the library — cleaning up after a double import, checking whether files were re-uploaded, or auditing before a migration/export. Returns: groupCount (total duplicate groups found), returned (groups in this response, capped at limit, default 100), and groups ordered newest-first — each with the member UUIDs plus per-member filename, date, size, dimensions, and movie flag. Use get-thumbnail on members to eyeball a group before acting on it. Do not use when: you're looking for near-duplicates or similar shots — Photos' fingerprint matches EXACT duplicates (identical image data) only; edited copies, resized versions, and burst siblings will NOT group. Safety: read-only. This server cannot delete photos — to act on duplicates, quarantine the extra copies into an album (create-album + add-to-album when writes are enabled, otherwise by hand in Photos.app) and review/delete inside Photos.app.
Inputs: limit, library. Returns: groups, returned, groupCount
get-photoA
Use when: you have a single photo's UUID (typically from query) and want its complete metadata. Returns: dimensions and original dimensions, dates, title/description, location and place, albums, keywords, persons, labels, file paths, size, EXIF camera data (make/model, lens, ISO, aperture, shutter speed, focal length — null when Photos recorded none), Photos' ML intelligence (score = overall aesthetic 0–1, detectedText = OCR-indexed text; null on macOS versions without them), iCloud shared-album social data (owner, comments, likes — only populated for shared assets), and type flags (HDR/live/raw/edited/portrait/panorama/etc.). Pass burstPhotos=true to also list the sibling frames of a burst (UUID, filename, date each). Do not use when: you don't have a UUID yet — use query to find matches first; you have several UUIDs — use get-photos for one batched call; or you want to see the image — use get-thumbnail.
Inputs: uuid (required), library, burstPhotos. Returns: photo
get-photosA
Use when: you have SEVERAL UUIDs (typically from query or find-duplicates) and want full metadata for all of them — a dedupe review, an EXIF audit, a captioning pass. One batched sidecar round-trip (max 50 UUIDs) instead of N get-photo calls. Returns: count, photos (full per-photo detail — the same shape as get-photo, including the exif block, score, detectedText, and shared-album owner/comments/likes), and notFound listing any requested UUIDs that matched nothing. Do not use when: you have a single UUID — use get-photo; you don't have UUIDs yet — use query; or you want to see the images — use get-thumbnail per photo.
Inputs: uuid (required), library. Returns: count, photos, notFound
get-selected-photosA
Use when: the user says "these photos" / "the selected photos" — they have photos selected in the Photos.app window and you need their identities. This is the GUI-selection bridge: feed the returned UUIDs into get-photos, get-thumbnail, export, or add-to-album. Returns: count, the same photo summaries as query (UUID, filename, date, dimensions, flags), and notFound for selected items the library index doesn't know yet (e.g. a just-finished import Photos hasn't checkpointed — each with its filename for identification). Do not use when: you want to FIND photos by criteria — use query; or Photos.app isn't running / nothing is selected — both return a clear error, and this tool never launches Photos itself. Note: read-only, but it reads the selection from Photos.app via AppleScript, so it requires Photos.app running with a visible selection, and macOS Automation permission for the host app (one-time system prompt on first use). The selection comes from the library currently open in Photos.app.
Inputs: no named parameters. Returns: count, photos, notFound
get-thumbnailA
Use when: you (or the user) want to SEE a photo — visual triage ('show me…'), picking the best shot, eyeballing duplicate groups, or reading text in an image — without exporting anything to disk. Prefer this over export whenever the goal is to LOOK at a photo rather than to obtain the file. Returns: the photo as an inline MCP image content block (base64 JPEG/PNG a vision-capable client renders directly), plus a text summary and structured metadata (source path, width/height, MIME type, byte size, isDerivative). It serves the smallest Photos-generated preview derivative whose long edge is at least minSize pixels (default 360) — raise minSize (e.g. 1024) when you need detail like small text; isDerivative=false means no suitable derivative existed and the original was downscaled/converted via sips. Do not use when: you need the full-resolution file on disk — use export; or you only need metadata — use get-photo. Movies get a thumbnail only when Photos generated a poster-frame derivative; an iCloud-only photo with no local derivative or original cannot be thumbnailed (export it first, which downloads on demand).
Inputs: uuid (required), library, minSize. Returns: path, uuid, width, height, +3 more
health-checkA
Use when: you want a quick smoke test that osxphotos is installed and the Photos library can be opened. Returns: ok/fail plus the osxphotos version, library path, and total photo count. While another operation (a long query or export) is running, it responds immediately with a liveness summary instead of queueing behind it — re-run after the operation completes for the full result. Do not use when: you need a full setup diagnostic that pinpoints whether the failure is a missing osxphotos, an unreadable library, or denied Full Disk Access — use doctor instead.
Inputs: no named parameters. Returns: ok, message
import-photosA
Use when: you have image/video files on disk that belong in the Photos library — round-trip edits (export → fix → import), a folder of scans, an SD-card ingest — optionally filed straight into an existing album. Returns: requestedCount (validated source files), importedCount, imported (uuid + filename per new item — feed into get-photos / add-to-album / set-photo-date), and the album when one was targeted. importedCount < requestedCount usually means Photos skipped duplicates. Do not use when: the target album doesn't exist yet — call create-album first (a missing album is an error, not auto-created); or the files are outside your home directory, /tmp, /private/tmp, or /Volumes — those paths are rejected. Safety: WRITE tool — disabled unless APPLE_PHOTOS_MCP_ENABLE_WRITES=1 (run doctor to check). Only ADDS to the library — never modifies or deletes anything; source files stay where they are (Photos copies them in). But note the reverse door is closed: Photos' AppleScript has no photo-delete verb, so an import cannot be programmatically undone — removing a mistaken import requires Photos.app by hand. Every path is validated (absolute, exists, allowed root) before anything imports. Duplicate checking is ON by default; a duplicate then makes Photos.app show a BLOCKING dialog a human must answer (the call waits up to its timeout) — set skipDuplicateCheck=true only when duplicates are acceptable, because they WILL be re-added silently. Drives Photos.app via AppleScript (requires macOS Automation permission; launches Photos if needed). Imports go into the library currently open in Photos.app.
Inputs: paths (required), album, skipDuplicateCheck. Returns: album, imported, importedCount, requestedCount
library-infoA
Use when: you want high-level stats about the whole library — total counts of photos, movies, albums, folders, keywords, and persons — or to confirm which library you're targeting before drilling in. Returns: the library path, Photos DB and Photos.app versions, and the six counts. Do not use when: you want the actual albums/keywords/persons rather than just their counts — use list-albums / list-keywords / list-persons; or you want to find specific photos — use query.
Inputs: library. Returns: dbVersion, albumCount, movieCount, photoCount, +6 more
list-albumsA
Use when: you want the catalog of albums — e.g. to discover exact album names before filtering query by album, or to browse the library's organization. Returns: every album's title, folder path, photo count, shared status, and UUID. Do not use when: you want the photos inside an album — use query with the album filter; you want the folder hierarchy rather than albums — use list-folders; or you just want a total album count — use library-info.
Inputs: library. Returns: count, albums
list-foldersA
Use when: you want the library's folder hierarchy — the containers that hold albums and subfolders — to understand how albums are nested. Returns: every folder's title, parent folder, album count, and subfolder count. Do not use when: you want the albums themselves (with their photo counts) — use list-albums; or you just want a total folder count — use library-info.
Inputs: library. Returns: count, folders
list-keywordsA
Use when: you want the catalog of keywords (tags) in the library — e.g. to discover exact keyword spellings before filtering query by keyword, or to see which tags are most used. Pass limit for the top-N. Returns: keywords with their photo counts, sorted most-used first. Do not use when: you want photos carrying a keyword — use query with the keyword filter; or you want people/faces rather than tags — use list-persons.
Inputs: limit, library. Returns: count, keywords
list-personsA
Use when: you want the catalog of named people from Photos face recognition — e.g. to discover exact person names before filtering query by person, or to see who appears most. Pass limit for the top-N; unidentified faces appear as UNKNOWN. Returns: persons with their photo counts, sorted most-photographed first. Do not use when: you want photos of a person — use query with the person filter; or you want subject tags rather than people — use list-keywords.
Inputs: limit, library. Returns: count, persons
queryA
Use when: you need to find photos matching one or more filters — album, keyword, person, ML label, place, GPS radius (near), folder, taken-date or import-date range (addedAfter/addedInLast for 'recently imported'), year, file size, media type (screenshot, screen recording, selfie, panorama, live, portrait, time-lapse, slow-mo, burst, video), aesthetic score (minScore), OCR-detected text (detectedText), favorite/hidden flags, or title/description substrings — and get back a list of matches. This is the primary search/discovery tool; start here when you don't already have a UUID. Hidden photos are excluded unless hidden=true. Pass newestFirst=true with a limit to get the N most recent matches. Returns: count (the TOTAL number of matches), returned (the number of summaries in this response — capped at limit, default 500), and photo summaries (UUID, filename, date, dimensions, favorite/hidden/movie flags) — feed a UUID into get-photo/get-photos for full metadata, get-thumbnail to see it, or export to copy files. Do not use when: you already have UUIDs and want full metadata — use get-photo / get-photos; you want to see an image — use get-thumbnail; or you just want the catalog of album/keyword/person names — use list-albums / list-keywords / list-persons.
Inputs: live, near, uuid, year, +37 more. Returns: count, photos, returned
remove-from-albumA
Use when: you want to take photos OUT of an album — undoing a mis-filing, or clearing reviewed items from a quarantine album. This removes ALBUM MEMBERSHIP only.
Returns: the album AFTER the operation ({uuid, name, path} — note the uuid CHANGES when anything was removed), removedCount, removed, notInAlbum (requested UUIDs that weren't members — no-ops), albumRecreated, and previousAlbumUuid.
Do not use when: you want to delete photos from the library — this server cannot delete photos at all (quarantine them in an album and review in Photos.app instead); or the photos aren't in the album (harmless, but pointless).
Safety: WRITE tool — disabled unless APPLE_PHOTOS_MCP_ENABLE_WRITES=1 (run doctor to check). NEVER deletes photos from the library — removed photos stay in All Photos and every other album. Photos' AppleScript has no remove-from-album verb, so the album is REBUILT (same name and remaining photos): its UUID changes and any custom manual sort order is lost; re-fetch the album UUID from the response. When none of the UUIDs are members, nothing is rebuilt. The replacement is built under a scratch name apple-photos-mcp-tmp-<hex> and renamed last, so a call killed mid-rebuild (e.g. the 10-minute budget expiring while copying a very large album) leaves the original album and every photo intact but can strand an apple-photos-mcp-tmp-… album to delete in Photos.app; each interrupted run strands a distinct one. Max 100 UUIDs per call. Drives Photos.app via AppleScript (requires macOS Automation permission). Writes target the library currently open in Photos.app.
Inputs: uuid (required), album (required). Returns: album, removed, notInAlbum, removedCount, +2 more
set-keywordsA
Use when: you want to add and/or remove keywords (tags) on a photo — tagging workflows, fixing a mis-tag — without disturbing its other keywords. Returns: uuid, before/after keyword lists (revert by re-running with the diff inverted), added and removed (what actually changed — adding an existing keyword or removing an absent one is a no-op), and changed. Do not use when: you want to browse keywords — use list-keywords; or find photos by keyword — use query. A keyword passed in both add and remove is rejected. Safety: WRITE tool — disabled unless APPLE_PHOTOS_MCP_ENABLE_WRITES=1 (run doctor to check). UNION semantics — the photo's current keywords are read first and edits are merged in, so existing keywords you don't mention are ALWAYS preserved (never a blind replace). Metadata only — the image asset is untouched; the target photo is validated to exist first. Drives Photos.app via AppleScript (requires macOS Automation permission). Writes target the library currently open in Photos.app.
Inputs: uuid (required), add, remove. Returns: uuid, added, after, before, +2 more
set-photo-dateA
Use when: a photo's date/time is wrong and you want to fix it — trailcam or scanner imports stamped with the upload time, a camera with a mis-set clock, scanned prints. Set an absolute date OR shift by a number of seconds (exactly one of date / shiftSeconds). DRY RUN BY DEFAULT: with dryRun omitted (or true) it only reports the current and would-be dates — preview first, then re-run with dryRun=false to write. Returns: uuid, before and after datetimes (on a dry run, after = the would-be date), shiftSeconds (the effective delta), applied, and dryRun. Revert an applied change by re-running with date= and dryRun=false. Do not use when: you want to find photos by date — use query; or you expect the file's EXIF to change — this edits the Photos library date only. Safety: WRITE tool — disabled unless APPLE_PHOTOS_MCP_ENABLE_WRITES=1 (run doctor to check). Rewrites the photo's date in the Photos LIBRARY DATABASE only — the same operation as Photos.app's 'Adjust Date & Time'; the original file's EXIF is never modified. Dates are interpreted in the Mac's local timezone (a timezone-aware ISO datetime is converted to local). Nothing is written unless dryRun=false is passed explicitly, and before/after are always echoed so any change can be reverted. The target photo is validated to exist first. Drives Photos.app via AppleScript (requires macOS Automation permission). Writes target the library currently open in Photos.app.
Inputs: uuid (required), date, dryRun, shiftSeconds. Returns: uuid, after, before, dryRun, +2 more
set-photo-metadataA
Use when: you want to set a photo's title, description, or favorite flag — captioning passes, marking the best shot of a burst, titling scans. Returns: uuid, updated (which fields were written), and the full before/after values of all three fields — so any change can be reverted by writing the before values back. Do not use when: you want keywords — use set-keywords (it has union semantics; this tool doesn't touch keywords); or you only want to READ metadata — use get-photo. Safety: WRITE tool — disabled unless APPLE_PHOTOS_MCP_ENABLE_WRITES=1 (run doctor to check). Metadata only — never touches the image asset, and only the fields you pass are modified (an empty string clears title/description). The target photo is validated to exist first. Drives Photos.app via AppleScript (requires macOS Automation permission). Writes target the library currently open in Photos.app.
Inputs: uuid (required), title, favorite, description. Returns: uuid, after, before, updated
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 21 tools
Each tool targets a distinct purpose: query finds photos, get-photo/get-photos retrieve metadata, get-thumbnail displays images, export copies files, list-* functions enumerate catalogs, and set-* tools modify specific attributes. Even seemingly similar pairs like health-check vs doctor are clearly differentiated by scope (smoke test vs full diagnostic) and explicit 'Do not use when' guidance.
The tool names follow a consistent snake_case verb_noun pattern (get-photo, list-albums, set-keywords, create-album, add-to-album, import-photos). The only deviations are health-check and doctor, which are noun-style names, but they are both diagnostic tools and the pattern remains clear throughout the set.
With 21 tools, this is on the higher end of the typical range, but each tool earns its place given the comprehensive scope of managing a Photos library (search, metadata, export, import, album manipulation, diagnostics). The count is justified by the breadth of functionality, though a few tools (e.g., get-photos vs get-photo) could theoretically be merged without losing clarity.
The tool surface covers the primary lifecycle: query, read metadata, view thumbnails, export, import, album creation and membership, and metadata/keyword/date updates. The main gaps are intentional (no photo deletion due to AppleScript limitations) and minor (no folder creation/deletion, no album deletion). These are acceptable given the stated purpose and platform constraints.
Maintenance
Related MCP Connectors
Search photos and video moments by visual meaning, people, dates, and folders across local libraries, Apple Photos, and OneDrive. Manage collections, groups, favorites, people, and duplicate review. Synced metadata remains searchable while the desktop is offline; local and Apple Photos media access needs the owning device online with remote access enabled. OneDrive media can be accessed directly from the cloud. OAuth or Bearer API keys. Paid Cloud Access required; hosted visual search uses prepaid credits. Text-in-image search is semantic matching, not guaranteed exact OCR. Setup: https://organizewith.ai/en/guides/connect-ai-assistants
MCP connector that lets ChatGPT list, search, and run your Apple Shortcuts via a local Mac agent
Search, read, and write your Apple Notes from ChatGPT/Claude via a local Mac agent + MCP relay.
Mac & Windows: let ChatGPT, Claude & Cursor use your email, calendar, iMessage, Teams, files.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to search, browse, and retrieve metadata and images from your Google Photos library. It supports content-based filtering, album listing, and location extraction via STDIO and HTTP transports.56MIT
- AlicenseNot gradedqualityDmaintenanceThis MCP server enables AI tools to interact with your Apple Photos library via the osxphotos CLI, providing tools for querying and managing photos.2MIT
- AlicenseAqualityCmaintenanceEnables natural language search of local photo archives using AI-powered semantic understanding, with integration into Claude Desktop via the Model Context Protocol.42MIT
- FlicenseNot gradedqualityCmaintenanceEnables users to search and retrieve photos from a self-hosted Immich photo library via natural language, supporting CLIP-based semantic search, metadata filtering, album browsing, and share link creation.-