Let an AI agent run WP-CLI safely
How to let an AI agent run WP-CLI safely on a WordPress site through the WP Waterfall MCP server, with an allowlist, a two step confirm, and no shell.
The WP Waterfall team · Workflow

This post is for developers and site owners who already use Claude, Cursor, or another assistant and want to let an AI agent run WP-CLI safely on a real site. It covers the setup, the three rules that make it safe, and the parts we left out on purpose.
MCP, the Model Context Protocol, is how an assistant calls tools on another service.
WP Waterfall runs a hosted MCP server at https://mcp.wpwaterfall.com. It wraps our public API,
so the agent gets the same tools you have and never more.
Connect in two minutes
In Claude Code:
claude mcp add --transport http wpwaterfall https://mcp.wpwaterfall.com
Then run /mcp, choose Authenticate, and sign in. In Claude.ai, add it as a custom connector with
the same address. The Connect an app screen shows the app name, the address your browser returns
to, the company, and your role. Pick Full access or Read only, then Approve. Approve only
connections you started.
The connection acts as you. The API checks your role on every call, so a Viewer's agent sees only read tools, and a member limited to three sites stays limited to them. Revoke it at any time from Integrations, then Connections.
Rule 1: there is no shell
The agent never gets a terminal. The run_wp_cli tool takes one WP-CLI command, and the command
passes an allowlist three times: in the client as advice, at the API, and again in the agent on
the server that runs it. plugin install, eval, and anything that writes code on live is
refused with a reason and a link to the docs. The API answers 422 with the same link.
# reads run at once
plugin list --update=available
option get siteurl
# writes work in two steps
transient delete --expired
plugin deactivate some-plugin
Code writes on live are refused for the agent because they are refused for everyone. Live code is a read only release, and the rule is in the API, not in a prompt. An agent that really wants to install a plugin on live gets the same 422 you would.
Rule 2: a write is two calls, and you say yes in the chat
Any tool that deletes, spends money, deploys, rolls back, restores over live, or changes access
works in two steps. The first call changes nothing and answers "Needs confirmation" with what
would happen and what it costs. The assistant asks you. Only if you say yes does it call again
with confirm: true. deploy_to_live lists the commits that would go live. A site delete also
needs the exact site name typed by you, which the assistant passes through and never fills in.
run_wp_cli follows the same rule: a read runs at once, and a write works in two steps.
search_replace is a dry run until dry_run is false and confirm is true, and the dry run
reports counts per table. There are no pop ups and nothing client specific, so the flow is the
same in Claude, in Cursor, and in a script.
Rule 3: site text is data, never instructions
WP-CLI output, log lines, database rows, and build output come from your site and its visitors.
Any of them can hold a sentence aimed at the model. Tools that return such text add an
untrusted_content field that says it is data, and log resources fence it between
[BEGIN SITE DATA] and [END SITE DATA] lines. The server instructions tell the assistant that
only you, in the chat, can ask for a change. We cannot promise a model never slips. We can promise
that a slip still hits the allowlist and the confirm step.
Every call lands in the audit log as an MCP agent, with the client name and version, the tool, the site, and whether it carried a confirmation.
What we left out on purpose
No raw shell, no eval, no db query without the credentials permission and a recent sign in,
no key that lasts more than a year, and no key that can make more keys. An agent can create an
API key for a tool such as DDEV, but the key expires in 30 days unless you say otherwise and never
holds the delete scope.
If you use Claude, download the skills zip from the Connections tab. It teaches the model how the pipeline works, including that live is read only, so it stops guessing. See Claude skills and MCP server.
What to do next
Connect with Read only first. Ask the agent which plugins have updates on staging. When the answers are right for a week, reconnect with full access and let it run the updates, one confirm at a time.
Read next
Related articles
Workflow · November 9, 2026How to run WordPress locally with DDEVHow to run WordPress locally with DDEV, step by step: install, start a site, set the PHP version, import a database and uploads, and take snapshots.
Workflow · September 23, 2026Run WordPress locally with DDEV against a real siteHow to run WordPress locally with DDEV against a real site: pull code, database, and uploads from WP Waterfall, edit, and push code back to staging.
Workflow · September 18, 2026Immutable live codeWhen a site uses Git, nothing writes PHP on the live environment. Code changes on staging, a deploy copies a release to live, and a rollback undoes it.