Skip to content

Connectors: Add an AI agent access panel for MCP - #85305

Open
andreilupu wants to merge 6 commits into
WordPress:trunkfrom
andreilupu:add/connectors-mcp-access-panel
Open

andreilupu wants to merge 6 commits into
WordPress:trunkfrom
andreilupu:add/connectors-mcp-access-panel

Conversation

@andreilupu

@andreilupu andreilupu commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

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?

  • New McpAccessPanel in routes/connectors-home, rendered right after AiPluginCallout.
  • Built with DataForm (card layout with a header, a boolean field with the toggle control), the same pattern as the experiments page.
  • Turning it on installs the MCP Adapter if needed and activates it, through the same root/plugin entity calls the AI plugin callout uses. Turning it off deactivates it. Nothing is installed just from viewing the page.
  • The server sends the MCP Adapter's status, the endpoint (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.
  • While it works the toggle is disabled and the help text says what's happening. Keyboard focus goes back to the toggle when it's done. When it's on, the panel shows the endpoint and how apps sign in with an Application Password. The help text links to the MCP Adapter plugin.
  • Unit tests in routes/connectors-home/test/mcp-access-panel.jsdom.test.tsx cover the toggle states and help text, the install, activate and deactivate requests, the disabled states, failures, focus, and when the details show. PHP tests in phpunit/connectors-mcp-adapter-test.php cover the server data. A new E2E test in connectors.spec.js checks 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.

  • Off is blunt. It deactivates the whole adapter, which also stops MCP servers that other plugins run through it. It should either warn, or only switch off the default server (that would need a small setting in the adapter).
  • Bundled copies. If another plugin bundles the adapter, the panel doesn't know MCP is running.
  • Empty screen. The panel only shows when at least one connector is registered.
  • Subtitle. The page subtitle still talks only about API keys and credentials.
  • Application Passwords. If they're turned off on the site, the panel still says agents can connect.

Happy to fold in the Application Password creation from #84983 if this direction makes sense.

Testing Instructions

  1. Activate Gutenberg from this branch with the MCP Adapter installed but inactive (or not installed).
  2. Go to Settings → Connectors. The "AI agent access" panel shows under the AI plugin callout, turned off.
  3. Turn it on. The adapter is activated (or installed and activated), and the endpoint and sign-in details appear.
  4. Turn it off. The adapter is deactivated and the details hide.

Testing Instructions for Keyboard

  1. Tab to the "Allow AI agents to connect" toggle and press Space to flip it.
  2. When it finishes, focus is still on the toggle, so Space flips it back.

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.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: andreilupu <euthelup@git.wordpress.org>
Co-authored-by: simison <simison@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

Comment on lines +189 to +190
// eslint-disable-next-line jsx-a11y/anchor-has-content
<a href="profile.php#application-passwords-section" />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this use Link component from @wordpress/ui?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I've updated it now.

Comment on lines +46 to +48
.mcp-access-panel code {
font-size: 12px;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, we can use wpds font size tokens

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

andreilupu and others added 6 commits October 25, 2026 22:23
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
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
@andreilupu
andreilupu force-pushed the add/connectors-mcp-access-panel branch from 05ecb23 to 489312b Compare October 26, 2026 00:57
@andreilupu

Copy link
Copy Markdown
Contributor Author

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants