The platform for continuously improving AI agents.
Serve MCP protected-resource metadata with and without the trailing slash (#255)
Freyam Mehta9a4d76a45f4c
diff --git a/overbae/services/mcp/oauth_routes.py b/overbae/services/mcp/oauth_routes.pyindex fd11c458..46a8125d 100644--- a/overbae/services/mcp/oauth_routes.py+++ b/overbae/services/mcp/oauth_routes.py@@ -118,6 +118,8 @@ def oauth_routes():routes = create_protected_resource_routes(AnyHttpUrl(resource_url()), [issuer], SCOPES, "Overmind")+ # Some clients derive this path from the MCP URL without its trailing slash, as in MCP_PATHS.+ routes += [Route(r.path.rstrip("/"), endpoint=r.endpoint, methods=r.methods) for r in routes]for path, handler, methods in [("/.well-known/oauth-authorization-server",diff --git a/tests/test_mcp_oauth.py b/tests/test_mcp_oauth.pyindex 9c814369..8a99d11d 100644--- a/tests/test_mcp_oauth.py+++ b/tests/test_mcp_oauth.py@@ -105,6 +105,7 @@ def test_oauth_discovery_consent_project_access_refresh_and_revoke(flow):assert "resource_metadata=" in challenge.headers["www-authenticate"]metadata = client.get("/.well-known/oauth-protected-resource/api/mcp/").json()assert metadata["resource"] == RESOURCE+ assert client.get("/.well-known/oauth-protected-resource/api/mcp").json() == metadataassert client.get("/.well-known/oauth-authorization-server").json()["token_endpoint_auth_methods_supported"] == ["none"]