| 开发者 | royalpluginsteam |
|---|---|
| 更新时间 | 2026年5月14日 13:25 |
| 捐献地址: | 去捐款 |
| 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.
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 67 tools for WordPress core operations plus 49 integration tools that auto-load when WooCommerce, GuardPress, SiteVault, ForgeCache, Royal Ledger, or Royal Links is active.
Supported AI Platforms
X-Royal-MCP-API-Key header).wp_get_post_meta / wp_update_post_meta tools read and write any custom field, so AI agents can populate ACF fields just like a human editor./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, 67 ready-to-use WordPress core tools, and 49 integration tools that auto-load for WooCommerce, GuardPress, SiteVault, ForgeCache, Royal Ledger, and Royal Links.
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/.
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.
/token, /register, or /authorize request fails. Pre-1.4.16 every OAuth failure exited silently — no error_log(), no Activity Log entry, no admin-visible trace. Customers and support had to enable WP_DEBUG_LOG and patch the plugin source to surface the failing validation rule (PKCE mismatch, redirect_uri mismatch, expired code, unknown client_id, CSRF nonce failure, etc.). Each entry now records the OAuth error code, our error description, HTTP status, request URI, IP, User-Agent, and the public client_id / grant_type / response_type when present. Auth codes, PKCE verifiers, client secrets, refresh tokens, and access tokens are explicitly excluded from the log payload. Surfaced after a customer support thread where a /token POST returned HTTP 400 from inside the plugin with a 89-byte body that no log on the customer's side captured.api_key field value alongside the regenerate flag, and the sanitize callback checked api_key before regenerate_api_key — so clicking Regenerate did nothing, customers kept the same key indefinitely, and any "I rotated my key" troubleshooting step was a no-op. Sanitize order is flipped: regenerate_api_key is now checked first, then api_key, then the fallback. Resolves a customer-reported key rotation failure on SiteGround.bin2hex(random_bytes(16))) instead of 32-character mixed-case alphanumeric (wp_generate_password(32, false)). Mixed-case keys produced visually-ambiguous characters in monospace admin fonts (uppercase O vs digit 0, uppercase I vs lowercase l vs digit 1, lowercase o vs digit 0) — customers transcribing keys into Claude Desktop / mcp-remote configs by hand would silently flip a character at the visually-identical position and hit "Invalid API key" with no obvious cause. Hex eliminates the ambiguity. Existing keys keep working — only newly-regenerated keys use the new format. Same entropy (128 bits) as before.mcp-remote npx processes ("Session not found or expired" followed by a rapid reinitialization loop). Active sessions now live until 24 hours of true idle. Eliminates the thundering-herd reconnect pattern customers were seeing./wp-json/royal-mcp/* REST namespace now send Cache-Control: no-store, no-cache, must-revalidate, private and Pragma: no-cache on EVERY response — including the MCP endpoint, the /posts, /pages, /site, /search, /products/* REST_Controller routes, unauthenticated 401s, invalid-token 401s, the 405 method-not-allowed for GET-with-auth, and all successful JSON-RPC replies. Pre-1.4.15 these responses had no cache headers, so URL-keyed edge caches (Cloudflare, host-level fastcgi cache, intermediary proxies) could cache an auth-error response and serve it back to subsequent authenticated requests indefinitely — and could even cache an authenticated 200 response and serve it back to unauthenticated requests, leaking data. Reproducer surfaced during a behavioral audit: bare GET /wp-json/royal-mcp/v1/mcp returned a stale "Authentication required" response regardless of whether the API key header was present, while the same URL with any query string busted the cache and worked correctly. Implemented as a global rest_post_dispatch filter scoped to the namespace, plus per-response edits in MCP\Server.php for belt-and-suspenders coverage. The 1.4.13 fix that added no-store to OAuth endpoints (/register, /token, /authorize) was a partial implementation; this completes it.WWW-Authenticate: Bearer header. Per RFC 7235, 401 is the correct status for "credentials provided but invalid" and 403 is reserved for "authenticated but lacking permission". RFC 9728-aware MCP clients (Claude.ai web, ChatGPT) trigger their OAuth discovery flow on 401, not 403 — so the wrong status was suppressing legitimate fallback to OAuth when an API key was misconfigured./wp-json/royal-mcp/v1/mcp) now return HTTP 401 with WWW-Authenticate: Bearer resource_metadata="..." instead of 405. This restores the spec-correct OAuth discovery path for Claude.ai's web connector and ChatGPT's MCP connector, which probe with GET first and rely on the 401 + WWW-Authenticate response (per RFC 9728 Protected Resource Metadata) to start the OAuth flow. Without this header, those clients silently fail with "Couldn't reach the MCP server" and never display the authorization window. Authenticated GET continues to return 405 with Allow: POST, DELETE, OPTIONS (preserving the 1.4.12 fix for mcp-remote / Claude Desktop). Resolves a WP.org forum report against 1.4.13 on SiteGround./.well-known/oauth-authorization-server and surfaces a dismissible admin notice on Royal MCP and Plugins screens linking to the manual fix. Some managed hosts (notably SiteGround, but also some o2switch and Hostinger configurations) reserve the /.well-known/ path prefix at the nginx layer for ACME SSL renewals and serve a static 404 for any other path under it — before WordPress sees the request. Without this notice, customers only discovered the issue when their Claude.ai connector failed to authorize. The check runs on a 12-hour cached transient, skips on dev domains and multisite subsites, and is invalidated on settings save so config changes re-probe immediately./register, /token, /authorize, and all error responses) now send Cache-Control: no-store, no-cache, must-revalidate by default. Previously, aggressive edge caches like o2switch PowerBoost, LiteSpeed Cache, and Cloudflare APO could cache a 405 response from a stale GET probe and serve it to subsequent valid POSTs, breaking Claude.ai's web connector OAuth flow with "Couldn't reach the MCP server". Discovery endpoints (/.well-known/oauth-*) keep their public caching opt-in. Resolves a WP.org forum report against 1.4.8.wc_get_product_variations, wc_get_variation, wc_create_variation, wc_update_variation, wc_delete_variation, wc_batch_update_variations, wc_get_product_attributes, wc_get_attribute_terms, wc_create_product_attribute, wc_set_product_attributes. AI agents can now manage variable products end-to-end: register global attributes, set variation axes, generate variations, and update price/stock/SKU/dimensions in single calls or in batch. Cross-product ownership is validated on every get/update/delete to prevent variation writes against the wrong parent. Parent product price and stock cache is synced via WC_Product_Variable::sync() after every mutation. Contributed by @ober37.wc_get_coupons, wc_get_coupon, wc_get_coupon_count, wc_create_coupon, wc_update_coupon, wc_delete_coupon, wc_empty_coupon_trash. Full CRUD coverage including code search, status filter, all standard coupon fields (percent/fixed_cart/fixed_product discount types, expiry, usage limits, product/category restrictions, email allowlists), trash-then-purge or force-permanent deletion, and bulk trash purge. Every operation validates the post type is shop_coupon to prevent product IDs being silently accepted by new \WC_Coupon( $id ). Contributed by @ober37.protocolVersion bumped from 2025-03-26 to 2025-11-25. Current Claude Desktop builds send protocolVersion: 2025-11-25 in their initialize handshake; when the server responded with the older date, Claude Desktop silently rejected the entire tool list (no error, tools simply did not appear in the connector). All existing installs should update to restore Claude Desktop compatibility. Thanks to @ober37 for the report and patch.handle_get_stream() now returns HTTP 405 with Allow: POST, DELETE, OPTIONS instead of an immediately-closed SSE stream. The previous behaviour caused mcp-remote (the standard bridge between Claude Desktop and HTTP MCP servers) to treat the closed stream as a dropped connection and rapidly retry, hitting rate limits and dropping the entire MCP session. Returning 405 stops the retry loop and keeps the connection stable. Thanks again to @ober37.wp_get_taxonomies now returns a slug field on each entry as a clearer alias for the taxonomy identifier. WordPress's WP_Taxonomy object uses name for the slug for historical reasons, which often confuses AI agents that expect a slug field on something called a "taxonomy". Both slug and name are populated and contain the same value; existing callers that read name continue to work.wp_get_term_meta returns a structured response — {term_id, key, value} when reading a single key, or {term_id, meta: {...}} when reading all meta for a term. Pre-1.4.12 the tool returned the raw scalar value (or raw associative array), inconsistent with wp_update_term_meta / wp_delete_term_meta which already returned structured arrays. AI agents now see the same shape across the term-meta tool family.wp_update_term — rename, re-slug, edit description, or change the parent of any term in any taxonomy. Resolves a long-standing gap where AI agents could create and delete terms but not edit them.wp_get_term_meta, wp_update_term_meta, wp_delete_term_meta — read/write term meta. Most useful for editing tag/category SEO meta stored by Yoast SEO (_yoast_wpseo_title, _yoast_wpseo_metadesc), Rank Math (rank_math_title, rank_math_description), or AIOSEO (_aioseo_title, _aioseo_description).wp_get_taxonomies — discover all registered public taxonomies (built-in plus custom taxonomies registered by themes/plugins like product_cat, brand, etc.). Returns slug, label, hierarchical flag, and which post types the taxonomy applies to.wp_create_term, wp_delete_term, and wp_add_post_terms now accept any registered taxonomy, not just category and post_tag. The hardcoded enum has been replaced with runtime taxonomy_exists() validation. WooCommerce, EDD, custom-taxonomy, and post-type-specific term workflows now work directly.wp_create_term accepts an optional slug parameter for deterministic URL slugs.wp_create_post and wp_update_post accept a post_author user ID. Defaults to the authenticated MCP user (admin). Validates that the user exists before mutating the post.rl_get_costs, rl_create_cost, rl_get_renewals, rl_get_keys. Auto-loads when Royal Ledger is active. License key VALUES are never exposed through MCP — only masked previews are returned (decryption requires logging into wp-admin).fc_clear_cache, fc_get_cache_stats, fc_purge_url. Auto-loads when ForgeCache is active.rlinks_get_links, rlinks_create_link, rlinks_get_link_stats. Auto-loads when Royal Links is active.wp_get_seo_meta, wp_update_seo_meta. Auto-detects Yoast SEO or Rank Math and reads/writes the active plugin's title, description, focus keyword, robots, and OG fields. Requires edit_post capability.wp_get_permalink_structure, wp_update_permalink_structure. Update is gated by the existing "Allow AI to write WordPress options" toggle and manage_options capability.wp_get_post_revisions, wp_restore_revision. Returns revision history with author, date, word count, and lets AI roll a post back to a previous version when the user asks ("revert this post to yesterday's version").wp_get_active_theme, wp_get_theme_mods, wp_update_theme_mod, wp_get_custom_css, wp_update_custom_css. Theme mod writes are gated by a new "Allow AI to modify theme appearance" admin toggle (off by default) plus a new royal_mcp_writable_theme_mods allowlist filter (default empty, opt-in only). Custom CSS writes pass through wp_kses_post so script tags are stripped, and require the unfiltered_html capability.wp_create_menu_item, wp_update_menu_item, wp_delete_menu_item, wp_reorder_menu_items. AI agents can build and reorganize navigation menus directly. All four require the edit_theme_options capability.wp_get_pending_comments, wp_approve_comment, wp_spam_comment, wp_trash_comment. Closes the gap between the existing comment create/delete tools. All four require the moderate_comments capability. Author email addresses are redacted in wp_get_pending_comments output.royal_mcp_writable_theme_mods filter for theme/plugin authors to opt their customizer settings into the AI-writable allowlist.POST /register) now returns a real 500 with the underlying database error if the write fails, instead of returning a fake 201 with a client_id that was never persisted.mcp, ai, claude, chatgpt, mcp-server.royal_mcp_writable_options for plugin authors to declare which of their settings AI agents may write. Receives an array of option names; return the merged array.royal_mcp_allowed_origins for custom origin allowlist