π The fast, Pythonic way to build MCP servers and clients.
chore: Update SDK documentation (#2141)
marvin-context-protocol[bot]9529fadd15f2
diff --git a/docs/python-sdk/fastmcp-client-auth-oauth.mdx b/docs/python-sdk/fastmcp-client-auth-oauth.mdxindex 7574d7a29..cb1f6ba77 100644--- a/docs/python-sdk/fastmcp-client-auth-oauth.mdx+++ b/docs/python-sdk/fastmcp-client-auth-oauth.mdx@@ -7,7 +7,7 @@ sidebarTitle: oauth## Functions-### `check_if_auth_required` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L43" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `check_if_auth_required` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L42" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncheck_if_auth_required(mcp_url: str, httpx_kwargs: dict[str, Any] | None = None) -> bool@@ -22,47 +22,47 @@ Check if the MCP endpoint requires authentication by making a test request.## Classes-### `ClientNotFoundError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L37" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `ClientNotFoundError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L36" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Raised when OAuth client credentials are not found on the server.-### `TokenStorageAdapter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L73" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `TokenStorageAdapter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L72" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>**Methods:**-#### `clear` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L101" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `clear` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L100" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonclear(self) -> None```-#### `get_tokens` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L106" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `get_tokens` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L105" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_tokens(self) -> OAuthToken | None```-#### `set_tokens` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L110" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `set_tokens` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L109" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset_tokens(self, tokens: OAuthToken) -> None```-#### `get_client_info` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L118" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `get_client_info` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L117" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_client_info(self) -> OAuthClientInformationFull | None```-#### `set_client_info` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L124" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `set_client_info` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L123" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset_client_info(self, client_info: OAuthClientInformationFull) -> None```-### `OAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L137" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `OAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L136" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>OAuth client provider for MCP servers with browser-based authentication.@@ -73,7 +73,7 @@ a browser for user authorization and running a local callback server.**Methods:**-#### `redirect_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L227" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `redirect_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L226" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonredirect_handler(self, authorization_url: str) -> None@@ -82,7 +82,7 @@ redirect_handler(self, authorization_url: str) -> NoneOpen browser for authorization, with pre-flight check for invalid client.-#### `callback_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L248" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `callback_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L247" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncallback_handler(self) -> tuple[str, str | None]@@ -91,7 +91,7 @@ callback_handler(self) -> tuple[str, str | None]Handle OAuth callback and return (auth_code, state).-#### `async_auth_flow` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L281" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `async_auth_flow` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L284" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonasync_auth_flow(self, request: httpx.Request) -> AsyncGenerator[httpx.Request, httpx.Response]diff --git a/docs/python-sdk/fastmcp-client-oauth_callback.mdx b/docs/python-sdk/fastmcp-client-oauth_callback.mdxindex 87e667b76..cc8097559 100644--- a/docs/python-sdk/fastmcp-client-oauth_callback.mdx+++ b/docs/python-sdk/fastmcp-client-oauth_callback.mdx@@ -25,10 +25,10 @@ create_callback_html(message: str, is_success: bool = True, title: str = 'FastMCCreate a styled HTML response for OAuth callbacks.-### `create_oauth_callback_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L90" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `create_oauth_callback_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L99" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-create_oauth_callback_server(port: int, callback_path: str = '/callback', server_url: str | None = None, response_future: asyncio.Future | None = None) -> Server+create_oauth_callback_server(port: int, callback_path: str = '/callback', server_url: str | None = None, result_container: OAuthCallbackResult | None = None, result_ready: anyio.Event | None = None) -> Server```@@ -38,7 +38,8 @@ Create an OAuth callback server.- `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-- `response_future`: Optional future to resolve when OAuth callback is received+- `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)@@ -61,3 +62,9 @@ from_dict(cls, data: dict[str, str]) -> CallbackResponse```pythonto_dict(self) -> dict[str, str]```++### `OAuthCallbackResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L91" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++Container for OAuth callback results, used with anyio.Event for async coordination.+diff --git a/docs/python-sdk/fastmcp-server-context.mdx b/docs/python-sdk/fastmcp-server-context.mdxindex 13b6e18ca..f5826ace0 100644--- a/docs/python-sdk/fastmcp-server-context.mdx+++ b/docs/python-sdk/fastmcp-server-context.mdx@@ -7,7 +7,7 @@ sidebarTitle: context## Functions-### `set_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L92" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `set_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L91" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset_context(context: Context) -> Generator[Context, None, None]@@ -15,7 +15,7 @@ set_context(context: Context) -> Generator[Context, None, None]## Classes-### `LogData` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L68" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `LogData` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L67" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Data object for passing log arguments to client-side handlers.@@ -24,7 +24,7 @@ This provides an interface to match the Python standard library logging,for compatibility with structured logging.-### `Context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L101" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `Context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L100" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Context object providing access to MCP capabilities.@@ -72,7 +72,7 @@ The context is optional - tools that don't need it can omit the parameter.**Methods:**-#### `fastmcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L153" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `fastmcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L152" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfastmcp(self) -> FastMCP@@ -81,7 +81,7 @@ fastmcp(self) -> FastMCPGet the FastMCP instance.-#### `request_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L182" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `request_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L181" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonrequest_context(self) -> RequestContext[ServerSession, Any, Request]@@ -92,7 +92,7 @@ Access to the underlying request context.If called outside of a request context, this will raise a ValueError.-#### `report_progress` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L192" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `report_progress` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L191" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonreport_progress(self, progress: float, total: float | None = None, message: str | None = None) -> None@@ -105,7 +105,7 @@ Report progress for the current operation.- `total`: Optional total value e.g. 100-#### `read_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L219" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `read_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L218" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonread_resource(self, uri: str | AnyUrl) -> list[ReadResourceContents]@@ -120,7 +120,7 @@ Read a resource by URI.- The resource content as either text or bytes-#### `log` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L232" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `log` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L231" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonlog(self, message: str, level: LoggingLevel | None = None, logger_name: str | None = None, extra: Mapping[str, Any] | None = None) -> None@@ -138,7 +138,7 @@ Messages sent to Clients are also logged to the `fastmcp.server.context.to_clien- `extra`: Optional mapping for additional arguments-#### `client_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L261" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `client_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L260" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonclient_id(self) -> str | None@@ -147,7 +147,7 @@ client_id(self) -> str | NoneGet the client ID if available.-#### `request_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L270" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `request_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L269" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonrequest_id(self) -> str@@ -156,7 +156,7 @@ request_id(self) -> strGet the unique ID for this request.-#### `session_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L275" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `session_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L274" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsession_id(self) -> str@@ -173,7 +173,7 @@ the same client session.- for other transports.-#### `session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L319" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L318" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsession(self) -> ServerSession@@ -182,7 +182,7 @@ session(self) -> ServerSessionAccess to the underlying session for advanced usage.-#### `debug` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L324" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `debug` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L323" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythondebug(self, message: str, logger_name: str | None = None, extra: Mapping[str, Any] | None = None) -> None@@ -193,7 +193,7 @@ Send a `DEBUG`-level message to the connected MCP Client.Messages sent to Clients are also logged to the `fastmcp.server.context.to_client` logger with a level of `DEBUG`.-#### `info` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L340" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `info` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L339" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoninfo(self, message: str, logger_name: str | None = None, extra: Mapping[str, Any] | None = None) -> None@@ -204,7 +204,7 @@ Send a `INFO`-level message to the connected MCP Client.Messages sent to Clients are also logged to the `fastmcp.server.context.to_client` logger with a level of `DEBUG`.-#### `warning` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L356" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `warning` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L355" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonwarning(self, message: str, logger_name: str | None = None, extra: Mapping[str, Any] | None = None) -> None@@ -215,7 +215,7 @@ Send a `WARNING`-level message to the connected MCP Client.Messages sent to Clients are also logged to the `fastmcp.server.context.to_client` logger with a level of `DEBUG`.-#### `error` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L372" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `error` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L371" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonerror(self, message: str, logger_name: str | None = None, extra: Mapping[str, Any] | None = None) -> None@@ -226,7 +226,7 @@ Send a `ERROR`-level message to the connected MCP Client.Messages sent to Clients are also logged to the `fastmcp.server.context.to_client` logger with a level of `DEBUG`.-#### `list_roots` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L388" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `list_roots` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L387" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonlist_roots(self) -> list[Root]@@ -235,7 +235,7 @@ list_roots(self) -> list[Root]List the roots available to the server, as indicated by the client.-#### `send_tool_list_changed` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L393" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `send_tool_list_changed` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L392" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsend_tool_list_changed(self) -> None@@ -244,7 +244,7 @@ send_tool_list_changed(self) -> NoneSend a tool list changed notification to the client.-#### `send_resource_list_changed` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L397" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `send_resource_list_changed` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L396" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsend_resource_list_changed(self) -> None@@ -253,7 +253,7 @@ send_resource_list_changed(self) -> NoneSend a resource list changed notification to the client.-#### `send_prompt_list_changed` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L401" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `send_prompt_list_changed` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L400" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsend_prompt_list_changed(self) -> None@@ -262,7 +262,7 @@ send_prompt_list_changed(self) -> NoneSend a prompt list changed notification to the client.-#### `sample` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L405" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `sample` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L404" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsample(self, messages: str | Sequence[str | SamplingMessage], system_prompt: str | None = None, include_context: IncludeContext | None = None, temperature: float | None = None, max_tokens: int | None = None, model_preferences: ModelPreferences | str | list[str] | None = None) -> TextContent | ImageContent | AudioContent@@ -275,25 +275,25 @@ completion from the client. The client must be appropriately configured,or the request will error.-#### `elicit` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L489" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `elicit` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L488" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonelicit(self, message: str, response_type: None) -> AcceptedElicitation[dict[str, Any]] | DeclinedElicitation | CancelledElicitation```-#### `elicit` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L501" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `elicit` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L500" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonelicit(self, message: str, response_type: type[T]) -> AcceptedElicitation[T] | DeclinedElicitation | CancelledElicitation```-#### `elicit` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L511" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `elicit` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L510" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonelicit(self, message: str, response_type: list[str]) -> AcceptedElicitation[str] | DeclinedElicitation | CancelledElicitation```-#### `elicit` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L520" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `elicit` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L519" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonelicit(self, message: str, response_type: type[T] | list[str] | None = None) -> AcceptedElicitation[T] | AcceptedElicitation[dict[str, Any]] | AcceptedElicitation[str] | DeclinedElicitation | CancelledElicitation@@ -322,7 +322,7 @@ type or dataclass or BaseModel. If it is a primitive type, anobject schema with a single "value" field will be generated.-#### `get_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L613" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `get_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L612" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_http_request(self) -> Request@@ -331,7 +331,7 @@ get_http_request(self) -> RequestGet the active starlette request.-#### `set_state` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L628" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `set_state` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L627" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset_state(self, key: str, value: Any) -> None@@ -340,7 +340,7 @@ set_state(self, key: str, value: Any) -> NoneSet a value in the context state.-#### `get_state` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L632" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `get_state` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L631" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_state(self, key: str) -> Anydiff --git a/docs/python-sdk/fastmcp-server-middleware-error_handling.mdx b/docs/python-sdk/fastmcp-server-middleware-error_handling.mdxindex f6204b815..5339b4a8c 100644--- a/docs/python-sdk/fastmcp-server-middleware-error_handling.mdx+++ b/docs/python-sdk/fastmcp-server-middleware-error_handling.mdx@@ -10,7 +10,7 @@ Error handling middleware for consistent error responses and tracking.## Classes-### `ErrorHandlingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L17" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `ErrorHandlingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L18" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Middleware that provides consistent error handling and logging.@@ -21,7 +21,7 @@ proper MCP error responses. Also tracks error patterns for monitoring.**Methods:**-#### `on_message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L112" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `on_message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L114" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonon_message(self, context: MiddlewareContext, call_next: CallNext) -> Any@@ -30,7 +30,7 @@ on_message(self, context: MiddlewareContext, call_next: CallNext) -> AnyHandle errors for all messages.-#### `get_error_stats` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L123" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `get_error_stats` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L125" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_error_stats(self) -> dict[str, int]@@ -39,7 +39,7 @@ get_error_stats(self) -> dict[str, int]Get error statistics for monitoring.-### `RetryMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L128" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `RetryMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L130" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Middleware that implements automatic retry logic for failed requests.@@ -50,7 +50,7 @@ backoff to avoid overwhelming the server or external dependencies.**Methods:**-#### `on_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L184" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `on_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L186" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonon_request(self, context: MiddlewareContext, call_next: CallNext) -> Anydiff --git a/docs/python-sdk/fastmcp-utilities-tests.mdx b/docs/python-sdk/fastmcp-utilities-tests.mdxindex dbe05bde5..37784a90d 100644--- a/docs/python-sdk/fastmcp-utilities-tests.mdx+++ b/docs/python-sdk/fastmcp-utilities-tests.mdx@@ -43,7 +43,28 @@ not pickleable, so we need a function that creates and runs one.- The server URL.-### `caplog_for_fastmcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L144" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `run_server_async` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L144" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+run_server_async(server: FastMCP, port: int | None = None, transport: Literal['http', 'streamable-http', 'sse'] = 'http', path: str = '/mcp', host: str = '127.0.0.1') -> AsyncGenerator[str, None]+```+++Start a FastMCP server as an asyncio task for in-process async testing.++This is the recommended way to test FastMCP servers. It runs the server+as an async task in the same process, eliminating subprocess coordination,+sleeps, and cleanup issues.++**Args:**+- `server`: FastMCP server instance+- `port`: Port to bind to (default\: find available port)+- `transport`: Transport type ("http", "streamable-http", or "sse")+- `path`: URL path for the server (default\: "/mcp")+- `host`: Host to bind to (default\: "127.0.0.1")+++### `caplog_for_fastmcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L226" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncaplog_for_fastmcp(caplog)@@ -55,7 +76,7 @@ Context manager to capture logs from FastMCP loggers even when propagation is di## Classes-### `HeadlessOAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L155" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `HeadlessOAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L237" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>OAuth provider that bypasses browser interaction for testing.@@ -66,7 +87,7 @@ instead of opening a browser and running a callback server. Useful for automated**Methods:**-#### `redirect_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L168" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `redirect_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L250" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonredirect_handler(self, authorization_url: str) -> None@@ -75,7 +96,7 @@ redirect_handler(self, authorization_url: str) -> NoneMake HTTP request to authorization URL and store response for callback handler.-#### `callback_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L174" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `callback_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L256" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncallback_handler(self) -> tuple[str, str | None]