Skip to content

Conversation

@jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Oct 14, 2025

The previous implementation used exact path matching for the well-known OAuth protected resource metadata endpoint, which only accepted:
/.well-known/oauth-protected-resource

This broke RFC 9728 Section 3.1 compliance for resources with path components. When a resource is identified as "https://server.com/mcp", clients must fetch metadata from:
/.well-known/oauth-protected-resource/mcp

But the exact match would return 404, preventing proper OAuth discovery for MCP servers with path-based resource identifiers.

Changed to prefix matching to support both:

  • /.well-known/oauth-protected-resource (base path)
  • /.well-known/oauth-protected-resource/mcp (with resource component)
  • /.well-known/oauth-protected-resource/resource1 (multi-tenant)

This enables multi-tenant hosting configurations as specified in RFC 9728 and ensures OAuth discovery works correctly for MCP servers regardless of their path structure.

Note: The current implementation accepts all paths under the prefix (e.g., /.well-known/oauth-protected-resource/*). In the future, this could be tightened by having NewAuthInfoHandler parse the request path, extract the resource component, and validate it matches the resourceURL path before returning metadata. This would enforce stricter path matching while maintaining RFC 9728 compliance.

The previous implementation used exact path matching for the well-known
OAuth protected resource metadata endpoint, which only accepted:
  /.well-known/oauth-protected-resource

This broke RFC 9728 Section 3.1 compliance for resources with path
components. When a resource is identified as "https://server.com/mcp",
clients must fetch metadata from:
  /.well-known/oauth-protected-resource/mcp

But the exact match would return 404, preventing proper OAuth discovery
for MCP servers with path-based resource identifiers.

Changed to prefix matching to support both:
- /.well-known/oauth-protected-resource (base path)
- /.well-known/oauth-protected-resource/mcp (with resource component)
- /.well-known/oauth-protected-resource/resource1 (multi-tenant)

This enables multi-tenant hosting configurations as specified in
RFC 9728 and ensures OAuth discovery works correctly for MCP servers
regardless of their path structure.

Note: The current implementation accepts all paths under the prefix
(e.g., /.well-known/oauth-protected-resource/*). In the future, this
could be tightened by having NewAuthInfoHandler parse the request path,
extract the resource component, and validate it matches the resourceURL
path before returning metadata. This would enforce stricter path
matching while maintaining RFC 9728 compliance.
@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.11%. Comparing base (6e18a3c) to head (cf8b272).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...g/transport/proxy/transparent/transparent_proxy.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2197      +/-   ##
==========================================
+ Coverage   53.09%   53.11%   +0.02%     
==========================================
  Files         222      222              
  Lines       28908    28913       +5     
==========================================
+ Hits        15348    15357       +9     
+ Misses      12421    12411      -10     
- Partials     1139     1145       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jhrozek jhrozek merged commit df489b6 into main Oct 14, 2025
27 checks passed
@jhrozek jhrozek deleted the prm_discovery branch October 14, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants