Repository navigation
Connectors: Add an AI agent access panel for MCP - #85305
andreilupu wants to merge 6 commits into
Conversation
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. |
| // eslint-disable-next-line jsx-a11y/anchor-has-content | ||
| <a href="profile.php#application-passwords-section" /> |
There was a problem hiding this comment.
Could this use Link component from @wordpress/ui?
There was a problem hiding this comment.
Yes, I've updated it now.
| .mcp-access-panel code { | ||
| font-size: 12px; | ||
| } |
There was a problem hiding this comment.
This could be <Text variant="body-md" render={ <code /> }>Code</Text> and thus no styles needed.
Docs; https://wordpress.github.io/gutenberg/?path=/docs/design-system-components-text--docs
There was a problem hiding this comment.
I tried Text first, but every variant sets the body font family, so the endpoint stopped looking like code.
Finally, I went with your token idea instead: --wpds-typography-font-size-sm (the same 12px) plus --wpds-typography-font-family-mono.
The MCP Adapter lets outside AI agents connect to the site, which is the opposite direction of a connector: it stores no credential and is not a service the site uses. Show it as its own panel under the AI plugin callout instead of a connector card, with one toggle that installs or activates the MCP Adapter when turned on and deactivates it when turned off. The panel is a DataForm card. While the toggle is on it shows the endpoint and how apps sign in with an Application Password. See https://core.trac.wordpress.org/ticket/66323. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013oVGVRoreZ11vomKRPvJfX
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013oVGVRoreZ11vomKRPvJfX
Unit tests cover the toggle states and help text, the install, activate and deactivate requests, the disabled states, failures, and when the endpoint and sign-in details show. An E2E test checks the panel renders with the toggle off and links to the MCP Adapter plugin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013oVGVRoreZ11vomKRPvJfX
Reading the plugin over REST needs `activate_plugins`, so site admins on multisite and other users without it saw the AI agent access panel as not installed even while MCP was running. The server now sends the MCP Adapter's status, including network activation, the endpoint from `rest_url()`, and whether the user can install and activate plugins. The plugin record is also preloaded, like the AI plugin's, so the toggle doesn't show off for a moment on sites where it's on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013oVGVRoreZ11vomKRPvJfX
The panel now reads the MCP Adapter's status from the page data and only reads the plugin record for users who can activate plugins. That fixes: - Users without `activate_plugins` seeing "not installed" while MCP is running. - Network activation, which now shows as on and locked. - The endpoint, which now follows plain permalinks, custom REST prefixes and WordPress in a subfolder. - Sites where file changes are disabled, which now point to the deployment workflow instead of telling administrators to ask an administrator. - A failed or timed out request leaving stale state. The plugin record is read again after an error. - Read-only rows remounting on every render. - Keyboard focus dropping to the page while the toggle is disabled. It goes back to the toggle when the request finishes, unless the user moved on. The Application Password link uses `Link` from `@wordpress/ui`. The capability E2E tests now check that the panel is locked for users who can't manage plugins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013oVGVRoreZ11vomKRPvJfX
Use the monospace and small font size tokens instead of a hardcoded size. `Text` isn't used here because every variant sets the body font family, which stops the endpoint looking like code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013oVGVRoreZ11vomKRPvJfX
05ecb23 to
489312b
Compare
|
Thanks for the review @simison. Both are in, and I've rebased on trunk. While testing, I also fixed a few things. The panel now gets the MCP Adapter's state from the server, so it's correct on multisite and for users without activate_plugins. The endpoint comes from rest_url(), and keyboard focus stays on the toggle. The description is updated. The backport check fails because the PHP in lib/ needs a core PR. I'll open it if we agree on the direction in https://core.trac.wordpress.org/ticket/66323. |
What?
See https://core.trac.wordpress.org/ticket/66323
An alternative to #84983. Instead of a connector card, MCP gets its own "AI agent access" panel on the Connectors screen, under the AI plugin callout, with one toggle: "Allow AI agents to connect".
Why?
The MCP Adapter isn't a connector. Every connector today is a service this site uses (OpenAI, Anthropic, Akismet), and the screen says so: "All of your API keys and credentials are stored here". MCP goes the other way. It lets outside agents connect to this site, and it stores no credential here (the connector in WordPress/wordpress-develop#14348 even registers with
authentication => none).What a site owner actually decides is whether agents can connect at all. That's an on/off choice, closer to the old XML-RPC "Remote Publishing" setting than to an API key. A card with Install, Activate and Set up has no way to turn it back off.
How?
McpAccessPanelinroutes/connectors-home, rendered right afterAiPluginCallout.booleanfield with thetogglecontrol), the same pattern as the experiments page.root/pluginentity calls the AI plugin callout uses. Turning it off deactivates it. Nothing is installed just from viewing the page.rest_url()), and whether the user can install and activate plugins with the Connectors page data, so the panel is right for users who can't read the plugin over REST.routes/connectors-home/test/mcp-access-panel.jsdom.test.tsxcover the toggle states and help text, the install, activate and deactivate requests, the disabled states, failures, focus, and when the details show. PHP tests inphpunit/connectors-mcp-adapter-test.phpcover the server data. A new E2E test inconnectors.spec.jschecks the panel renders with the toggle off, and the capability tests check it's locked for users who can't manage plugins. The rest of the Connectors E2E suite still passes.Open questions and known gaps
This is a proposal to compare against #84983, not a finished feature.
Happy to fold in the Application Password creation from #84983 if this direction makes sense.
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
MCP.Adapter.auto-install.mp4
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Exploring the Connectors code, drafting the panel and this description. I reviewed and tested the changes myself.