Repository navigation
agentHost: fetch MCP OAuth metadata outside renderer - #340537
Conversation
Route desktop MCP authorization-server discovery through the shared process so providers without CORS metadata headers can start authentication. Keep the request-service implementation as the web fallback and cover OpenID discovery after an OAuth metadata 404.\n\nFixes #340533\n\nCo-authored-by: Copilot <[email protected]>
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Robo (@deepak1556)Matched files:
|
There was a problem hiding this comment.
🔵 Needs a closer look
OAuth networking now crosses a process and security boundary, warranting final human review despite focused regression coverage.
0 open findings
What changed in this PR
Routes MCP OAuth metadata discovery through the desktop shared process to bypass renderer CORS restrictions while retaining web request-service behavior.
Changes:
- Adds a request-service-backed metadata discovery service.
- Registers desktop shared-process proxies for Workbench and Agents Window.
- Adds Avalara-style fallback regression coverage.
| File | Description |
|---|---|
src/vs/platform/agentHost/common/agentHostMcpOAuthMetadataService.ts |
Implements metadata discovery. |
src/vs/platform/agentHost/electron-browser/agentHostMcpOAuthMetadataService.ts |
Registers the shared-process proxy. |
src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts |
Hosts the metadata service channel. |
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostAuth.ts |
Uses the new service during authentication. |
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostAuth.test.ts |
Tests OpenID discovery fallback. |
src/vs/workbench/workbench.common.main.ts |
Registers the web-compatible implementation. |
src/vs/workbench/workbench.desktop.main.ts |
Loads the desktop proxy. |
src/vs/sessions/sessions.common.main.ts |
Registers the Agents Window implementation. |
src/vs/sessions/sessions.desktop.main.ts |
Loads the Agents Window desktop proxy. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Copilot resolve the merge conflicts in this pull request |
# Conflicts: # src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts Co-authored-by: aeschli <[email protected]>
Resolved in a1e47d6 by merging latest |
|
Base:
|
Fixes #340533
Routes MCP authorization-server metadata discovery through the shared process on desktop instead of renderer
fetch. This allows OAuth providers whose well-known metadata endpoints do not permit CORS requests to start authentication. Web continues to use the request-service implementation.Adds regression coverage for an Avalara-style provider where the OAuth metadata endpoint returns 404 and OpenID discovery succeeds.
Validation
npm run build-fast -- --client-only— passed./scripts/test.sh --run src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostAuth.test.ts— 78 tests passednpm run typecheck-client— passednpm run eslint -- src/vs/platform/agentHost/common/agentHostMcpOAuthMetadataService.ts src/vs/platform/agentHost/electron-browser/agentHostMcpOAuthMetadataService.ts src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostAuth.ts src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostAuth.test.ts src/vs/code/electron-utility/sharedProcess/sharedProcessMain.ts src/vs/workbench/workbench.common.main.ts src/vs/workbench/workbench.desktop.main.ts src/vs/sessions/sessions.common.main.ts src/vs/sessions/sessions.desktop.main.ts— passednpm run valid-layers-check— passed