mcp-osxphotos
This MCP server enables AI tools to interact with your Apple Photos library via the osxphotos CLI, providing tools for querying and managing photos.
README
mcp-osxphotos
<!-- markdownlint-disable MD013 MD004 MD007 MD029 MD030 MD032 -->
An MCP server for interacting with the osxphotos CLI tool.
This project provides Model Context Protocol tools around the open source project osxphotos.
This server provides a way for AI tools that support the Model Context Protocol (MCP) to interact with your Apple Photos library through the powerful osxphotos command-line tool.
Quick Index
- Prerequisites
- Installation and Setup
- Usage
- Using uvx (alternative)
- Testing
- Developer Documentation
- Configure with common MCP clients
- License
- Publishing
Prerequisites
This server executes the osxphotos CLI. The executable is discovered in this order:
- If the environment variable
OSXPHOTOS_BINis set to an absolute path to the executable, that path is used. - Otherwise, the system
PATHis searched (same environment as the process that launches this server).
If the executable cannot be found, tools will return a clear error message asking you to set OSXPHOTOS_BIN or update PATH.
Tip: Verify discovery with the osxphotos_health tool. It reports the resolved path, --version, and relevant environment variables. If you’re running this from an app that manages its own environment, ensure the directory that contains osxphotos is on PATH (use which osxphotos to find it), or set OSXPHOTOS_BIN to the absolute path explicitly.
Python version: This server targets Python >= 3.11. You can confirm the runtime with the python_version tool.
Environment configuration: This server loads a .env file if present (via python-dotenv). You can set OSXPHOTOS_BIN=/absolute/path/to/osxphotos there instead of wiring it into your client config.
Installation and Setup
-
Clone the repository (or create the project files):
# (If you have the project files, you can skip this step) git clone <repository_url> cd mcp-osxphotos -
Install dependencies with uv (optional for published usage):
This project uses
uvfor package management. For local development:uv sync
Usage
To run the MCP server, execute the following command from the project's root directory:
Recommended (published package):
uvx mcp-osxphotos
This runs the published console script and starts the server over stdio.
Development (from local source):
# Run the FastMCP server directly (no banners printed to stdout)
uv --directory /absolute/path/to/mcp-osxphotos run python src/mcp_osxphotos/server.py
Using uvx (alternative)
If you prefer not to install anything locally, you can launch the server using uvx. This downloads and runs the package in an isolated environment (cached by uv).
uvx mcp-osxphotos
Notes:
- With
uvx, you don’t need to installmcp[cli]into your venv. Themcptool will be resolved automatically. - For GUI clients (Claude, Continue, Zed, etc.), avoid wrapping the server with
mcp devbecause it prints human-readable banners to stdout, which will break JSON-RPC parsing in clients. Instead, run Python directly onsrc/mcp_osxphotos/server.py(examples below) or use the published console scriptmcp-osxphotos.
Environment management: uv vs .venv
You don’t need a pre-created .venv for the client configurations shown here. There are two supported ways to run:
-
Use uv to provide the environment (recommended for GUI clients):
- Example:
uv --directory /path/to/mcp-osxphotos run python src/mcp_osxphotos/server.py - uv will run the server with the project’s dependencies resolved from your
pyproject.toml/uv.lockwithout requiring you to manually activate a venv. - This is what the sample Gemini/Claude/Zed configs use; no extra install step is required.
- Example:
-
Use your own persistent venv (handy for running tests or local dev shells):
- Create/populate it with
uv sync(or your preferred tool), which will install the pinned dependencies into.venv/. - Point your client to the venv’s Python (e.g.,
/absolute/path/to/mcp-osxphotos/.venv/bin/python) and set the script tosrc/mcp_osxphotos/server.py.
- Create/populate it with
Rule of thumb:
- If your client command starts with
uv/uvx, you do not need extra installation steps; uv will handle resolving the environment for that run. - If your client command starts with a bare
pythonpath, ensure that Python’s environment already has the project dependencies (use.venv/bin/pythonafteruv sync).
Testing
Once the server is running, you can test it using the MCP Inspector, a web-based interface for interacting with the server's tools.
- When you start the server, it will print a URL in your terminal, usually
http://localhost:6274. - Open this URL in your web browser.
- You will see all the available tools and their parameters.
- You can expand each tool to see its parameters, fill them with test values, and click the "Execute" button to run the tool and see the output.
Configure with common MCP clients
Below are examples for wiring this server into popular MCP clients. For development, use an absolute path to src/mcp_osxphotos/server.py and run Python directly (do not use mcp dev in GUI clients). For published usage, prefer the console script mcp-osxphotos. Set OSXPHOTOS_BIN if your client is a GUI app (it may not inherit your shell PATH).
Tip: After adding a server, run python_version and osxphotos_health from your client to verify the environment.
Claude Desktop (macOS)
Edit ~/Library/Application Support/Claude/claude_desktop_config.json and add an entry under mcpServers:
Dev config (local source):
{
"mcpServers": {
"mcp-osxphotos": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/mcp-osxphotos", "run", "python", "src/mcp_osxphotos/server.py"],
"env": {
"OSXPHOTOS_BIN": "/absolute/path/to/osxphotos"
}
}
}
}
Published config (recommended):
{
"mcpServers": {
"mcp-osxphotos": {
"command": "uvx",
"args": ["mcp-osxphotos"],
"env": {
"OSXPHOTOS_BIN": "/absolute/path/to/osxphotos"
}
}
}
}
Then restart Claude Desktop.
VS Code – Continue extension
Create or edit ~/.continue/config.json (user-level) or .continue/config.json in your workspace:
Dev config (local source):
{
"mcpServers": {
"mcp-osxphotos": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/mcp-osxphotos", "run", "python", "src/mcp_osxphotos/server.py"],
"env": {
"OSXPHOTOS_BIN": "/absolute/path/to/osxphotos"
}
}
}
}
Or with published package:
{
"mcpServers": {
"mcp-osxphotos": {
"command": "uvx",
"args": ["mcp-osxphotos"],
"env": {
"OSXPHOTOS_BIN": "/absolute/path/to/osxphotos"
}
}
}
}
Reload the Continue extension (or VS Code) and look for the server under Tools.
Zed editor
Add a server entry to your Zed settings (e.g., ~/.config/zed/settings.json). Insert under the root settings object:
Dev config (local source):
{
"mcp": {
"servers": [
{
"name": "mcp-osxphotos",
"binary": "uv",
"args": ["--directory", "/absolute/path/to/mcp-osxphotos", "run", "python", "src/mcp_osxphotos/server.py"],
"env": { "OSXPHOTOS_BIN": "/absolute/path/to/osxphotos" }
}
]
}
}
Or with published package:
{
"mcp": {
"servers": [
{
"name": "mcp-osxphotos",
"binary": "uvx",
"args": ["mcp-osxphotos"],
"env": { "OSXPHOTOS_BIN": "/absolute/path/to/osxphotos" }
}
]
}
}
Restart Zed to pick up changes.
gemini-cli (template)
If your gemini-cli supports MCP servers via a config file, the entry typically follows the same pattern as above. Use this as a template and consult the gemini-cli documentation for the exact config path and schema:
Dev config (local source):
{
"mcpServers": {
"mcp-osxphotos": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/mcp-osxphotos", "run", "python", "src/mcp_osxphotos/server.py"],
"env": { "OSXPHOTOS_BIN": "/absolute/path/to/osxphotos" }
}
}
}
Or with published package:
{
"mcpServers": {
"mcp-osxphotos": {
"command": "uvx",
"args": ["mcp-osxphotos"],
"env": { "OSXPHOTOS_BIN": "/absolute/path/to/osxphotos" }
}
}
}
Troubleshooting tips:
- GUI apps often have a minimal PATH. Prefer setting
OSXPHOTOS_BINto the absolute path ofosxphotos. - Ensure your Python matches the supported range (>= 3.12,< 3.14). Use the
python_versiontool to verify. - Use
osxphotos_healthto confirm the resolved CLI path and version.
Developer Documentation
See the full tool reference in docs: docs/available-tools.md.
Notes on interactive commands
The osxphotos commands inspect and repl are intentionally not exposed as MCP tools because they require interactive terminal control and real-time user interaction with Photos or a shell session. MCP tools run as single, stateless invocations and return outputs, which is not compatible with the continuous interactive behavior expected by these commands. If you need their functionality:
- For
inspect, run it in a local terminal while using Photos for interactive selection. - For
repl, open the REPL in a terminal for exploratory work, then script repeatable logic and run it via theruntool.
How it Works
The tools in this server are wrappers around the osxphotos CLI tool. When you call a tool, the server constructs and executes the corresponding osxphotos command with the provided parameters. The output of the command is then returned to the client.
Extending the Server
You can easily extend the server by adding new tools or modifying the existing ones in src/mcp_osxphotos/server.py.
To add a new tool, simply define a new function and decorate it with @mcp.tool(). The function's name will be the tool's name, and its parameters will be the tool's parameters. Inside the function, you can use the subprocess module to execute any osxphotos command you want.
Debugging with MCP Inspector
For a great debugging experience, use the MCP Inspector:
-
Published package:
npx @modelcontextprotocol/inspector uvx mcp-osxphotos -
Local development (no banners):
npx @modelcontextprotocol/inspector uv --directory /absolute/path/to/mcp-osxphotos run python src/mcp_osxphotos/server.py
The Inspector will display a URL you can open in your browser.
Warning:
- Avoid
mcp devwhen launching from GUI clients or inspector if your client parses stdout strictly as JSON-RPC. Themcp devwrapper prints a human-readable banner to stdout which can cause errors like “Unexpected token … is not valid JSON”. Running the FastMCP server directly viapython src/mcp_osxphotos/server.pyavoids this.
Lockfile maintenance
If you change dependencies or project metadata, regenerate the lockfile:
uv sync
Smoke tests
A tiny unittest-based smoke test suite is included to sanity-check the environment and a couple of tools:
python_versionreturns the running Python version and executable path.osxphotos_healthreports whether theosxphotosCLI is discoverable and, if so, where.
Run the tests with uv:
# Ensure a compatible Python is pinned (project requires >=3.11)
uv python pin 3.12
# Run unittest discovery
uv run python -m unittest discover -s tests -p 'test*.py' -q
Notes:
- The tests don’t require
osxphotosto be installed; they only report discovery status. Ifosxphotosis not found, the test still passes as long asosxphotos_healthreturns the expected JSON shape. - The tests add
src/tosys.pathso they work from a local checkout without installation.
Common pitfalls and troubleshooting
- ModuleNotFoundError: No module named 'mcp' when launching from a GUI:
- Ensure you launch with a Python that has project dependencies available. Prefer:
command: absolute path to your venv’s Python, orcommand:uvwithargs:["--directory", "/path/to/mcp-osxphotos", "run", "python", "src/mcp_osxphotos/server.py"].
- Ensure you launch with a Python that has project dependencies available. Prefer:
- JSON parse errors like “Unexpected token … is not valid JSON”:
- Don’t use
mcp devin your GUI config. It prints banners to stdout. Launch the server directly.
- Don’t use
- GUI apps often don’t inherit your PATH:
- Set
OSXPHOTOS_BINto the absolute path forosxphotos. - Consider using absolute paths for
uv,python, etc., in your client config.
- Set
License
This project is licensed under the MIT License. See the LICENSE file for details.
Publishing
Looking to release a version users can run via uvx mcp-osxphotos?
- Dry run on TestPyPI: see docs/publishing-test.md
- Real release to PyPI: see docs/publishing.md
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.