httpx2.Auth interface so they drop into the same auth= parameter as every other client auth option. You pass the MCP server URL, not a token endpoint — the token endpoint is discovered from the server’s OAuth metadata, exactly as the interactive OAuth helper does. As with OAuth, you can omit the URL entirely and let the transport supply it.
Client ID and Secret
The common case is a pre-registered client with an ID and a secret. UseClientCredentialsOAuthProvider and pass it to the auth parameter of your Client or transport:
OAuth flow, losing the cache on restart costs nothing.
ClientCredentialsOAuthProvider Parameters
mcp_url(str, optional): Full URL to the MCP endpoint. Omit it when passing the provider toClient(auth=...)— the transport supplies the URL automatically.client_id(str, required): The pre-registered OAuth client ID.client_secret(str, required): The OAuth client secret.scopes(str | list[str], optional): Scopes to request, as a space-separated string or a list.token_endpoint_auth_method("client_secret_basic" | "client_secret_post", optional): How the credentials are presented to the token endpoint. Defaults to"client_secret_basic"(an HTTP BasicAuthorizationheader); use"client_secret_post"to send them in the request body instead.token_storage(AsyncKeyValue, optional): A key-value store for the acquired token. Defaults to in-memory storage.
Private Key JWT
Some authorization servers require the client to prove its identity with a signed JWT assertion (RFC 7523private_key_jwt) instead of a shared secret. This is common with workload identity federation, where the assertion comes from a cloud identity provider. Use PrivateKeyJWTOAuthProvider and supply an assertion_provider — an async callback that receives the authorization server’s issuer identifier (the required JWT audience) and returns the assertion.
For a locally signed assertion, build the callback with SignedJWTParameters:
static_assertion_provider, or pass your own async def provider(audience: str) -> str callback to fetch one on demand.
PrivateKeyJWTOAuthProvider Parameters
mcp_url(str, optional): Full URL to the MCP endpoint. Omit it when passing the provider toClient(auth=...).client_id(str, required): The OAuth client ID.assertion_provider(Callable[[str], Awaitable[str]], required): Async callback that receives the authorization server’s issuer identifier and returns a signed JWT assertion.scopes(str | list[str], optional): Scopes to request, as a space-separated string or a list.token_storage(AsyncKeyValue, optional): A key-value store for the acquired token. Defaults to in-memory storage.

