Skip to content

Add oauth section to mcp.json to allow overriding of client id#308648

Merged
TylerLeonhardt merged 2 commits intomainfrom
tyler/electric-cobra
Apr 9, 2026
Merged

Add oauth section to mcp.json to allow overriding of client id#308648
TylerLeonhardt merged 2 commits intomainfrom
tyler/electric-cobra

Conversation

@TylerLeonhardt
Copy link
Copy Markdown
Member

@TylerLeonhardt TylerLeonhardt commented Apr 9, 2026

More properties (like client secret) can come later... but this is the foundation, which is a lot of plumbing...

ref #257415

So an MCP Config now can have:

		"my-mcp-server-43a791b0": {
			"url": "<url>",
			"type": "http",
			"oauth": {
				"clientId": "<guid>"
			}
		}

aligns with what Claude Code does: https://code.claude.com/docs/en/mcp#claude-mcp-add-json

More properties (like client secret) can come later... but this is the foundation, which is a lot of plumbing...

ref #257415
@TylerLeonhardt TylerLeonhardt enabled auto-merge (squash) April 9, 2026 00:39
Copilot AI review requested due to automatic review settings April 9, 2026 00:39
@TylerLeonhardt TylerLeonhardt self-assigned this Apr 9, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an oauth block to MCP HTTP server configuration to enable overriding the OAuth client ID used during authentication, plumbing that override through the MCP launch model into dynamic authentication provider/session acquisition.

Changes:

  • Extend mcp.json HTTP server schema and MCP launch/types to carry optional oauth.clientId.
  • Thread clientId through MCP auth token acquisition into the authentication service’s dynamic provider creation and session lookups.
  • Teach microsoft-authentication (MSAL) provider to honor an explicit clientId override via ScopeData.
Show a summary per file
File Description
src/vscode-dts/vscode.proposed.authIssuers.d.ts Adds clientId?: string to proposed auth-issuer session option shapes.
src/vs/workbench/services/authentication/common/authentication.ts Extends dynamic auth provider creation APIs to accept optional clientId.
src/vs/workbench/services/authentication/browser/authenticationService.ts Forwards optional clientId into the host delegate’s dynamic provider creation.
src/vs/workbench/contrib/mcp/common/mcpTypes.ts Adds oauth to HTTP launch types and serialization.
src/vs/workbench/contrib/mcp/common/mcpConfiguration.ts Adds oauth section to the mcp.json schema for HTTP servers.
src/vs/workbench/contrib/mcp/common/discovery/pluginMcpDiscovery.ts Maps discovered plugin MCP HTTP configs to include oauth.
src/vs/workbench/contrib/mcp/common/discovery/installedMcpServersDiscovery.ts Maps installed MCP HTTP configs to include oauth.
src/vs/workbench/api/common/extHostMcp.ts Passes configured oauth.clientId into MCP auth token requests.
src/vs/workbench/api/common/extHost.protocol.ts Extends MCP auth RPC option/details types with optional clientId.
src/vs/workbench/api/browser/mainThreadMcp.ts Forwards clientId into auth session retrieval and dynamic provider creation.
src/vs/workbench/api/browser/mainThreadAuthentication.ts Allows overriding clientId during dynamic auth provider registration (skips stored secret).
src/vs/platform/mcp/common/mcpPlatformTypes.ts Adds oauth to remote MCP server configuration types.
extensions/microsoft-authentication/src/node/authProvider.ts Threads clientId option into ScopeData for MSAL flows.
extensions/microsoft-authentication/src/common/scopeData.ts Adds constructor support for explicit clientId override.

Copilot's findings

  • Files reviewed: 13/14 changed files
  • Comments generated: 5

Comment thread src/vs/workbench/services/authentication/common/authentication.ts
Comment thread src/vs/workbench/contrib/mcp/common/mcpConfiguration.ts
Comment thread extensions/microsoft-authentication/src/common/scopeData.ts Outdated
Comment thread extensions/microsoft-authentication/src/common/scopeData.ts
Comment thread src/vs/workbench/contrib/mcp/common/mcpTypes.ts Outdated
@TylerLeonhardt TylerLeonhardt merged commit d632fa3 into main Apr 9, 2026
24 checks passed
@TylerLeonhardt TylerLeonhardt deleted the tyler/electric-cobra branch April 9, 2026 02:40
@vs-code-engineering vs-code-engineering bot added this to the 1.116.0 milestone Apr 9, 2026
joshspicer pushed a commit that referenced this pull request Apr 9, 2026
…8648)

* Add `oauth` section to mcp.json to allow overriding of client id

More properties (like client secret) can come later... but this is the foundation, which is a lot of plumbing...

ref #257415

* feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants