yera 0.11.1

yera.tools.mcp.oauth_browser

Browser presentation for MCP OAuth authorization.

Symbols

class BrowserOAuthDeviceInteraction — Open device verification and present its user instructions.
class BrowserOAuthInteraction — Open OAuth authorization and delegate callback capture.

BrowserOAuthDeviceInteraction

Open device verification and present its user instructions.

Methods

__init__ — Configure browser-assisted device authorization.
present_device_authorization — Open verification and display its instructions.

BrowserOAuthDeviceInteraction.__init__

__init__(
    presentation_handler: Callable[[OAuthDeviceAuthorizationRequest], Awaitable[None]],
    browser_opener: Callable[[str], bool] = webbrowser.open,
) → None

Configure browser-assisted device authorization.

Parameters

presentation_handler
type: Callable[[OAuthDeviceAuthorizationRequest], Awaitable[None]]

Presenter that displays the verification destination and user code.

browser_opener
type: Callable[[str], bool] = webbrowser.open

Function opening the verification URL.

BrowserOAuthDeviceInteraction.present_device_authorization

present_device_authorization(
    request: OAuthDeviceAuthorizationRequest,
) → None

Open verification and display its instructions.

Parameters

request
type: OAuthDeviceAuthorizationRequest

Non-secret device-verification context.

BrowserOAuthInteraction

Open OAuth authorization and delegate callback capture.

Methods

__init__ — Configure browser presentation and callback capture.
present_authorization — Open the transient authorization URL.
await_callback — Wait for and return the captured OAuth callback.

BrowserOAuthInteraction.__init__

__init__(
    callback_handler: Callable[[], Awaitable[OAuthAuthorizationResult]],
    browser_opener: Callable[[str], bool] = webbrowser.open,
    fallback_handler: Callable[[OAuthAuthorizationRequest], Awaitable[None]] | None = None,
) → None

Configure browser presentation and callback capture.

Parameters

callback_handler
type: Callable[[], Awaitable[OAuthAuthorizationResult]]

Async operation waiting for the OAuth callback.

browser_opener
type: Callable[[str], bool] = webbrowser.open

Function opening the authorization URL.

fallback_handler
type: Callable[[OAuthAuthorizationRequest], Awaitable[None]] | None = None

Optional presenter used when automatic browser opening fails.

BrowserOAuthInteraction.present_authorization

present_authorization(
    request: OAuthAuthorizationRequest,
) → None

Open the transient authorization URL.

Parameters

request
type: OAuthAuthorizationRequest

Authorization context prepared by the MCP SDK.

Raises

MCPAuthenticationError

If no browser accepts the URL.

BrowserOAuthInteraction.await_callback

await_callback() → OAuthAuthorizationResult

Wait for and return the captured OAuth callback.

Returns

type: OAuthAuthorizationResult

Authorization code, state, and optional issuer.