Python SDK: OAuth

The methods of the Python client under OAuth. Authorization, token exchange and discovery for scoped third-party apps.

client.oauth.authorize

Python

client.oauth.authorize(*, response_type: Literal['code'], client_id: str, redirect_uri: str, resource: str, scope: str | None = None, state: str | None = None, code_challenge: str, code_challenge_method: Literal['S256']) -> str

Sends oauth.authorize: GET /oauth/authorize

Begin app authorization.

Access public: no credential.

client.oauth.mcp_resource

Python

client.oauth.mcp_resource() -> models.OAuthResourceMetadata

Sends oauth.mcpResource: GET /.well-known/oauth-protected-resource/mcp

Discover the MCP resource.

Access public: no credential.

client.oauth.metadata

Python

client.oauth.metadata() -> models.OAuthServerMetadata

Sends oauth.metadata: GET /.well-known/oauth-authorization-server

Discover authorization.

Access public: no credential.

client.oauth.register

Python

client.oauth.register(body: models.RegisterOAuthClient) -> models.RegisteredOAuthClient

Sends oauth.register: POST /oauth/register

Register a public client dynamically.

Access public: no credential.

client.oauth.resource

Python

client.oauth.resource() -> models.OAuthResourceMetadata

Sends oauth.resource: GET /.well-known/oauth-protected-resource

Discover the API resource.

Access public: no credential.

client.oauth.token

Python

client.oauth.token(body: models.OAuthTokenRequest) -> models.OAuthTokens

Sends oauth.token: POST /oauth/token

Exchange or refresh tokens.

Access public: no credential.

Up Down to move, Enter to open, Esc to close