Agent Bridge is a WordPress MCP (Model Context Protocol) and REST bridge plugin, designed for AI agents to manage the SEO, schema, and security of self-hosted WordPress sites (WordPress.org installations, not WordPress.com). It is often used together with EMCP, which handles Elementor layout editing. Claude Code is the primary documented client, but any MCP client (such as Cursor, Windsurf, Codex CLI, Gemini CLI) can connect to the REST interface through the official WordPress MCP Adapter endpoint or a WordPress application password.
Purpose
Agent Bridge addresses a layer that Builder-type tools often ignore: Rank Math SEO fields, JSON-LD schema, content snapshots, and verifiable convergent restoration. It does not write to _elementor_data; instead, it divides responsibilities with EMCP—EMCP edits pages, while Agent Bridge handles SEO, schema, and the safety net.
Main Capabilities
Verifiable Writes
After every SEO field or schema write, it immediately reads back from the database via get_post_meta(). It reports success only if the read-back matches, accounting for WordPress's own type conversions (array order, numeric-string image IDs). If it does not match, the route returns 500, along with the field name, the value attempted to be written, and the value the database actually holds.
Stable Content Hash
Each page and post has a SHA-256 hash, automatically recalculated when the post itself, Elementor data, SEO fields within the bridge's scope, or Rank Math schema metadata change. The hash covers post_content, the verbatim Elementor data block, and the sorted SEO and schema metadata, so calling /snapshot/manifest reveals whether every page and post across the site has been modified since it was last viewed.
Verifiable Restoration
Restoring a snapshot document requires first passing two independent proofs: first, the document is self-consistent—the confirm token in the request must equal the hash declared by the document itself, andThe hash recalculated from the document content must match; second, the caller must prove that it has just read the article's real-time state, that is, provide the request header required by the Additive-Only gate. After both gates pass, the restore will converge the article content, Elementor data, SEO, and schema to the state described by the document, and delete fields not mentioned in the document, finally returning the resulting document for direct inspection.
Additive-Only Gate
For articles that already existed before Agent Bridge was activated, writes are denied by default unless the request proves that a fresh snapshot of the article was just captured by sending the article's current content hash in the X-Agent-Bridge-Confirm request header. Content created after activation is not subject to this restriction. Sites can disable this gate via the agent_bridge_additive_only filter.
Two Master Switches
Two PHP constants set in wp-config.php are checked before other logic: AGENT_BRIDGE_DISABLED makes all routes (including reads) return 503; AGENT_BRIDGE_READ_ONLY rejects all writes (including the ?rebuild=1 hash backfill of the snapshot manifest issued via GET), but reads work as usual. Both are configuration-time switches and are not exposed through the API.
Cache Purging and Verification
Cache purging is a separate route, POST /cache/purge, intentionally not merged into the write route, to support the sequence of "write, purge LiteSpeed cache, read back to verify," avoiding verification reads encountering stale pages in the cache.
Abilities API and MCP
When the WordPress Abilities API is present (built into WordPress 6.9+, or added to older core via the standalone mcp-adapter plugin), Agent Bridge registers eight abilities under the agent-bridge category. Each ability sets meta.public = true and is automatically exposed as an MCP tool by the official mcp-adapter. Each ability's permission_callback performs the same permission, read-only, and additive-only checks as its REST counterpart. The restore operation is deliberately not registered as an ability and remains REST-only, because its requestbody (the full snapshot document) is not suitable for the Abilities API's typed input schema.
Supported SEO Fields
GET/POST /posts/{id}/seo covers 15 Rank Math fields. Sending an empty string, empty array, or null clears that field to its default value. The *_image_id fields coexist with the regular *_image URL fields: the Rank Math front end resolves custom Open Graph or Twitter images only through the _id fields, so both must be set for the image to display.
Usage
Requirements
- WordPress 6.9 or higher.
- PHP 8.1 or higher.
- HTTPS: enforced for all routes, proxy-aware, and can be disabled only for local development via the agent_bridge_allow_http filter.
- Rank Math: required only for the SEO and schema routes; the plugin can be activated without it.
- LiteSpeed Cache: required only for the /cache/purge route.
- WordPress Abilities API and the official mcp-adapter plugin: required only when you want to expose the eight abilities as MCP tools instead of calling REST directly.
Installation
- Download agent-bridge.zip from the latest release (do not use GitHub's "Source code" archive), upload it via "Plugins → Add New → Upload Plugin," or extract it to wp-content/plugins/agent-bridge/.
- Activate Agent Bridge on the Plugins page.
- Create a WordPress application password for the account the agent uses: Users → Profile → Application Passwords. Minimize the role as needed: the SEO and schema routes require only edit_post permission on the target article, and an Editor account is sufficient for regular content work. Site-level routes (/health, /restore/{id}, /cache/purge, the ?rebuild=1 backfill of the snapshot manifest) require manage_options and must use an administrator-capability account.
- Call /health to confirm that the pluginitems reachable (this call requires the admin credentials from the previous step).
Typical workflow
Canonical configuration for Claude Code + EMCP + Agent Bridge: install both plugins on the same self-hosted WordPress, create one application password for both to authenticate, connect each according to its own documentation, and state the division of labor in the project instructions—"EMCP edits layout; Agent Bridge is the source of truth for SEO, schema, and security, and should be called before and after any layout edit." Example: "Update the hero section, then fix the page title and meta description"—Claude first edits the hero with EMCP, then calls Agent Bridge's POST /posts/{id}/seo to update rank_math_title and rank_math_description, and reads back the confirmed values before reporting completion. See docs/CLAUDE-CODE-SETUP.md for the full setup.
Route reference
All routes are in the agent-bridge/v1 namespace:https://example.com/wp-json/agent-bridge/v1/...。每个路由要求 HTTPS and an authenticated WordPress user. Every write is appended to a rolling 50-entry audit log (timestamp, user, route, post ID, readable via the agent_bridge_audit option); no route executes raw SQL, writes to the filesystem, or makes outbound HTTP requests.
Limitations and notes
- Only self-hosted WordPress (WordPress.org installation) is supported; WordPress.com is not supported.
- Restore operations are not registered as MCP capabilities and can only be invoked via REST with a double-confirmation token.
- Writing to a post that existed before activation requires providing the current content hash in addition, otherwise it is rejected.
- Image fields require both the URL and _id fields to be set in order to display on the front end.
- The ?rebuild=1 backfill of the snapshot manifest is a write issued via GET and is likewise rejected in read-only mode.
- Specific performance metrics, fees, and pricing information are not currently provided.