yera 0.11.1

yera.tools.mcp.oauth_interaction

Presentation-neutral interaction contracts for MCP OAuth.

Symbols

class OAuthAuthorizationRequest — Describe an OAuth authorization redirect for presentation.
class OAuthAuthorizationResult — Carry transient values captured from an OAuth callback.
class OAuthDeviceAuthorizationRequest — Describe a device-authorization verification step for presentation.
class OAuthDeviceInteraction — Present a device-authorization verification step to the user.
class OAuthInteraction — Present OAuth authorization and capture its callback result.

OAuthAuthorizationRequest

Describe an OAuth authorization redirect for presentation.

The authorization URL is transient protocol state and must not be persisted or written to logs.

Fields

server_name
type: str (required)

Yera name of the MCP connection.

server_url
type: str (required)

Streamable HTTP endpoint being authorized.

authorization_server
type: str (required)

Discovered authorization-server issuer.

resource
type: str (required)

Protected OAuth resource requested by the MCP server.

scopes
type: tuple[str, ...] (required)

OAuth scopes requested from the user.

authorization_url
type: str (required)

Complete transient browser authorization URL.

Methods


OAuthAuthorizationRequest.__init__

__init__(
    server_name: str,
    server_url: str,
    authorization_server: str,
    resource: str,
    scopes: tuple[str, ...],
    authorization_url: str,
) → None

OAuthAuthorizationResult

Carry transient values captured from an OAuth callback.

These values must remain in memory and must not be persisted or logged.

Fields

code
type: str (required)

Short-lived authorization code returned by the server.

state
type: str (required)

State value returned for request-correlation validation.

issuer
type: str | None = None

Optional authorization-response issuer supplied under RFC 9207.

Methods


OAuthAuthorizationResult.__init__

__init__(
    code: str,
    state: str,
    issuer: str | None = None,
) → None

OAuthDeviceAuthorizationRequest

Describe a device-authorization verification step for presentation.

The device code is secret protocol state and is intentionally excluded.

Fields

server_name
type: str (required)

Yera name of the MCP connection.

server_url
type: str (required)

Streamable HTTP endpoint being authorized.

authorization_server
type: str (required)

Discovered authorization-server issuer.

scopes
type: tuple[str, ...] (required)

OAuth scopes requested from the user.

verification_uri
type: str (required)

Page at which the user enters the displayed code.

verification_uri_complete
type: str | None (required)

Optional link containing the user code.

user_code
type: str (required)

Short code displayed for user verification.

expires_in_seconds
type: int (required)

Lifetime of the verification request.

Methods


OAuthDeviceAuthorizationRequest.__init__

__init__(
    server_name: str,
    server_url: str,
    authorization_server: str,
    scopes: tuple[str, ...],
    verification_uri: str,
    verification_uri_complete: str | None,
    user_code: str,
    expires_in_seconds: int,
) → None

OAuthDeviceInteraction

Inherits: Protocol

Present a device-authorization verification step to the user.

Methods

present_device_authorization — Present device verification instructions.

OAuthDeviceInteraction.present_device_authorization

present_device_authorization(
    request: OAuthDeviceAuthorizationRequest,
) → None

Present device verification instructions.

Parameters

request
type: OAuthDeviceAuthorizationRequest

Non-secret verification context to present.

OAuthInteraction

Inherits: Protocol

Present OAuth authorization and capture its callback result.

Methods

present_authorization — Present an authorization request to the user.
await_callback — Wait for the authorization server callback.

OAuthInteraction.present_authorization

present_authorization(
    request: OAuthAuthorizationRequest,
) → None

Present an authorization request to the user.

Parameters

request
type: OAuthAuthorizationRequest

Transient authorization context to present.

OAuthInteraction.await_callback

await_callback() → OAuthAuthorizationResult

Wait for the authorization server callback.

Returns

type: OAuthAuthorizationResult

The captured authorization code and state.