Skip to content

Agent Host: MCP servers sharing a resource receive the same OAuth token despite distinct client IDs #342147

Closed

Description

  • Copilot Chat Extension Version: Not established in this RCA.
  • VS Code Version: Affected build version not established. Logs captured on October 16, 2026. Source analysis below uses checkout revision 3895f178cc2a9cc5fa55071052f522bf159cae04, not a verified affected-build revision.
  • OS Version: macOS. Exact version not established.
  • Feature (e.g. agent/edit/ask mode): Agents window / Agent Host / HTTP MCP OAuth authentication.
  • Selected model (e.g. GPT 4.1, Claude 3.7 Sonnet): Not relevant to the observed authentication handoff.
  • Logs: Sanitized timeline below from an Agent Host debug-log export. Raw logs are not attached because they contain sensitive session content. Exported bearer tokens are redacted, so token-byte equality cannot be established from this bundle.

Steps to Reproduce:

  1. Configure two named HTTP MCP servers, such as slack-a and slack-b, both using https://mcp.slack.com/mcp, with different oauthClientId values and authorization intended for different Slack workspaces.
  2. Start or resume an Agent Host session so both servers request authentication at approximately the same time.
  3. Allow the client to supply their authentication credentials.
  4. Search through each named server and inspect the workspace of returned results.

Actual behavior

A search explicitly routed through the server intended for workspace A returned links from workspace B. Reading a known channel from workspace A then returned channel_not_found.

The configuration uses different OAuth client IDs. The AHP authentication-required states preserve the correct client ID for each named server. The distinction disappears in the resource-level authentication reply.

Expected behavior

Each server receives only the credential selected for its authentication request and OAuth client/account. Sharing an endpoint or protected-resource identifier must not collapse distinct server authorizations.

Observed timeline

These events occur within the same session. All times are UTC on October 16, 2026.

Time Event
17:12:47.973 First Slack server enters authRequired with its configured OAuth client ID.
17:12:47.976 Second Slack server enters authRequired with its different configured OAuth client ID.
17:12:48.398 Client sends authenticate for resource https://mcp.slack.com, with scopes and a redacted token, but no MCP-server or auth-request identifier.
17:12:48.428 First server transitions to starting.
17:12:48.431 Second server transitions to starting, before the second authentication reply arrives.
17:12:48.450 Client sends the second resource-level authentication request.
17:12:49.359 / 17:12:49.673 Both servers reach ready.
18:14:55 Search through the server intended for workspace A returns workspace B links.
18:20:39 / 18:21:12 Reads of a workspace A channel fail with channel_not_found.

Root cause analysis

The current implementation explains the ordering above:

Thus the first credential handoff can complete both servers' pending SDK auth callbacks. Different static OAuth client IDs do not protect against this host-side fan-out. The logs do not establish which original OAuth grant won, but they show both servers starting after the first handoff and before the second.

There is also a related identity concern in getDynamicAuthenticationProviderId, which derives provider identity from authorization-server URL plus resource, without client ID. That needs consideration alongside the pending-request routing fix, rather than assuming credential-cache partitioning alone solves this incident.

Suggested fix and regression coverage

Preserve the originating MCP authentication request/server identity through the client reply and resolve only the intended pending callback. Keep distinct OAuth client/account identities isolated through provider selection and credential storage.

Add a regression test with two simultaneously pending MCP auth requests that share resource/scopes but have different server names and OAuth client IDs. Delivering the first credential must resolve only its intended request; the other must remain pending until its own credential arrives.

Related issues

No code changes or fresh reproduction were performed for this report. Evidence comes from the captured incident and source inspection.

🤖 Posted by GitHub Copilot on Harald's behalf.

Activity

  1. vs-code-engineering commented on Oct 16, 2026

    @vs-code-engineering
    Contributor

    Thanks for creating this issue! It looks like you may be using an old version of VS Code; the latest stable release is 1.142.0. Please try upgrading to the latest version and checking whether this issue remains.

    Happy Coding!

  2. added
    unreleased
    on Oct 20, 2026
  3. added this to the 1.144.0 milestone on Oct 20, 2026
  4. added
    insiders-released
    and removed
    unreleased
    on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

insiders-released

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions