Skip to main content

fastmcp.client.oauth_callback

OAuth callback server for handling authorization code flows. This module provides a reusable callback server that can handle OAuth redirects and display styled responses to users.

Functions

create_callback_html

Create a styled HTML response for OAuth callbacks.

create_oauth_callback_server

Create an OAuth callback server. Args:
  • port: The port to run the server on
  • callback_path: The path to listen for OAuth redirects on
  • server_url: Optional server URL to display in success messages
  • result_container: Optional container to store callback results
  • result_ready: Optional event to signal when callback is received
Returns:
  • Configured uvicorn Server instance (not yet running)

Classes

CallbackResponse

Methods:

from_dict

to_dict

OAuthCallbackResult

Container for OAuth callback results, used with anyio.Event for async coordination.