Skip to content

Commit 0d3c6ac

Browse files
authored
fix: use scopes_supported in OAuth server metadata (#30)
1 parent a9c75d4 commit 0d3c6ac

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

mcpauth/config.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,12 @@ class AuthorizationServerMetadata(BaseModel):
138138
[[RFC7591](https://www.rfc-editor.org/rfc/rfc7591)].
139139
"""
140140

141-
scope_supported: Optional[List[str]] = None
141+
scopes_supported: Optional[List[str]] = None
142+
"""
143+
JSON array containing a list of the OAuth 2.0 `scope` values that this authorization
144+
server supports.
145+
[[RFC8414](https://datatracker.ietf.org/doc/html/rfc8414#section-2)]
146+
"""
142147

143148
response_types_supported: List[str]
144149
"""

tests/utils/fetch_server_config_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def test_fetch_server_config_by_well_known_url_success_with_transpile(self):
6565
"issuer": sample_issuer,
6666
"authorization_endpoint": "https://example.com/oauth/authorize",
6767
"token_endpoint": "https://example.com/oauth/token",
68+
"scopes_supported": ["scope1", "scope2", "scope3"],
6869
}
6970

7071
responses.add(responses.GET, url=sample_well_known_url, json=sample_response)
@@ -83,6 +84,7 @@ def test_fetch_server_config_by_well_known_url_success_with_transpile(self):
8384
)
8485
assert config.metadata.token_endpoint == "https://example.com/oauth/token"
8586
assert config.metadata.response_types_supported == ["code"]
87+
assert config.metadata.scopes_supported == ["scope1", "scope2", "scope3"]
8688

8789
@responses.activate
8890
def test_fetch_server_config_oauth_success(self):
@@ -144,6 +146,7 @@ def test_fetch_server_config_oidc_success(self):
144146
"authorization_endpoint": "https://example.com/authorize",
145147
"token_endpoint": "https://example.com/token",
146148
"response_types_supported": ["code"],
149+
"scopes_supported": ["openid", "profile", "email"],
147150
}
148151

149152
responses.add(
@@ -159,6 +162,7 @@ def test_fetch_server_config_oidc_success(self):
159162
assert config.metadata.authorization_endpoint == "https://example.com/authorize"
160163
assert config.metadata.token_endpoint == "https://example.com/token"
161164
assert config.metadata.response_types_supported == ["code"]
165+
assert config.metadata.scopes_supported == ["openid", "profile", "email"]
162166

163167
@responses.activate
164168
def test_fetch_server_config_oidc_with_path_success(self):

0 commit comments

Comments
 (0)