feat(mcp-oauth): support static clientId for servers without DCR#379
feat(mcp-oauth): support static clientId for servers without DCR#379proyectoauraorg wants to merge 1 commit into
Conversation
Add optional oauth.clientId field to MCP server configuration schema. When provided, the OAuth provider uses this clientId directly instead of performing Dynamic Client Registration (DCR). This enables connections to OAuth-protected MCP servers that don't support RFC 7591 DCR. Changes: - BaseConfigSchema: add oauth.clientId optional field - McpOAuthClientProvider: accept clientId in create() options, use it in registerClientIfNeeded() to skip DCR - McpHub: pass oauth.clientId from config to the provider - Tests: 2 new tests covering static clientId and precedence over cache Aligned with VS Code 1.122 feature: MCP OAuth with custom clientId.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR adds support for an optional static OAuth ChangesStatic OAuth clientId Configuration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/services/mcp/McpHub.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. src/services/mcp/McpOAuthClientProvider.tsESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. src/services/mcp/__tests__/McpOAuthClientProvider.spec.tsESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Wouldn't this also require a secret? This would also require the whole normal OAuth 2.0 flow to be available when provided. This is larger than a 3 file change. |
Related GitHub Issue
Aligned with VS Code 1.122 feature #257415 — MCP OAuth with custom clientId.
Description
Adds optional
oauth.clientIdfield to MCP server configuration. When provided, the OAuth provider uses this clientId directly instead of performing Dynamic Client Registration (DCR). This enables connections to OAuth-protected MCP servers that don't support RFC 7591 DCR.Use case: Many corporate and self-hosted MCP servers require a pre-registered clientId but don't support DCR. Currently, Zoo Code cannot connect to these servers via OAuth.
Changes:
BaseConfigSchema: addoauth.clientIdoptional fieldMcpOAuthClientProvider: acceptclientIdincreate()options, use it inregisterClientIfNeeded()to skip DCRMcpHub: passoauth.clientIdfrom config to the providerExample configuration in
.roo/mcp.json:{ "mcpServers": { "corporate-server": { "type": "streamable-http", "url": "https://mcp.corporate.example.com", "oauth": { "clientId": "my-app-id-12345" } } } }Test Procedure
Unit tests (104 passed):
McpOAuthClientProvider.spec.ts— 44 tests (42 existing + 2 new for static clientId)McpHub.spec.ts— 60 tests (all existing, schema change verified)New tests:
should use static clientId instead of performing DCR— verifies clientId is used directlyshould use static clientId even when cached data exists— verifies static takes precedence over cached DCRPre-Submission Checklist
Documentation Updates
Summary by CodeRabbit
New Features
Tests