DEV Community

WPPilot
WPPilot

Posted on

How to let Claude manage a WooCommerce store safely with a self-hosted MCP server

Giving an AI assistant access to a live store sounds like a great way to save an afternoon of catalogue work, right up until you picture it issuing a refund you didn't ask for. The honest answer to "can I let Claude run my WooCommerce admin?" is: yes, but only if the site enforces the limits, not the prompt.

This post walks through a setup I think is sane for a production store: a Model Context Protocol (MCP) server that runs inside WordPress itself, a least-privilege WordPress user for the agent, a server-side safety profile, and a change ledger you can roll back from. I'll use WPPilot as the concrete example because it is built around exactly this model, but the principles apply to any WordPress MCP setup.

Disclosure: the WooCommerce abilities described here are part of WPPilot Pro. The free plugin is a complete WordPress MCP server (posts, pages, media, menus, Elementor editing, safety profiles, ledger) but does not register WooCommerce abilities. I'll point out which parts are which.

Why not just hand the agent a REST API key?

WooCommerce already has a REST API, and you could give an agent consumer keys and let it call endpoints. Three problems show up quickly:

  1. Keys are broad. A read/write key can do anything the REST API allows. There is no notion of "edit products but never touch refunds".
  2. Endpoints are not decisions. The agent has to load a huge surface into context and guess which call is safe.
  3. There is no memory of what happened. If the agent changes 40 prices, you get 40 successful HTTP responses and no single place to review or undo them.

An MCP server layered on WordPress lets you move those decisions onto the site: which abilities exist, which ones are allowed right now, which need confirmation, and what gets recorded.

The architecture: the site is the server

With WPPilot, your WordPress install is the MCP server. There is no hosted relay in the middle: your AI client (Claude Code, Claude Desktop, ChatGPT, Cursor and so on) talks directly to an endpoint on your own domain:

https://your-store.com/wp-json/mcp/wppilot
Enter fullscreen mode Exit fullscreen mode

OAuth clients use /wp-json/mcp/wppilot-oauth. The plugin doesn't bundle an AI model and doesn't ask for your model provider key; the client brings its own model access.

Instead of exposing hundreds of endpoints, the agent works through a compact interface: discover what abilities exist, inspect one schema, then execute one typed ability. That keeps context small and makes every call something the server can check.

Step 1: Install and start in Read Only

Install the free plugin from the GitHub releases (wppilot.zip, uploaded through Plugins → Add New → Upload Plugin). Requirements are WordPress 6.9+ and PHP 8.0+, and HTTPS for anything reachable remotely.

Then go to WPPilot → Configuration. There are three safety profiles:

Profile What it allows
Read Only Discovery and inspection only. Every state-changing ability is blocked.
Production Safe Normal content, design, SEO, forms and commerce work. Blocks raw PHP, WP-CLI, filesystem, database, plugin/theme install and deletion, and temporary admin access.
Developer Full Access Every enabled ability, including privileged ones. Meant for staging and development.

For the first connection to a store, pick Read Only. You want to see what the agent can reach before it can change anything. The profile is enforced server-side on every call, so it holds whatever the model was told.

Step 2: Create a dedicated WordPress user for the agent

This is the most underrated step. Capability checks in WPPilot run against the connected WordPress user on every request, not once at connection time. So:

  • Create a user like agent-shop with the Shop Manager role rather than connecting as an administrator.
  • An agent connected as a shop manager cannot do anything that account couldn't do by hand in wp-admin.
  • If you demote or delete that user, the agent's access closes at that moment, not at the next token refresh.

It also makes your audit trail cleaner, though WPPilot goes further there (see below).

Step 3: Connect Claude

Open WPPilot → Connect, pick your client, and follow the generated instructions. For Claude Code, the OAuth route is one command:

claude mcp add --transport http wppilot \
  https://your-store.com/wp-json/mcp/wppilot-oauth
Enter fullscreen mode Exit fullscreen mode

OAuth 2.1 with PKCE is the recommended route wherever the client can open a browser. Access tokens last an hour, refresh tokens 14 days, and each authorization shows up under Connected Apps so you can revoke one client without touching the others. For clients that can't run a browser flow there are Application Passwords, and for headless callers (cron, the Claude Messages API MCP connector) there are revocable access tokens stored only as a SHA-256 digest.

Log in as the agent-shop user when the OAuth screen appears.

Step 4: Prove a read-only workflow

With Read Only on, ask for something useful that changes nothing:

"List variable products with any variation out of stock, and draft a short restock summary for me here in chat."

The agent discovers the WooCommerce abilities (with Pro active), inspects their schemas and reads the catalogue. If it tries anything that writes, the site refuses it. That refusal is the thing you're testing.

Step 5: Move to Production Safe and understand confirmation gates

Once reads look right, switch to Production Safe. Now ordinary catalogue work is allowed: editing product descriptions, adjusting stock, creating a variable product with its attributes and variations, adding order notes.

But anything touching money is classed destructive. Order status changes, refunds and price writes require an explicit confirmation flag on the call. A refund request through the MCP adapter looks like this:

{
  "ability_name": "wppilot/woocommerce-create-refund",
  "parameters": {
    "order_id": 123,
    "amount": "10.00",
    "refund_payment": false,
    "confirm": true
  }
}
Enter fullscreen mode Exit fullscreen mode

Without "confirm": true the call doesn't run. In practice that means the agent has to come back and ask you, and you get a chance to say no. Under Read Only it can't reach these abilities at all.

Writes are also rate-limited per credential, so a looping agent can't hammer your store.

Step 6: Review the change ledger

Every supported write lands in a redacted change ledger. Two details matter for stores:

  • It records which agent made the change, not just which user. If Claude Code and Cursor both connect as the same account, the ledger still distinguishes them by OAuth client id (stored hashed) or application-password UUID. Writes made from wp-admin or WP-CLI are recorded as direct rather than blamed on the last agent.
  • Rollback is offered for reversible operations and only succeeds when the observed state matches the expected fingerprint. Irreversible things, such as a real payment refund, are recorded as non-reversible and say so. The ledger doesn't pretend it can un-send money.

Secrets such as password, token, API key and cookie fields are redacted from the ledger.

Optional: require a human for every write

If you want a person in the loop no matter what, WPPilot Pro has an approval queue. Switch it on and every write waits on the Approvals screen, with email notification, until someone signs it off. The agent gets a structured "pending" response instead of a false success, so it knows to wait. Reads still run.

For a store, a reasonable progression is:

  1. Read Only, dedicated Shop Manager user: audits and reports.
  2. Production Safe with the approval queue on: the agent proposes, you approve.
  3. Production Safe with the queue off for routine catalogue edits, keeping confirmation gates for money.

What this does not protect you from

It's worth being explicit:

  • Your model provider still sees what the agent reads. The MCP server is self-hosted, but the AI client sends content to its model. Don't expose customer data to a provider whose retention terms you haven't checked.
  • Backups are still your job. The ledger is bounded (at most 500 records) and covers supported operations. It isn't a backup system.
  • Payment gateways are external. A refund that reaches your gateway is an external side effect.

A note on WooCommerce's own MCP work

WooCommerce has native MCP support in developer preview, built on the WordPress Abilities API and the official MCP Adapter. If a read-only view of your store is all you need, a focused single-purpose server may be the simpler install. The case for a broader control layer like WPPilot is when you want one connection that covers the store, the pages that sell from it, the page builder they were made in, and the same governance on every write.

Wrapping up

The pattern is the point: run the MCP server on the site, connect as a least-privilege user, enforce a safety profile server-side, gate anything involving money behind explicit confirmation, and keep a ledger you can roll back from. Do that, and letting Claude handle the tedious parts of store admin becomes a reasonable decision rather than a leap of faith.

If you want to try it, the free plugin and source are on GitHub (GPL-2.0-or-later), and the docs for safety profiles and client setup are at wppilot.co.

Top comments (0)