Repository navigation
fix: make OAuth client_id optional to support Dynamic Client Registration - #116
Merged
Merged
Conversation
…tion Fixes #83 **Problem:** - Documentation states client_id is optional (uses Dynamic Client Registration if empty) - Validation code required client_id whenever oauth object was present - Users couldn't configure OAuth servers to use DCR (RFC 7591) - Error: "client_id is required when oauth is configured" **Solution:** - Removed mandatory client_id validation check - Added comment explaining DCR support (RFC 7591) - client_id is now truly optional as documented **Testing:** - Added 3 new test cases for OAuth validation: 1. OAuth with empty client_id (DCR mode) 2. OAuth with only scopes and pkce 3. OAuth with client_id provided (regression test) - All tests pass - Verified with reproduction configs from issue #83 - Both DCR mode and pre-registered client mode work correctly **Files Changed:** - internal/config/config.go: Removed client_id validation - internal/config/validation_test.go: Added OAuth test cases 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Contributor
📦 Build Artifacts for PR #116Version: Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 18993286834 --repo smart-mcp-proxy/mcpproxy-go
# Or download a specific artifact:
gh run download 18993286834 --name dmg-darwin-arm64
|
The previous commit left an empty if statement after removing the client_id validation, which triggered staticcheck SA9003 (empty branch). Changed to a comment explaining the OAuth validation policy instead. Linter output: 0 issues Tests: All pass
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.
Summary
Fixes #83 - OAuth
client_idvalidation error when using Dynamic Client Registration (DCR)Problem
The validation code was incorrectly requiring
client_idto be non-empty whenever theoauthconfiguration object was present, even though:client_idis optionalOAuthConfigstruct usesomitemptyJSON tags for all fieldsThis created a catch-22 for users trying to configure OAuth servers with DCR:
Solution
client_idvalidation check ininternal/config/config.go:612-622Testing
New test cases added (
internal/config/validation_test.go):client_id(DCR mode) - validates successfullyscopesandpkce_enabled- validates successfullyclient_idprovided - validates successfully (regression test)Manual verification:
client_id) and pre-registered mode (withclient_id)Files Changed
internal/config/config.go- Removed client_id validation requirementinternal/config/validation_test.go- Added 3 OAuth validation test casesExample Configurations Now Supported
DCR Mode (new, previously blocked):
{ "name": "linear-mcp", "url": "https://api.linear.app/mcp", "protocol": "http", "oauth": { "scopes": ["mcp.read", "mcp.write"], "pkce_enabled": true } }Pre-registered Client (continues to work):
{ "name": "test-server", "url": "https://api.example.com/mcp", "protocol": "http", "oauth": { "client_id": "my-client-id", "client_secret": "my-secret", "scopes": ["mcp.read"] } }References
README.md:500-504,docs/mcp-go-oauth.md🤖 Generated with Claude Code