Skip to content

refactor(mcp): share protected resource metadata discovery - #3955

Merged
aheritier merged 1 commit into
mainfrom
fix/3879-prm-helper-extraction
Aug 14, 2026
Merged

refactor(mcp): share protected resource metadata discovery#3955
aheritier merged 1 commit into
mainfrom
fix/3879-prm-helper-extraction

Conversation

@aheritier

@aheritier aheritier commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #3881.

Extracts duplicated RFC 9728 protected-resource metadata fetch/decode/defaulting from managed and docker-agent-driven unmanaged OAuth into a shared helper. Runtime fallback remains disabled, while explicit ordered fallback support is enabled for forthcoming standalone CLI work.

Adds deterministic local tests covering exact candidates/GET/order, hard stops (invalid JSON and non-200 responses including 204), 404 exhaustion, metadata preservation, and no downstream OAuth activity after hard errors. Clarifies the RequestedScopes comment.

Validation

  • go test ./pkg/tools/mcp/...
  • go test ./e2e -run TestDependencies
  • Manual: use local httptest tests to confirm the exact challenged PRM is accepted, ordered fallback occurs only after 404, and malformed/non-200 metadata stops before OAuth actions.

Stacked on #3881.

Manual validation

  • Use a local httptest/test fixture, not a real provider, to exercise metadata discovery.
  • Verify the exact challenged PRM succeeds. For the no-challenge path, verify path insertion is attempted before origin-root fallback, and advances only on 404.
  • Verify malformed or non-200 metadata stops before authorization, DCR, browser, or token work.
  • This is normally validated indirectly through fix(mcp): repair standalone OAuth login discovery #3959.
  • OAuth list/output and authorize URLs are sensitive; keep them local and do not publish them.

@aheritier aheritier added area/mcp MCP protocol, MCP tool servers, integration kind/refactor PR refactors code without behavior change labels Aug 9, 2026
@aheritier
aheritier force-pushed the fix/3879-prm-helper-extraction branch from 7a6a2a8 to 424cda1 Compare August 10, 2026 20:28
@aheritier
aheritier force-pushed the fix/3879-prm-helper-extraction branch from 424cda1 to 6898c31 Compare August 10, 2026 21:30
@aheritier
aheritier force-pushed the fix/3879-prm-helper-extraction branch from 6898c31 to 3334606 Compare August 13, 2026 16:14
@aheritier
aheritier marked this pull request as ready for review August 13, 2026 16:31
@aheritier
aheritier requested a review from a team as a code owner August 13, 2026 16:31
Base automatically changed from fix/3879-dcr-scope-propagation to main August 14, 2026 08:32
Extract the duplicated RFC 9728 protected-resource-metadata fetch/decode
logic from the managed and unmanaged OAuth flows into a single
fetchProtectedResourceMetadata helper, keeping the existing
supplied-origin-default and 404-tolerant behavior. The helper accepts
optional fallback candidate URLs for the standalone CLI discovery flow
without changing runtime callers.
@aheritier
aheritier force-pushed the fix/3879-prm-helper-extraction branch from 3334606 to 0877944 Compare August 14, 2026 09:23
@aheritier
aheritier merged commit 8f79af5 into main Aug 14, 2026
12 of 13 checks passed
@aheritier
aheritier deleted the fix/3879-prm-helper-extraction branch August 14, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/mcp MCP protocol, MCP tool servers, integration kind/refactor PR refactors code without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants