@@ -38,7 +38,7 @@ def extract_field_from_www_auth(response: Response, field_name: str) -> str | No
3838
3939
4040def extract_scope_from_www_auth (response : Response ) -> str | None :
41- """Extract scope parameter from WWW-Authenticate header as per RFC6750 .
41+ """Extract scope parameter from WWW-Authenticate header as per RFC 6750 .
4242
4343 Returns:
4444 Scope string if found in WWW-Authenticate header, None otherwise
@@ -47,7 +47,7 @@ def extract_scope_from_www_auth(response: Response) -> str | None:
4747
4848
4949def extract_resource_metadata_from_www_auth (response : Response ) -> str | None :
50- """Extract protected resource metadata URL from WWW-Authenticate header as per RFC9728 .
50+ """Extract protected resource metadata URL from WWW-Authenticate header as per RFC 9728 .
5151
5252 Returns:
5353 Resource metadata URL if found in WWW-Authenticate header, None otherwise
@@ -67,8 +67,8 @@ def build_protected_resource_metadata_discovery_urls(www_auth_url: str | None, s
6767 3. Fall back to root-based well-known URI: /.well-known/oauth-protected-resource
6868
6969 Args:
70- www_auth_url: optional resource_metadata url extracted from the WWW-Authenticate header
71- server_url: server url
70+ www_auth_url: Optional resource_metadata URL extracted from the WWW-Authenticate header
71+ server_url: Server URL
7272
7373 Returns:
7474 Ordered list of URLs to try for discovery
@@ -120,10 +120,10 @@ def get_client_metadata_scopes(
120120
121121
122122def build_oauth_authorization_server_metadata_discovery_urls (auth_server_url : str | None , server_url : str ) -> list [str ]:
123- """Generate ordered list of (url, type) tuples for discovery attempts .
123+ """Generate an ordered list of URLs for authorization server metadata discovery .
124124
125125 Args:
126- auth_server_url: URL for the OAuth Authorization Metadata URL if found, otherwise None
126+ auth_server_url: OAuth Authorization Server Metadata URL if found, otherwise None
127127 server_url: URL for the MCP server, used as a fallback if auth_server_url is None
128128 """
129129
@@ -170,7 +170,7 @@ async def handle_protected_resource_response(
170170 Per SEP-985, supports fallback when discovery fails at one URL.
171171
172172 Returns:
173- True if metadata was successfully discovered, False if we should try next URL
173+ ProtectedResourceMetadata if successfully discovered, None if we should try next URL
174174 """
175175 if response .status_code == 200 :
176176 try :
@@ -206,7 +206,7 @@ def create_oauth_metadata_request(url: str) -> Request:
206206def create_client_registration_request (
207207 auth_server_metadata : OAuthMetadata | None , client_metadata : OAuthClientMetadata , auth_base_url : str
208208) -> Request :
209- """Build registration request or skip if already registered ."""
209+ """Build a client registration request ."""
210210
211211 if auth_server_metadata and auth_server_metadata .registration_endpoint :
212212 registration_url = str (auth_server_metadata .registration_endpoint )
@@ -261,7 +261,7 @@ def should_use_client_metadata_url(
261261 """Determine if URL-based client ID (CIMD) should be used instead of DCR.
262262
263263 URL-based client IDs should be used when:
264- 1. The server advertises client_id_metadata_document_supported=true
264+ 1. The server advertises client_id_metadata_document_supported=True
265265 2. The client has a valid client_metadata_url configured
266266
267267 Args:
@@ -306,7 +306,7 @@ def create_client_info_from_metadata_url(
306306async def handle_token_response_scopes (
307307 response : Response ,
308308) -> OAuthToken :
309- """Parse and validate token response with optional scope validation .
309+ """Parse and validate a token response.
310310
311311 Parses token response JSON. Callers should check response.status_code before calling.
312312
0 commit comments