| 开发者 | royalpluginsteam |
|---|---|
| 更新时间 | 2026年8月1日 08:05 |
| 捐献地址: | 去捐款 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
pa_* taxonomies) — list registered attributes, list attribute terms, register new attributes, assign attributes to a product as variation axeswordpress/mcp-adapter package bridges abilities to the MCP protocol.
As of 1.4.38, every Royal MCP tool also registers as a WordPress ability. You get three ways to reach the same tools: (1) Royal MCP's native /wp-json/royal-mcp/v1/mcp endpoint (unchanged and always available), (2) the WordPress MCP Adapter if you install it — Royal MCP registers a named royal-mcp-server alongside adapter's default server, or (3) WordPress core REST directly at /wp-json/wp-abilities/v1/abilities/{name}/run. Same handlers, three transports, one set of per-tool capability gates. The abilities layer can be disabled with a single option flag if needed.
Royal MCP is a complete, production-ready MCP server that predates the official adapter. It runs the full Streamable HTTP transport, enforces API key authentication on every request, ships OAuth 2.0 for Claude Desktop's native connector flow, rate-limits per-IP, redacts sensitive data, and logs every interaction. Out of the box it includes 73 tools for WordPress core operations plus 71 integration tools that auto-load when WooCommerce, GuardPress, Royal AI Firewall, SiteVault, ForgeCache, Royal Ledger, Royal Links, Elementor, Advanced Custom Fields (ACF), or Redirection is active.
Supported AI Platforms
X-Royal-MCP-API-Key header).
* Custom field plugins - Advanced Custom Fields (ACF) has dedicated acf_* tools that return values formatted per each field's Return Format setting (the same way the ACF UI shows them). MetaBox, JetEngine, Pods, CPT UI, and Custom Field Suite are supported through the wp_get_post_meta / wp_update_post_meta tools, so AI agents can populate custom fields just like a human editor.
* Page builders - Elementor has dedicated tools for clone-and-customize workflows (clone a page, find/replace text, swap images, get an outline, import templates) - see the Tools list. Widget-level creation from scratch is intentionally out of scope. Divi, Beaver Builder, Bricks, Gutenberg, Spectra, and Stackable store standard post content that is readable and writable by AI; page-builder-specific JSON storage is opaque unless covered by a dedicated tool.
* Multilingual - WPML, Polylang, TranslatePress, qTranslate. Translated posts appear as separate posts and can be read or written via the standard post tools.
* AI agent frameworks - LangChain, AutoGen, CrewAI, LlamaIndex, Haystack - any MCP-compatible framework can call Royal MCP's tools.
* AI app platforms - Anthropic Console, OpenAI Playground, Google AI Studio, Vertex AI, Azure AI Studio, Amazon Bedrock Console.
MCP Spec Compliance
Royal MCP implements the MCP 2025-11-25 Streamable HTTP transport specification:
/mcp endpoint for all JSON-RPC communicationroyal-mcp folder to /wp-content/plugins/Model Context Protocol (MCP) is an open standard created by Anthropic that lets AI assistants interact with external data sources. Without MCP, AI tools like Claude or ChatGPT can only work with content you copy and paste into them. With Royal MCP installed, these AI platforms can directly read your WordPress posts, create new content, manage your WooCommerce products, check your security status, and trigger backups — all through a structured, authenticated protocol.
Security. Most MCP plugins — and 41% of all public MCP servers — have no authentication at all. Royal MCP requires an API key for every session, rate-limits requests to prevent abuse, logs every interaction for audit purposes, and filters sensitive data (emails, PHP version, admin credentials) from responses. We built this plugin with the same security standards we apply to GuardPress, our WordPress security plugin used on thousands of sites.
No. WordPress 6.9 added the Abilities API — a primitive for registering AI-callable functions — and the wordpress/mcp-adapter package bridges abilities to the MCP protocol. Royal MCP is a full MCP server with the security layer, connector flows, and plugin integrations that the bare primitive does not include: enforced API key auth, OAuth 2.0 for Claude Desktop, per-IP rate limiting, audit logging, sensitive-data redaction, 73 ready-to-use WordPress core tools, and 71 integration tools that auto-load for WooCommerce, GuardPress, Royal AI Firewall, SiteVault, ForgeCache, Royal Ledger, Royal Links, Elementor, Advanced Custom Fields, and Redirection.
Yes. When WooCommerce is active, Royal MCP automatically adds 26 MCP tools spanning product management (simple and variable, including variation CRUD and global attribute management), full coupon management (list/get/create/update/delete + bulk trash purge), order management (view, update status), customer data, and store statistics. No additional configuration is needed — the tools appear automatically in the MCP tools list.
Yes, with safety controls. Royal MCP exposes two tools for plugin configuration:
wp_get_plugin_settings lets AI read any plugin's stored settings by slug. Sensitive values (API keys, secrets, tokens, passwords, license keys, OAuth credentials) are automatically replaced with [REDACTED] before they leave your server, so AI assistants can understand a plugin's configuration without ever seeing stored credentials.wp_update_option lets AI write to WordPress options, but only after passing three security gates:blogname, blogdescription, posts_per_page, date_format, time_format. Plugin authors opt their own settings in via the royal_mcp_writable_options filter.add_filter('royal_mcp_writable_options', fn($opts) => array_merge($opts, ['my_plugin_settings']));
Install Royal MCP, go to Royal MCP → Settings, and copy your API key and MCP server URL. In Claude Desktop, add a new MCP server configuration with the URL and include the X-Royal-MCP-API-Key header with your API key. Full step-by-step guide at royalplugins.com/support/royal-mcp/. If the connection fails, see the next FAQ.
About 90% of "can't connect" / "OAuth failed" / "tools missing" issues resolve in a basic 4-step pass before any host-specific fix is needed. In order: (1) update Royal MCP to the latest version (every recent release fixes meaningful OAuth edge cases), (2) run a conflict test — deactivate all other plugins, switch to a default theme like Twenty Twenty-Five, and purge every cache layer (any cache plugin, your host's server-level cache, Cloudflare/CDN, and browser cache), (3) wipe stale OAuth state — use the Reset OAuth State button in Royal MCP → Settings if you're on 1.4.17 or newer, or run the four DELETE SQL queries documented in our support article, (4) check Royal MCP → Activity Logs for the most recent oauth: row, which records exactly which validation rule fired. Full walk-through with copy-pasteable commands at royalplugins.com/support/royal-mcp/troubleshooting-start-here.html. Only proceed to host-specific fixes (Cloudflare AI Bots toggle, SiteGround /.well-known/ static files, edge-cache exclusions) after the four basics are ruled out — most "advanced infrastructure" tickets we receive actually resolve in those four steps.
When you restore from backup, the OAuth client credentials Claude was holding no longer match anything on the WordPress side, so Claude's connector ends up with a stale token that no Royal MCP installation will accept. The fix in Royal MCP 1.4.17+ is one click: go to Royal MCP → Settings and click the Reset OAuth State button. This wipes all stale OAuth clients, issued access/refresh tokens, and pending authorization codes. Then in Claude, delete the existing connector entirely, wait 30 seconds, and re-add it from scratch — the full OAuth flow runs fresh against the cleaned-up state and the connection works. On 1.4.16 or older the same effect can be achieved by running four DELETE SQL queries documented at royalplugins.com/support/royal-mcp/troubleshooting-start-here.html. The plugin's settings, API key, and Activity Log are not affected by Reset OAuth State — only the OAuth handshake state.
Both messages (plus "no tools available" in Claude.ai after connecting) usually mean one of Royal MCP's OAuth or sessions database tables is physically missing. The fix is to update Royal MCP to 1.4.29 or newer — the new runtime healer detects missing tables and recreates them automatically on the next pageload, with no deactivate/reactivate required. After updating, delete the existing Royal MCP connector in Claude, wait 30 seconds, then re-add it fresh. If you can't update yet and need to recover immediately, the manual workaround is wp option delete royal_mcp_db_version followed by loading any wp-admin page. Full symptom diagnostic (phpMyAdmin / WP-CLI), the auto-heal explanation, and the manual recovery walkthrough are at royalplugins.com/support/royal-mcp/oauth-tables-missing.html.
/wp-json/royal-mcp/v1/. Where are they?By design, Royal MCP's OAuth endpoints (/register, /token, /authorize) are registered as top-level WordPress rewrite rules at the site root, not as REST API routes under /wp-json/royal-mcp/v1/. This is required by the OAuth 2.0 specification (RFC 6749) and the MCP discovery specs (RFC 8414 and RFC 9728), which mandate predictable site-root paths so OAuth-discovery-aware clients can find them without per-plugin configuration. If you're auditing rewrite rules instead of REST routes, you can see ours via wp rewrite list | grep royal_mcp_oauth from WP-CLI. The /wp-json/royal-mcp/v1/ namespace contains the JSON-RPC tool endpoint at /mcp plus supporting REST routes (/posts, /pages, /site, etc.) — but not the OAuth handshake endpoints themselves. Both routing layers are normal and both need to be reachable for the connector to work end-to-end.
Royal MCP is designed with defense in depth. API key authentication is required for all MCP sessions. Rate limiting prevents abuse (60 requests per minute per IP). Activity logging records every tool call. Sensitive data is filtered — user emails, usernames, admin email, PHP version, and stored credentials inside plugin settings (api keys, secrets, tokens, passwords) are never exposed through MCP. Comment creation respects your WordPress moderation settings. Post meta values are sanitized before storage. Option writes are disabled by default and gated by three independent checks (admin toggle, allowlist, hard denylist) when enabled. The plugin itself starts disabled by default — nothing is accessible until you explicitly enable it.
Yes. Royal MCP supports Ollama and LM Studio for fully local AI inference. When using local models, no data leaves your server — the AI model runs on your own hardware and communicates with WordPress through the MCP protocol on localhost.
Royal MCP performs a clean uninstall. All plugin options, database tables (activity logs), transients, and user meta are removed. No orphaned data is left behind.
Yes. Any MCP-compliant client can connect to Royal MCP. Configure your IDE or client with the MCP server URL (https://yoursite.com/wp-json/royal-mcp/v1/mcp) and the API key (sent in the X-Royal-MCP-API-Key header). Claude Desktop additionally supports the native "Add Connector" OAuth 2.0 flow, which Royal MCP handles via Dynamic Client Registration (RFC 7591) — no manual API key management required on that path. The same OAuth flow works in any client that follows the MCP 2025-11-25 spec.
Yes. Royal MCP exposes WordPress's standard wp_get_post_meta, wp_update_post_meta, and wp_delete_post_meta tools, which read and write any custom field — including Advanced Custom Fields (ACF), MetaBox, JetEngine, Pods, CPT UI, and Custom Field Suite. AI agents can populate ACF fields, set repeater rows, update flexible content blocks, and read computed fields just like a human editor working in the WordPress admin.
No. The MCP endpoint is a REST route that runs only when an authenticated AI client makes a request — it does not run on visitor-facing pages, frontend templates, or admin screens (except its own settings page). The activity log uses a single indexed database table and writes asynchronously after the response is sent. Rate limiting (60 requests/minute per IP) prevents accidental overload.
Yes, on a per-site basis. Each site in a multisite network has its own API key, its own activity log, and its own settings. AI clients connect to a specific site's MCP endpoint — Royal MCP does not bridge requests between sites in the network.
Yes. The wp_get_posts and wp_create_post tools accept a post_type parameter and validate it against registered public post types, so private or internal post types are not exposed. Plugin authors can disable specific tools entirely with the royal_mcp_disabled_tools filter, or scope the option-write allowlist with royal_mcp_writable_options. WordPress's standard capability checks also apply to every tool call.
Yes. Translated posts appear as separate WordPress posts (each with its own ID and language meta) and are readable or writable via the standard wp_get_posts, wp_create_post, and wp_update_post tools. AI agents can list posts in a specific language by filtering on the language meta key, or translate a post and write the corresponding translation by ID.
Every authenticated MCP request is logged to the Royal MCP activity log with timestamp, client IP, tool name, parameters (sensitive values redacted), and response status. The log is filterable by time range, client, tool, or status code, and exportable to CSV. The log page refreshes via AJAX so you can watch active sessions in real time.
royal_mcp_connection_health tool now returns active page-builder versions (Divi, Elementor, WordPress core) so agents can plan multi-step operations without a probe call..mcpb bundle for one-click Claude Desktop install.royal_mcp_connection_health diagnostic tool returns route, auth method, session ID, and version details for any authenticated caller.elementor_get_widget_settings tool reads full settings for a single Elementor widget, container, section, or column by ID.wp_update_post and wp_update_page now accept menu_order, post_parent, password, comment_status, ping_status, excerpt, and post_author fields and return actual stored values so silent-drop by WordPress is surfaced rather than hidden.royal_mcp_tool_context hook fires alongside the legacy royal_mcp_tool_called action with an enriched payload for downstream firewall integrations.wp_get_seo_meta now correctly reports noindex state on Rank Math sites, and wp_update_seo_meta responses reflect actual stored values rather than requested values.wp_get_site_status tool returns WordPress, PHP, MySQL, plugin, theme, and environment info in a single call.wp_get_error_log_tail tool returns the last lines of the debug log with optional keyword filtering.wp_get_cron_schedule tool lists every scheduled event with next-run time and overdue flag.royal_mcp_meta_value_sanitizer filter lets sites customize per-key sanitization.wp_get_terms and wc_get_orders include a total_count field.wp_update_post_meta accepts any JSON type (string, number, boolean, array, object).wp_add_post_meta tool adds a meta row without overwriting existing values under the same key.wp_get_terms tool lists terms in any registered taxonomy with pagination.wp_create_post, wp_update_post, wp_create_page, and wp_update_page accept a date parameter for scheduling and backdating.future, pending, and private.royal_mcp_tool_called action hook fires after every MCP tool invocation with (tool_name, status, error_message).wp_search accepts optional snippet and per_page parameters for excerpted results.wc_get_orders accepts a page parameter and returns {orders, page, per_page, total, total_pages}.wp_delete_post capability check runs before the post-existence lookup.wp_get_post_meta requires edit_post capability for protected (underscore-prefixed) meta keys.id or post_id.elementor_add_widget tool builds Elementor pages widget by widget, with curated shortcuts for the 11 most common widget types and raw passthrough for the long tail.elementor_add_widget rejects unknown widget-type slugs at the boundary./register self-heals when the OAuth tables are missing.uninstall.php also removes the royal_mcp_db_version option for a fully clean slate on reinstall.Authorization: Bearer header in addition to the existing X-Royal-MCP-API-Key header.wp_get_seo_meta and wp_update_seo_meta cover the post URL slug alongside the existing SEO fields.wp_royal_mcp_sessions table.acf_get_field, acf_get_fields, acf_update_field, acf_get_field_groups).wc_create_product respects the type argument and creates the matching WooCommerce product class (Simple, Variable, Grouped, External)./register..well-known/ self-check detects when a plugin or theme intercepts the discovery endpoint with an HTML page.elementor_clone_page, elementor_replace_text, elementor_replace_image, elementor_get_page_outline, elementor_list_local_templates, elementor_import_template)..well-known/oauth-authorization-server files.wp_update_menu_item and wp_reorder_menu_items preserve fields that were not included in the update.wp_royal_mcp_oauth_auth_codes table with atomic single-row consume.tools/call requests write a structured Activity Log entry on every invocation (argument keys logged, values excluded)./token, /register, or /authorize failure (auth codes, PKCE verifiers, secrets, and tokens are excluded)./wp-json/royal-mcp/* responses send Cache-Control: no-store, no-cache, must-revalidate, private.WWW-Authenticate: Bearer per RFC 7235.WWW-Authenticate: Bearer resource_metadata="..." per RFC 9728 so web-based MCP clients trigger OAuth discovery correctly./.well-known/oauth-authorization-server and surfaces a dismissible admin notice with the manual fix./register, /token, /authorize) send Cache-Control: no-store by default.protocolVersion bumped to 2025-11-25 to match current Claude Desktop builds.Allow: POST, DELETE, OPTIONS.wp_get_taxonomies returns a slug field alias; wp_get_term_meta returns a structured response matching the rest of the term-meta family.wp_update_term, wp_get_term_meta, wp_update_term_meta, wp_delete_term_meta, wp_get_taxonomies.wp_create_term, wp_delete_term, and wp_add_post_terms accept any registered taxonomy.wp_create_term accepts an optional slug; wp_create_post and wp_update_post accept a post_author user ID.wp_get_seo_meta, wp_update_seo_meta) auto-detect the active SEO plugin and read/write title, description, focus keyword, robots, and OG fields.royal_mcp_writable_theme_mods allowlist filter.POST /register) returns a real 500 with the underlying error when the DB write fails.wp_get_plugin_settings tool returns wp_options matching a plugin slug with sensitive keys redacted.wp_update_option tool gated by an admin toggle (off by default), the royal_mcp_writable_options filter, and a hard denylist for sensitive option names.wp_get_option redacts sensitive keys; outbound HTTP timeouts reduced to 10 seconds.wp_upload_media_from_url (SSRF-hardened), wp_upload_media (base64), wp_set_featured_image, and wp_update_media.wp_create_post and wp_update_post accept featured_media attachment ID.wp_get_posts and wp_create_post accept post_type, and a new wp_get_post_types tool discovers all registered public post types./.well-known/oauth-authorization-server.X-Royal-MCP-API-Key header) with rate limiting at 60 requests per minute per IP and timing-safe comparison.royal-mcp; menu slugs updated for wp.org compliance.royal_mcp_allowed_origins filter.