agentHost: add MCP connector discovery - #334141
Draft
Paul (pwang347) wants to merge 6 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Plain-HTTP credential exposure, incomplete 304 cache handling, and per-turn catalog requests must be addressed.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (4)
| Severity | Finding |
|---|---|
src/vs/platform/agentHost/node/agentHostMcpConnectorsService.ts — Reject plain HTTP connector URLs. Every accepted endpoint receives the user's GitHub OAuth token in… |
|
src/vs/platform/agentHost/node/agentHostMcpConnectorsService.ts — The 304 path ignores cache metadata returned by the revalidation response. A 304 may replace the… |
|
src/vs/platform/agentHost/node/codex/codexAgent.ts — This method runs once from sendMessage and again from _materialize for a cold session, so… |
|
src/vs/platform/agentHost/node/copilot/copilotAgent.ts — This puts a catalog request on the hot path of every live Copilot turn: snapshot() is recomputed… |
What changed in this PR
Adds shared Agent Host discovery of connected Copilot Connector MCP servers and integrates them across providers.
Changes:
- Fetches, validates, caches, and revalidates connector catalogs.
- Merges connectors into Copilot, Claude, and Codex MCP configurations.
- Adds product configuration and provider/service tests.
| File | Description |
|---|---|
product.json |
Configures the connector catalog endpoint. |
src/vs/base/common/product.ts |
Defines the optional product endpoint. |
src/vs/platform/agentHost/node/agentHostBootstrap.ts |
Passes product configuration into core services. |
src/vs/platform/agentHost/node/agentHostServices.ts |
Registers the connector service. |
src/vs/platform/agentHost/node/agentHostMcpConnectorsService.ts |
Implements discovery, validation, caching, and authentication. |
src/vs/platform/agentHost/node/copilot/copilotAgent.ts |
Adds connectors to Copilot MCP configuration. |
src/vs/platform/agentHost/node/claude/claudeAgentSession.ts |
Adds connectors to Claude sessions. |
src/vs/platform/agentHost/node/codex/codexAgent.ts |
Adds connectors and reload handling to Codex. |
src/vs/platform/agentHost/test/node/testMcpConnectorsService.ts |
Provides a connector-service test stub. |
src/vs/platform/agentHost/test/node/agentHostMcpConnectorsService.test.ts |
Tests connector service behavior. |
src/vs/platform/agentHost/test/node/copilotAgent.test.ts |
Tests Copilot merging and precedence. |
src/vs/platform/agentHost/test/node/claudeAgent.test.ts |
Tests Claude merging and precedence. |
src/vs/platform/agentHost/test/node/codex/codexAgent.test.ts |
Tests Codex merging and authentication. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
/plugins/connectedcatalog with the existing GitHub OAuth credential304responses, honorCache-Control: no-store, accept only HTTPS MCP endpoints, and invalidate safely on token changesScope
This draft consumes already-connected connector MCP servers. It does not yet add the catalog/consent UI, PUT/DELETE connection lifecycle, exact-resource OAuth, vendor recovery handling for JSON-RPC codes 1001-1007, or full plugin tarball components.
GHES discovery is intentionally disabled for the current dotcom preview endpoint so an enterprise token is never sent to
api.github.com.Issue association: pending; no unambiguous VS Code tracker was found.
Follow-ups before OAuth scope enforcement
Connector requests will require
write:plugin_gateway_connectionsfor managing connections and making MCP calls, orread:plugin_gateway_connectionsfor read-only access. Existing GitHub OAuth sessions cannot gain either scope without user reauthorization.GitHub OAuth scope bundles are intentionally aligned across VS Code and integrated extensions so multiple experiences can reuse one authentication session. Because the GitHub authentication provider identifies sessions by their requested scope set, independently adding a connector scope could instead create a parallel session and cause different experiences to request authorization separately.
Before scope enforcement, choose and coordinate one authentication model across affected clients:
No individual client should independently change its default GitHub scope bundle without accounting for the other consumers of that shared session.
The following UX and recovery requirements apply under either model:
Manual Work IQ Mail smoke test
Prerequisites: use an account with Copilot Connectors preview access and an Outlook mailbox that can consent to Work IQ Mail.
Confirm the connector catalog is available:
If its status is not
connected, start the idempotent consent flow and finish it in the browser:Verify that the callback completed and the canonical connected-plugin endpoint advertises the MCP server:
Build and launch the Agents window using the
Run and Compile Agents - OSStask. Sign in to the same GitHub account, choose Local, select Copilot, and choose a workspace.Start a fresh session with this read-only prompt:
Approve
a365outlookmailmcp-SearchMessagesQueryParametersfor the session. If the result exceeds the inline tool-output limit, also approve reading the generated temporarycopilot-tool-output-*.txtfile.Expected result:
a365outlookmailmcpagenthost.logcontains connector activity with noAgentHostMcpConnectorsServicewarning or connector authorization errorVerified locally on 2026-09-03 against the live preview: the end-to-end Copilot turn completed successfully in 46 seconds with zero connector errors.
Testing
npm run typecheck-client