find_oauth_challenge(
exc: BaseException,
) -> str | None| Name | Type | Description |
|---|---|---|
exc* | BaseException | Root exception to inspect. |
Return the resource_metadata URL of a 401 OAuth challenge in exc.
Per the MCP authorization spec (RFC 9728), a server requiring OAuth
answers an unauthenticated request with HTTP 401 plus a Bearer
WWW-Authenticate challenge pointing at its protected-resource metadata.
The MCP client surfaces that as an httpx.HTTPStatusError. Walks
exceptions (for ExceptionGroup), then __cause__/__context__,
tracking visited nodes to terminate on cyclic chains.