The base publishes the MCP manager as `ctx.mcpManager`. Inject and call
it under that key in the account UI, list its authorization endpoints
as `mcpManager/*` in the LiveShare viewer table, and update the OAuth
and composition tests and the generated configuration catalog.
The `ctx.mcpServers` key reads as a collection of servers, but the
service manages that collection, and ACP already uses `mcpServers` for
a plain server list. Publish the service as `ctx.mcpManager`, matching
the package name, the `mcp-manager/` event prefix, and
`ctx.pluginManager`. Remote endpoints become `mcpManager/*`; the class
keeps its name, McpServerManager.
An mcp-client entry with toolLoading: on-demand keeps the server's tools
out of the tool registry. The server registers mcp__<server>__load_tools,
lists its tools in a system prompt section, and registers the tools an
agent loads in that agent's own scope. Each published generation carries
loaded tools forward. mcp-manager entries pass toolLoading through.
The MCP SDK answers resources/list and resources/templates/list for a
server without the resources capability with an empty page, but first
writes a console.debug line to stdout. Under the ACP profile that line
lands in the JSON-RPC stream whenever the model lists resources of a
client-supplied, tools-only MCP server. Return the same empty pages
before calling the SDK, and cover it with a unit assertion and an ACP
stdout regression test.
The dynamic imports deferred little. dsh-credentials is already a required
peer because oauth-credentials.ts imports its values statically, and the
MCP client SDK loads @modelcontextprotocol/core at runtime anyway. Import
McpOAuthCredentials statically, export McpOAuthAuthorization from the
package entry, and drop the ./oauth subpath with its tsdown entry, chunk
file patterns, and tsconfig path.
The manager now creates the authorization owner synchronously, so the
retirement check that covered the import's await, and the test of that
window, are removed.
The redirect URI was always http://127.0.0.1:<port>, but the Host web
server listens only on its configured address. A server bound to ::1 or
another interface, or serving TLS, never received the callback, and the
attempt waited for its authorization timeout. Build the redirect URI from
WebServer.getOrigin().
`McpOAuthAuthorization` and `probeServer` have no caller other than the MCP
manager, which already rejects an entry that combines OAuth with an
Authorization header when it is loaded, written, or registered. The
mcp-client load check stays for standalone rows.
The SDK authorization request carries the protected-resource metadata's
resource string verbatim. The code exchange and refresh wrapped it in
`new URL()`, whose `href` adds a trailing slash to a resource without a
path, so a server that compares the resource exactly rejected the token
request. Both now pass the stored string.
The manager Remote adds `startAuthorization`, `cancelAuthorization`, and `signOut`, reports attempt progress in `list()` and `mcp-manager/status`, and rejects an `oauth.credentialKey` that another entry owns.
A Streamable HTTP entry with `oauth.credentialKey` connects with the grant saved in the credentials provider, refreshes an expired access token, and enters `waiting-authorization` with a `missing`, `expired`, `binding`, `rejected`, or `scope` reason when the grant cannot be used. `McpOAuthAuthorization` runs explicit browser authorization through the Host web server callback. The mcp-oauth-error snapshot records the tool failure the model sees.
This reverts commit 1c45a63dd65. Settings-configured servers, credential
templates, probes, stdio and enabled entries, and the status event implement
the backend of #3371, which remains open.
The Settings management page this manager was built for is not shipping, and
every connector plugin registers its server. Remove what only that page used:
- mcp-manager: the volatile `servers` configuration and its write-time
validation, stdio entries, the `enabled` flag, the `probe` operation, and the
`mcp-manager/status` event. A registration takes a Streamable HTTP `url`, and
a `startupTimeoutMs` setting bounds each registered server's startup.
- mcp-client: `${credential:REF}` templates (`expandTemplates`), the
`waiting-credentials` state, `probeServer`, and the exports that existed only
for the manager's write-time validation.
The Web profile mounts the manager without injecting credentials, and the
`mcp-template-error` snapshot goes with the templates.