fastmcp.server.mixins.transport
Transport-related methods for FastMCP Server.
Classes
TransportMixin
Mixin providing transport-related methods for FastMCP.
Includes HTTP/stdio/SSE transport handling and custom HTTP routes.
Methods:
run_async
transport: Transport protocol to use (“stdio”, “http”, “sse”, or “streamable-http”)show_banner: Whether to display the server banner. If None, uses the FASTMCP_SHOW_SERVER_BANNER setting (default: True).
run
transport: Transport protocol to use (“http”, “stdio”, “sse”, or “streamable-http”)show_banner: Whether to display the server banner. If None, uses the FASTMCP_SHOW_SERVER_BANNER setting (default: True).
custom_route
path: URL path for the route (e.g., “/auth/callback”)methods: List of HTTP methods to support (e.g., [“GET”, “POST”])name: Optional name for the route (to reference this route with Starlette’s reverse URL lookup feature)include_in_schema: Whether to include in OpenAPI schema, defaults to True
run_stdio_async
show_banner: Whether to display the server bannerlog_level: Log level for the serverstateless: Whether to run in stateless mode (no session initialization)
run_http_async
transport: Transport protocol to use - “http” (default), “streamable-http”, or “sse”host: Host address to bind to (defaults to settings.host)port: Port to bind to (defaults to settings.port)log_level: Log level for the server (defaults to settings.log_level)path: Path for the endpoint (defaults to settings.streamable_http_path or settings.sse_path)uvicorn_config: Additional configuration for the Uvicorn servermiddleware: A list of middleware to apply to the appjson_response: Whether to use JSON response format (defaults to settings.json_response)stateless_http: Whether to use stateless HTTP (defaults to settings.stateless_http)stateless: Alias for stateless_http for CLI consistency
http_app
path: The path for the HTTP endpointmiddleware: A list of middleware to apply to the appjson_response: Whether to use JSON response formatstateless_http: Whether to use stateless mode (new transport per request)transport: Transport protocol to use - “http”, “streamable-http”, or “sse”event_store: Optional event store for SSE polling/resumability. When set, enables clients to reconnect and resume receiving events after server-initiated disconnections. Only used with streamable-http transport.retry_interval: Optional retry interval in milliseconds for SSE polling. Controls how quickly clients should reconnect after server-initiated disconnections. Requires event_store to be set. Only used with streamable-http transport.
- A Starlette application configured with the specified transport

