The hub as an MCP server (OAuth 2.1, the consent page, /mcp, Settings → AI
apps) is the `hub-mcp` live plugin now (ai-agent-plugins). Core keeps nothing
about MCP: four generic plugin contracts replace backend/mcpserver/.
Gabriel's picks: form move-the-hub-mcp-server-into-a-plugin_2od10i.
New contracts (docs/plugins.md → "HTTP endpoints, the hub's API and asks"):
- `endpoints[]` (plugins/endpoints.py): HTTP a plugin answers on the hub's own
address — under /x/<pluginId>/… or a protocol path (/mcp, /oauth/…,
/.well-known/…). The request goes to the endpoint's action with what the
host vouches for (client address, surface, and `caller`: who the browser is
signed in as, by the gate's own rules — core/auth.identify); the answer
comes back through header and type allowlists, and HTML never runs a script
(forced CSP). Body cap, per-address rate, 16 runs at once on their own
threads. An endpoint's action answers HTTP only: the action routes refuse it
and the manifest can't wire it to anything else — its payload is the host's
word on who is asking.
- `hub.api` (plugins/hubapi.py, plugins/actas.py): the hub's API for the
plugin's handlers, as the owner or — `X-AIA-As-User`, the `cli` scope — as a
guest the plugin is granted to. The CLI is its library (AIA_CLI_DIR; the
names a plugin leans on are pinned by cli/test_library_surface.py).
`hub/via` stamps meta.via = {kind: "plugin", …}: the "via Claude.ai" pill.
- `notify.ask` and `security.record` (plugins/hubsignals.py): a tappable
question to the owner and its answer; a `plugin_event` Security log line.
Removed: backend/mcpserver/, schemas/mcp.py, cli/mcp_tools.py + mcp_server.py,
the frontend's business/aiApps (Settings → AI apps, /connect/<id> — both old
addresses redirect), /api/mcp*, /api/me/ai-apps, the `mcp` SSE event, the
mcp.connect / mcp.manage permissions and the per-guest AI apps switch (the
plugin's managed grant). A retired permission still in a record reads without
it and is never refused (authz/catalog.RETIRED).
Carry-over (carryover.hub_mcp, at start and after the plugin's install):
/data/mcp.json → the plugin's store, same shape, so connected apps keep
working — minus the connections bound to a worker, which are dropped with
their tokens rather than left as plain owner connections; every guest who
held mcp.connect gets the grant; whoever was pushed about mcp_connected is
pushed about plugin events.
Workers: the `ai-agent` CLI switch gains Full — the lab's CLI as the owner
(every command but worktrees, any machine, the plugins' commands), what the
EVOX2's unbound MCP connection gave. The worker-side CLI no longer filters
commands: the hub's switch decides. "Acts as" is gone; workers/bound.py stays
as the CLI's narrowing.
Until the plugin is installed after a deploy, /mcp and /oauth/* answer 404.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>