How it works
WP Agent Bridge exposes 53 abilities via the MCP protocol. Each call follows a precise journey, from the MCP client to confirmation, with a safety net at every step.
A call’s journey
The seven steps in detail
1. MCP Client
The AI agent (Claude, GPT, Devin, or any MCP client) sends a JSON-RPC request to the server. The request contains the ability name (e.g. wpab/update-post) and its arguments.
2. Bearer route
The request arrives on the dedicated endpoint /wp-json/wp-agent-bridge/mcp. The server verifies the bearer token (e.g. wpab_****). Without a valid token, the request is rejected with a 401 error.
3. Mode and window check
The plugin checks the current mode (READONLY or APPLY) and the write window state. In READONLY, any write ability is refused. In APPLY, the window must be open (15 to 240 minutes).
4. Snapshot
Before any write, a snapshot of the affected row is captured across six tables: posts, postmeta, options, terms, term_taxonomy, term_relationships. This is the safety net.
5. Write
The write is executed on the database. If the write fails, the snapshot enables automatic rollback. If it succeeds, an operation_id is generated.
6. Loopback verification
After the write, the plugin verifies the site responds with HTTP 200. If the site is broken (500 error, blank page, PHP fatal), the operation is rolled back and the site restored from the snapshot.
7. Confirmation
The response returns ok: true, the operation_id, and the verification result. The agent can then chain the next operation or request a rollback if the result is unsatisfactory.
Two modes, one switch
Text equivalent: In READONLY mode, Read, Options, SEO and Diagnostics families are available. Write, Media and Snapshots families are locked. When switching to APPLY, all families become active. The APPLY window lasts 15 to 240 minutes, then the site reverts to READONLY.
Typical workflow
- The agent opens the APPLY window (
wpab/open-apply-window). - For each write: dry-run (
dry_run=true) then apply (dry_run=false+confirmation_token). - Each write generates an
operation_idand a snapshot. - If a problem occurs:
wpab/rollback-operationwith theoperation_id. - At the end:
wpab/close-apply-windowto return to READONLY.