File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -276,19 +276,22 @@ async def _handle_protected_resource_response(self, response: httpx.Response) ->
276276
277277 # Only set scope if client_metadata.scope is None
278278 # Per MCP spec, priority order:
279- # 1. Use scope from WWW-Authenticate header (if provided)
280- # 2. Use all scopes from PRM scopes_supported (if available)
281- # 3. Omit scope parameter if neither is available
279+ # 1. Keep client scope if configured
280+ # 2. Use scope from WWW-Authenticate header (if provided)
281+ # 3. Use all scopes from PRM scopes_supported (if available)
282+ # 4. Omit scope parameter if neither is available
283+ #
284+ # Priority 1: Don't touch if client scope is already configured
282285 if self .context .client_metadata .scope is None :
283286 if self .context .www_authenticate_scope is not None :
284- # Priority 1 : WWW-Authenticate header scope
287+ # Priority 2 : WWW-Authenticate header scope
285288 self .context .client_metadata .scope = self .context .www_authenticate_scope
286289 elif self .context .protected_resource_metadata .scopes_supported is not None :
287- # Priority 2 : PRM scopes_supported
290+ # Priority 3 : PRM scopes_supported
288291 self .context .client_metadata .scope = " " .join (
289292 self .context .protected_resource_metadata .scopes_supported
290293 )
291- # Priority 3 : Omit scope parameter
294+ # Priority 4 : Omit scope parameter
292295
293296 except ValidationError :
294297 pass
You can’t perform that action at this time.
0 commit comments