fix(mcp): scope authorization server issuer

Generated with AI

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
Irosh 2026-08-10 20:00:43 -04:00
parent 05943b47a3
commit b16e6111d3
2 changed files with 5 additions and 3 deletions

View file

@ -2412,7 +2412,8 @@ def _build_oauth_authorization_server_response(
_raise_unless_oauth2_discovery_server(mcp_server, mcp_server_name, "not an OAuth authorization server")
return {
"issuer": request_base_url, # point to your proxy
# Match the per-server identifier advertised in protected-resource metadata.
"issuer": f"{request_base_url}/{mcp_server_name}" if mcp_server_name else request_base_url,
"authorization_endpoint": authorization_endpoint,
"token_endpoint": token_endpoint,
"response_types_supported": ["code"],

View file

@ -8163,8 +8163,9 @@ async def test_bare_origin_discovery_resolves_single_server_not_aggregate():
)
# per-server, not aggregate: the single server's name is in the endpoints
assert "/test_oauth/authorize" in authorization_response["authorization_endpoint"]
assert authorization_response["issuer"] == "https://llm.example.com"
assert resource_response["authorization_servers"] == ["https://llm.example.com/test_oauth"]
expected_issuer = "https://llm.example.com/test_oauth"
assert authorization_response["issuer"] == expected_issuer
assert resource_response["authorization_servers"] == [expected_issuer]
finally:
global_mcp_server_manager.registry.clear()