fix(mcp): propagate scopes through dynamic client registration - #3881
Draft
aheritier wants to merge 1 commit into
Draft
fix(mcp): propagate scopes through dynamic client registration#3881aheritier wants to merge 1 commit into
aheritier wants to merge 1 commit into
Conversation
aheritier
force-pushed
the
fix/3879-dcr-scope-propagation
branch
from
August 8, 2026 21:37
110a591 to
3560481
Compare
This was referenced Aug 9, 2026
aheritier
force-pushed
the
fix/3879-dcr-scope-propagation
branch
from
August 10, 2026 20:28
83030ee to
0d3fe04
Compare
Carry explicitly configured or provider-advertised scopes through DCR-based remote MCP OAuth so registration, authorization, and stored token bookkeeping stay consistent. Adds quote-aware, multi-challenge- continuing WWW-Authenticate parsing, normalizes configured scopes the same way on both the DCR-selection and preflight-coverage sides to avoid a reauth loop, and exercises every resolveClientCredentials branch (explicit client, prompt fallback, successful DCR) with end-to-end scope equality across the registration body, authorize URL, and RequestedScopes. Also covers the Docker MCP Catalog's on-demand toolset (pkg/tools/builtin/mcpcatalog), which always constructs its inner mcp.Toolset with a nil *latest.RemoteOAuthConfig: a new httptest fixture drives enable_remote_mcp_server through a real, unstubbed Start() and proves that same nil-config product path reaches a successful dynamic client registration carrying the challenge/PRM scope fallback, and then the authorize URL and stored token's RequestedScopes bookkeeping, without panicking. Windows test fixture coverage: setupFakeBrowserOpener and setupFakeCatalogBrowserOpener shim only the open/xdg-open binaries via a #!/bin/sh script on PATH, but pkg/browser launches rundll32 on Windows instead, so the shim never intercepts it -- the real launcher runs, no URL is captured, and the polling read times out while holding interactiveOAuthMu, wedging later interactive-OAuth tests in the same run. Skip both helpers on Windows before any mutex-touching setup, and fix their comments, which falsely claimed the shim was host-independent.
aheritier
force-pushed
the
fix/3879-dcr-scope-propagation
branch
from
August 10, 2026 21:30
0d3fe04 to
942074e
Compare
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 #3879
Successful dynamic client registration (DCR) dropped configured or discovered scopes, causing scope mismatches for Atlassian integrations.
Implementation
RequestedScopes.WWW-Authenticateheaders.Testing
Focused and full test suites, lint, build, and race coverage were run.
Follow-up and merge gates