Repository navigation
Migrate MCP servers that use OAuth - #341352
Merged
Vritant Bhardwaj (vritant24) merged 3 commits intoOct 13, 2026
Merged
Vritant Bhardwaj (vritant24) merged 3 commits into
Vritant Bhardwaj (vritant24) merged 3 commits into
Conversation
The MCP customization migrator now migrates remote servers with `oauth` instead of excluding them, writing `oauth.clientId` as `oauthClientId`. - Exclude servers with enterprise-managed sign-in, which relies on a VS Code setting, and servers whose OAuth client has a client secret stored in VS Code, which the destination cannot use. The secret is checked again before writing. - Read `oauthClientId` and `oauth.clientId` from `.mcp.json` and the Copilot user configuration. The client ID is part of the trust nonce, so servers that already had one are trusted again once. - Warn that migrated OAuth servers may need to sign in again, and that migrated user servers will be trusted again before they start. Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Secret detection uses resolved URLs, so OAuth servers with variables can migrate despite having stored client secrets.
1 open finding
What changed in this PR
Enables migration of OAuth-configured MCP servers while preserving client IDs and excluding unsupported secret or enterprise-managed configurations.
Changes:
- Migrates OAuth client IDs into Copilot configuration.
- Adds secret-storage and enterprise OAuth eligibility checks.
- Adds migration warnings, discovery support, and tests.
| File | Description |
|---|---|
aiCustomizationManagementEditor.fixture.ts |
Adds secret-storage fixture support. |
workspaceDotMcpDiscovery.test.ts |
Tests OAuth discovery. |
nativeMcpDiscoveryAdapters.test.ts |
Tests client-ID parsing. |
nativeMcpDiscoveryAdapters.ts |
Reads flat and nested client IDs. |
mcpServerCustomizationMigration.test.ts |
Tests OAuth migration exclusions. |
customizationMigrationServiceImpl.test.ts |
Supplies test secret storage. |
customizationMigration.test.ts |
Tests migration warnings. |
customizationMigrationService.ts |
Adds OAuth candidate metadata and failures. |
mcpServerCustomizationMigration.ts |
Implements OAuth migration and validation. |
customizationMigrationCategories.ts |
Adds sign-in and trust warnings. |
agentHostMcpServerSupportScope.ts |
Updates OAuth compatibility guidance. |
agentHostMcpServerMigrationProvider.ts |
Injects secret storage and explains exclusions. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The Set Client Secret code lens keys the secret by the URL as written in the source, before its variables are resolved. Read the key from the source entry, at planning time and again before writing, instead of from the projection, so a server with a variable in its URL is still excluded. Co-authored-by: Copilot <[email protected]>
Ben Villalobos (benvillalobos)
previously approved these changes
Oct 13, 2026
21 of 42 tasks
…servers-in-mcp-customization # Conflicts: # src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostMcpServerMigrationProvider.ts # src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationCategories.ts # src/vs/workbench/contrib/chat/browser/aiCustomization/mcpServerCustomizationMigration.ts # src/vs/workbench/contrib/chat/test/browser/aiCustomization/customizationMigration.test.ts # src/vs/workbench/contrib/chat/test/browser/aiCustomization/mcpServerCustomizationMigration.test.ts
Vritant Bhardwaj (vritant24)
enabled auto-merge
October 13, 2026 21:43
roblourens
approved these changes
Oct 13, 2026
Vritant Bhardwaj (vritant24)
merged commit Oct 13, 2026
7a9d08e
into
microsoft:main
55 of 56 checks passed
1 task done
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.

Part of #340161 (case C10).
The MCP customization migrator now migrates remote servers that use
oauthinstead of excluding them.Changes
oauthis migratable, except:oauth.enterpriseManaged: true. Enterprise-managed sign-in relies on a VS Code setting that Copilot doesn't have. New exclusion reasonEnterpriseManagedOAuth.OAuthClientSecret. The secret is checked at planning time and again before writing, using the same key as the code lens.oauth.clientIdis written asoauthClientId.oauthandenterpriseManaged: falseare dropped. The planner's comparison against the agent-host projection ignoresoauth, since the projection drops it.claudeConfigToServerDefinition(used for workspace.mcp.jsonand the Copilot usermcp-config.json) readsoauthClientIdand a nestedoauth.clientIdintolaunch.oauth.clientId, so migrated servers keep using their configured client. The client ID is part of the trust nonce, so Copilot user-config servers that already had one are trusted again once..mcp.jsoncollections are always trusted, so workspace migrations don't prompt.OAuthClientConfigurationIgnoredcompatibility detail, which said to remove the OAuth configuration in order to migrate.Sign-in tokens aren't migrated. VS Code's chat and Copilot sessions in VS Code share VS Code's authentication providers. Standalone Copilot CLI users sign in once on first use.
How to test
.vscode/mcp.jsonor the usermcp.json, add a remote server with"oauth": { "clientId": "<id>" }..mcp.jsonor~/.copilot/mcp-config.json) contains"oauthClientId": "<id>", and the source entry is removed.clientId, or set"enterpriseManaged": true. That server is excluded, and its details explain why.Validation
All commands were run on this branch after rebasing onto
main(68343b4619b):npm run typecheck-client: passednpm run build-fast -- --client-only: passed./scripts/test.sh --reporter dotwith--runfor everysrc/vs/workbench/contrib/chat/test/browser/aiCustomization/*.test.ts, plusnativeMcpDiscoveryAdapters.test.ts,workspaceDotMcpDiscovery.test.tsandagentHostAuth.test.ts: passed (828 passing)npm run eslint -- <12 changed files>: passednpm run valid-layers-check: passedNot verified against a real OAuth server: sign-in with a migrated client ID in the standalone Copilot CLI and in a Copilot session in VS Code.