Guides
MCP Setup
Connect localPress to Claude Desktop, Cursor, or Claude Code via the first-party MCP server. 20 tools, 3 resources, one config block.
Connect localpress to an MCP host (Claude Desktop, Cursor, Claude Code, VS Code) and let an AI agent drive your media library directly.
localpress mcp is a stdio Model Context Protocol server. It exposes 20 typed tools and 3 resources, all backed by the same engine the CLI uses. Same binary, new entrypoint — no daemon, no hosting, no separate config.
What you get
- Typed tool surface — schemas advertise exactly which args each tool accepts; no more "agent guessed wrong about a flag" failures.
- Structured results — JSON objects, not text-blobs-that-happen-to-be-JSON.
- First-class capability discovery — the
localpress://capabilitiesresource is the same datalocalpress doctorreturns. - Zero new infra — runs as a child process of your MCP host, talks JSON-RPC over stdin/stdout.
Prerequisites
- Install localpress:
brew install gfargo/localpress/localpress(or see Getting Started). - Connect at least one WordPress site:
localpress init. - Verify with
localpress --version(must be1.14.0or later).
Configure your MCP host
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"localpress": {
"command": "localpress",
"args": ["mcp"]
}
}
}
Restart Claude Desktop. You should see localpress tools appear in the tools list.
Claude Code
Add via the CLI:
claude mcp add localpress -- localpress mcp
Or edit ~/.claude.json (or your project's .mcp.json):
{
"mcpServers": {
"localpress": {
"command": "localpress",
"args": ["mcp"]
}
}
}
Cursor
Edit ~/.cursor/mcp.json:
{
"mcpServers": {
"localpress": {
"command": "localpress",
"args": ["mcp"]
}
}
}
VS Code (Continue / GitHub Copilot)
Add to .vscode/mcp.json in your workspace, or to user settings depending on your MCP-aware extension. The structure mirrors the configs above.
Anything else
Any MCP host that supports stdio servers works. The invocation is always localpress mcp with no further arguments.
Verify it's working
After restarting your host, ask the agent:
"List my configured localpress sites."
The agent should call the sites_list tool and return the list. If it doesn't see the tools, check the host's MCP server logs (each host exposes them differently — Claude Desktop shows them in Settings → Developer → MCP logs).
What's available
Tools (33)
| Category | Tool | Description |
|---|---|---|
| Setup | sites_list | List configured sites |
| Setup | sites_use | Switch active site |
| Setup | sites_add | Add a new site non-interactively |
| Setup | sites_remove | Remove a site |
| Setup | doctor | Show backend capabilities |
| Setup | config_get / config_set | Read/write config values |
| Setup | config_list_profiles / config_get_profile / config_set_profile | Manage optimization profiles |
| Discovery | list | List media items (filters compose) |
| Discovery | show | Show attachment details |
| Discovery | stats | Cumulative processing stats |
| Discovery | audit | Find issues in the library |
| Discovery | references | Find where an attachment is used |
| Processing | optimize | Compress images |
| Processing | convert | Convert format (webp, avif, jpeg, png) |
| Processing | resize | Resize with max-width/max-height |
| Processing | remove_bg | Remove background (local AI) |
| Processing | caption | Generate alt text (Ollama) |
| Processing | generate_title | Generate short noun-phrase title (Ollama) |
| Processing | generate_description | Generate 2-3 sentence description (Ollama) |
| Processing | update_metadata | Directly set alt-text/title/caption/description (no AI) |
| Processing | classify | Detect image type (screenshot/photo/…); cached for smarter optimize defaults |
| Processing | tag | Generate 3-6 short tags; appends to caption as [tags: …] block |
| Processing | vision | Unified — generate alt/title/description/tags/classify in one call (print-only unless apply=true) |
| Library ops | pull | Download attachments |
| Library ops | push | Upload a local file |
| Library ops | delete | Delete attachments (default to trash; force: true for permanent) |
| Library ops | rename | Rename attachment slug (permalink); smart: true for vision-generated, to: '<name>' for explicit |
| Library ops | regenerate | Regenerate WP thumbnails |
| Library ops | export | Export media to ZIP/directory |
| Library ops | import | Bulk import local files |
| Time-machine | history_list | Browse sessions and snapshots |
| Time-machine | history_show | Show session or snapshot details |
| Time-machine | undo | Restore from snapshot(s); dry-run unless apply=true |
| Time-machine | history_prune | Apply retention policy |
| Automation | watch_status | Report watcher orchestration state (historical mappings) |
Resources (4)
| URI | Contents |
|---|---|
localpress://sites | All configured sites + active site marker |
localpress://stats | Cumulative processing stats for the active site |
localpress://capabilities | Backend capability matrix (which adapters are available, what each can do) |
localpress://history | Time-machine archive: recent sessions, snapshot count, storage used, retention status |
How it works
Each tool dispatches by recursively spawning the localpress binary with --json --quiet. The server captures stdout, parses the JSON, and returns it to the host as a structured result.
This means:
- Every CLI feature appears in the MCP server with zero per-tool engine code.
- New CLI features auto-propagate.
- The CLI's stable
--jsoncontract (which the skill already depends on) is reused.
Hot paths can migrate to in-process dispatch later for lower latency and progress streaming, without changing the tool schemas.
Site selection
Every tool accepts an optional site argument. When omitted, the active site from config is used — same behavior as the CLI's --site flag.
// Agent call against the active site
{ "name": "list", "arguments": { "unoptimized": true } }
// Agent call against a specific site
{ "name": "list", "arguments": { "site": "production", "unoptimized": true } }
Parallelism
Bulk tools (optimize, convert, resize, remove_bg, caption, export, import) accept an optional concurrency field. Without it, the CLI defaults to CPU count − 1. Set it explicitly for large libraries:
{ "name": "caption", "arguments": { "missingAlt": true, "apply": true, "concurrency": 4 } }
Bulk captioning ~300 images at ~6-18s each drops from 30-90 minutes serially to ~8-23 minutes at concurrency=4.
Safe-by-default for bulk operations
Tools that accept unoptimized: true or all: true (optimize, convert, resize, caption, remove_bg) mirror the CLI's safe-by-default behavior: they dry-run unless apply: true is also passed. Explicit ids execute immediately.
// Dry-run preview
{ "name": "optimize", "arguments": { "unoptimized": true } }
// Actually execute
{ "name": "optimize", "arguments": { "unoptimized": true, "apply": true } }
Not exposed via MCP
The following CLI commands intentionally don't appear as MCP tools — they require TTY interaction and aren't meaningful in an agentic context. Use the CLI directly for these:
init— interactive site wizard (usesites_addfor non-interactive registration)edit— opens a desktop editor, watches for saveswatch— long-running directory syncupdate— self-update the binarycompletions— emit shell completion scripts
Example agent workflows
Audit and fix in one session
"Audit my production site and optimize anything that's unoptimized."
The agent will:
- Call
doctorto verify the site is reachable. - Call
auditto find issues. - Call
optimizewithunoptimized: true, apply: trueto execute. - Call
statsto confirm savings.
Bulk caption missing alt text
"Generate Spanish-language alt text for every image on my site that's missing it."
The agent will:
- Call
captionwithmissingAlt: true, language: "Spanish", apply: true. - Stream the results.
Compose with a WordPress MCP server
If you also have a WordPress MCP server connected (mcp-adapter, docdyhr/mcp-wordpress, etc.), the agent can mix tool calls:
- Use the WP MCP to find a specific post's featured images.
- Use localpress
remove_bgto process them. - Use the WP MCP again to verify the updated
_thumbnail_id.
See AI Agent Integration for more composition patterns.
Troubleshooting
Tools don't appear in the host
- Restart the host after editing the config.
- Run
localpress mcpdirectly in a terminal — if it errors, you have a localpress install issue. - Check the host's MCP logs (each host exposes them differently).
"No active site" errors
The MCP server reads the same config as the CLI. Run localpress sites to confirm a site is active, or pass site: "<name>" explicitly in tool calls.
Slow tool calls
Each tool spawn carries ~50-200ms of process-startup overhead. For interactive single-shot operations this is invisible; for bulk ops where the underlying CLI work takes seconds, it's negligible. Long-running ops (bulk optimize, caption) return the final JSON only — no streaming progress yet (tracked for v1.x).
"Capability unavailable" errors
Some operations (regenerate, full reference scans, replace-in-place) require WP-CLI over SSH. Configure SSH in localpress init for those, or use the REST-only fallback path. See WP-CLI / SSH Setup.
See also
- AI Agent Integration — the markdown skill for hosts without MCP support
- Commands Reference — full CLI command list
- Getting Started — install and first-site setup
Sourced from the GitHub Wiki. Updates on each deploy.