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 9 commits into
Conversation
…provider Merging 12 new test cases covering completePrompt, streaming resilience, and edge cases.
Dependabot bump. Compatible: project requires node>=20.20.2, uuid v14 requires node>=20.
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 (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughMCP server configuration now accepts an optional ChangesStatic clientId OAuth Configuration
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 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)
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. |
# Conflicts: # pnpm-lock.yaml
|
Thanks for the contribution. There is also the huge readme file that was committed like your other PRs, we should remove it. |
An accidental uuid 11.1.0→14.0.0 bump leaked into this branch and broke the Windows unit tests: uuid@14 drops the Math.random fallback and now requires globalThis.crypto.getRandomValues, which the Vitest forks pool on Windows (Node 20) does not provide. Reverting to ^11.1.0 matches upstream/main and restores green CI.
|
Done — removed the stray |
|
Thanks for the careful review. This change reuses the existing authorization-code + PKCE flow already implemented in A client secret is not always required here. The provider already negotiates That said, you're correct that confidential-client setups requiring |
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