localPress

Guides

AI Agent Integration

Use localPress with Claude Desktop, Cursor, and other AI agents — via the first-party MCP server or the companion markdown skill.

localpress offers two paths to AI agent integration:

  1. MCP serverlocalpress mcp runs as a stdio Model Context Protocol server. Drop one config block into Claude Desktop / Cursor / Claude Code and the agent gets 20 typed tools and 3 resources. See the dedicated MCP Setup guide.
  2. Markdown skill — the older, no-protocol path. A markdown document that teaches an agent to shell out to the CLI. Still useful for hosts without MCP support or for composing with an existing WordPress MCP server.

This page covers the skill path. For first-party MCP integration, jump to MCP Setup.


The skill is a markdown instruction sheet that teaches AI agents how to drive the CLI and compose it with whatever WordPress MCP server you already have connected.

What is a Skill?

A skill is not a protocol server. It's a markdown document that:

  1. Teaches agents when and how to invoke localpress
  2. Composes with existing WordPress MCP servers
  3. Requires zero runtime dependencies
  4. Ages well (markdown doesn't break when MCP spec changes)

How It Works: Three-Step Composition

Step 1: Discover via MCP

Your AI agent uses its connected WordPress MCP server to find attachments:

# Example MCP tool call
wp_list_media --filter='unoptimized'

Step 2: Process via localpress

The agent runs localpress commands using your laptop's CPU/GPU:

localpress optimize 123 124 125 --json
localpress remove-bg 456 --json

Step 3: Verify via MCP

The agent uses the WP MCP again to verify changes:

wp_get_media 123 --fields=size_bytes,alt_text

Compatible WordPress MCP Servers

localpress composes with:

Official MCP Adapter

  • Developer: WordPress.org
  • Description: Bridges WordPress Abilities API to MCP. Ships in WP 6.9+ core.
  • GitHub: wordpress/mcp-adapter

docdyhr/mcp-wordpress

  • Developer: docdyhr
  • Description: 59 tools across 10 categories including media upload/list/update/delete.
  • GitHub: docdyhr/mcp-wordpress

Other WP MCP Servers

Any MCP server that exposes WordPress media operations will work. The skill teaches agents how to discover what's available.

Installation for AI Agents

For Claude Desktop

  1. Ensure localpress is installed: brew install gfargo/localpress/localpress
  2. Connect a WordPress site: localpress init
  3. The agent will automatically read the skill from: skill/SKILL.md

For Cursor

  1. Install localpress
  2. Connect a WordPress site
  3. The Cursor agent can reference the skill when working with WordPress media

For VS Code with MCP

  1. Install localpress
  2. Connect a WordPress site
  3. Ensure you have a WordPress MCP server configured
  4. Reference the skill for media optimization tasks

Example Agent Workflows

Background Removal Workflow

User: "Remove backgrounds from the last 5 product photos in my media library"

Agent:
1. Uses WP MCP to list recent media: wp_list_media --limit=5 --type=image
2. Runs localpress: localpress remove-bg 123 124 125 126 127 --json
3. Verifies with WP MCP: wp_get_media 123 --fields=url

Bulk Optimization Workflow

User: "Optimize all unoptimized images larger than 500KB"

Agent:
1. Uses WP MCP to find candidates: wp_list_media --filter='size_bytes>500000'
2. Runs localpress audit: localpress audit --unoptimized --larger-than 500000 --json
3. Processes: localpress optimize --unoptimized --larger-than 500000 --apply --json
4. Verifies: localpress audit --unoptimized --larger-than 500000 --json

Round-trip Editing Workflow

User: "Open the hero image in Photoshop and make it brighter"

Agent:
1. Finds hero image: wp_list_media --search='hero' --limit=1
2. Starts edit session: localpress edit 123 --with "Photoshop"
3. Instructs user: "I've opened the image in Photoshop. Make your edits and save. I'll sync automatically."
4. Monitors: Watches for file save, uploads changes

Skill Location

The skill lives at: https://github.com/gfargo/localpress/blob/main/skill/SKILL.md

Agents can:

  1. Read it directly from the repository
  2. Cache it locally for faster reference
  3. Use it as a prompt template for WordPress media tasks

Best Practices for Agents

Always Use --json

# Good (machine-readable)
localpress list --json
localpress optimize --unoptimized --apply --json

# Bad (human-readable, hard to parse)
localpress list
localpress optimize --unoptimized --apply

Check Installation First

# Verify localpress is installed
localpress --version

# Check site configuration
localpress doctor --json

Handle Errors Gracefully

  • Exit code 5: Authentication error → help user create Application Password
  • Exit code 6: Capability unavailable → suggest workarounds (WP-CLI, Enable Media Replace plugin)
  • Exit code 4: Network error → check site URL and connectivity

Compose, Don't Replace

  • Use WP MCP for WordPress operations
  • Use localpress for local processing
  • Never try to reimplement WP MCP functionality

Common Agent Prompts

Optimization Prompts

  • "Optimize all images on my WordPress site"
  • "Convert the gallery images to WebP format"
  • "Compress images larger than 1MB"

Background Removal Prompts

  • "Remove backgrounds from product photos"
  • "Make the background white on these portraits"
  • "Extract subjects from these images"

Audit Prompts

  • "Find images missing alt text"
  • "Show me duplicate images"
  • "Audit my media library for issues"

Editing Prompts

  • "Open this image in GIMP for editing"
  • "Let me edit the banner image locally"
  • "Sync my Photoshop edits back to WordPress"

Sourced from the GitHub Wiki. Updates on each deploy.