π The fast, Pythonic way to build MCP servers and clients.
update api ref for new `mdxify` version
zzstoatzzc289f172176c
diff --git a/docs/docs.json b/docs/docs.jsonindex fac25bb32..9d87f0ed4 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -65,7 +65,10 @@{"group": "Essentials","icon": "cube",- "pages": ["servers/server", "deployment/running-server"]+ "pages": [+ "servers/server",+ "deployment/running-server"+ ]},{"group": "Core Components",@@ -93,7 +96,9 @@{"group": "Authentication","icon": "shield-check",- "pages": ["servers/auth/bearer"]+ "pages": [+ "servers/auth/bearer"+ ]}]},@@ -103,7 +108,10 @@{"group": "Essentials","icon": "cube",- "pages": ["clients/client", "clients/transports"]+ "pages": [+ "clients/client",+ "clients/transports"+ ]},{"group": "Core Operations",@@ -129,7 +137,10 @@{"group": "Authentication","icon": "user-shield",- "pages": ["clients/auth/oauth", "clients/auth/bearer"]+ "pages": [+ "clients/auth/oauth",+ "clients/auth/bearer"+ ]}]},@@ -174,12 +185,17 @@},{"anchor": "What's New",- "pages": ["updates", "changelog"]+ "pages": [+ "updates",+ "changelog"+ ]},{"anchor": "Community","icon": "users",- "pages": ["community/showcase"]+ "pages": [+ "community/showcase"+ ]}]},@@ -191,6 +207,7 @@"icon": "python","pages": ["python-sdk/fastmcp-exceptions",+ "python-sdk/fastmcp-mcp_config","python-sdk/fastmcp-settings",{"group": "fastmcp.cli",@@ -198,6 +215,17 @@"python-sdk/fastmcp-cli-__init__","python-sdk/fastmcp-cli-claude","python-sdk/fastmcp-cli-cli",+ {+ "group": "install",+ "pages": [+ "python-sdk/fastmcp-cli-install-__init__",+ "python-sdk/fastmcp-cli-install-claude_code",+ "python-sdk/fastmcp-cli-install-claude_desktop",+ "python-sdk/fastmcp-cli-install-cursor",+ "python-sdk/fastmcp-cli-install-mcp_config",+ "python-sdk/fastmcp-cli-install-shared"+ ]+ },"python-sdk/fastmcp-cli-run"]},@@ -214,7 +242,9 @@]},"python-sdk/fastmcp-client-client",+ "python-sdk/fastmcp-client-elicitation","python-sdk/fastmcp-client-logging",+ "python-sdk/fastmcp-client-messages","python-sdk/fastmcp-client-oauth_callback","python-sdk/fastmcp-client-progress","python-sdk/fastmcp-client-roots",@@ -262,7 +292,9 @@},"python-sdk/fastmcp-server-context","python-sdk/fastmcp-server-dependencies",+ "python-sdk/fastmcp-server-elicitation","python-sdk/fastmcp-server-http",+ "python-sdk/fastmcp-server-low_level",{"group": "middleware","pages": [@@ -293,13 +325,14 @@"pages": ["python-sdk/fastmcp-utilities-__init__","python-sdk/fastmcp-utilities-cache",+ "python-sdk/fastmcp-utilities-cli","python-sdk/fastmcp-utilities-components","python-sdk/fastmcp-utilities-exceptions","python-sdk/fastmcp-utilities-http","python-sdk/fastmcp-utilities-inspect","python-sdk/fastmcp-utilities-json_schema",+ "python-sdk/fastmcp-utilities-json_schema_type","python-sdk/fastmcp-utilities-logging",- "python-sdk/fastmcp-utilities-mcp_config","python-sdk/fastmcp-utilities-openapi","python-sdk/fastmcp-utilities-tests","python-sdk/fastmcp-utilities-types"diff --git a/docs/python-sdk/fastmcp-cli-claude.mdx b/docs/python-sdk/fastmcp-cli-claude.mdxindex b56b63338..37fcedbf2 100644--- a/docs/python-sdk/fastmcp-cli-claude.mdx+++ b/docs/python-sdk/fastmcp-cli-claude.mdx@@ -10,7 +10,7 @@ Claude app integration utilities.## Functions-### `get_claude_config_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/claude.py#L14"><Icon icon="github" size="14" /></a></sup>+### `get_claude_config_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/claude.py#L14" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_claude_config_path() -> Path | None@@ -20,7 +20,7 @@ get_claude_config_path() -> Path | NoneGet the Claude config directory based on platform.-### `update_claude_config` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/claude.py#L32"><Icon icon="github" size="14" /></a></sup>+### `update_claude_config` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/claude.py#L32" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonupdate_claude_config(file_spec: str, server_name: str) -> booldiff --git a/docs/python-sdk/fastmcp-cli-cli.mdx b/docs/python-sdk/fastmcp-cli-cli.mdxindex 3ab68da9a..51e8bd4e1 100644--- a/docs/python-sdk/fastmcp-cli-cli.mdx+++ b/docs/python-sdk/fastmcp-cli-cli.mdx@@ -6,77 +6,66 @@ sidebarTitle: cli# `fastmcp.cli.cli`-FastMCP CLI tools.+FastMCP CLI tools using Cyclopts.## Functions-### `version` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L87"><Icon icon="github" size="14" /></a></sup>+### `version` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L89" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-version(ctx: Context)+version()```-### `dev` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L110"><Icon icon="github" size="14" /></a></sup>--```python-dev(server_spec: str = typer.Argument(..., help='Python file to run, optionally with :object suffix'), with_editable: Annotated[Path | None, typer.Option('--with-editable', '-e', help='Directory containing pyproject.toml to install in editable mode', exists=True, file_okay=False, resolve_path=True)] = None, with_packages: Annotated[list[str], typer.Option('--with', help='Additional packages to install')] = [], inspector_version: Annotated[str | None, typer.Option('--inspector-version', help='Version of the MCP Inspector to use')] = None, ui_port: Annotated[int | None, typer.Option('--ui-port', help='Port for the MCP Inspector UI')] = None, server_port: Annotated[int | None, typer.Option('--server-port', help='Port for the MCP Inspector Proxy server')] = None) -> None-```+Display version information and platform details.-Run a MCP server with the MCP Inspector.--### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L227"><Icon icon="github" size="14" /></a></sup>+### `dev` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L127" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-run(ctx: typer.Context, server_spec: str = typer.Argument(..., help='Python file, object specification (file:obj), or URL'), transport: Annotated[str | None, typer.Option('--transport', '-t', help='Transport protocol to use (stdio, http, or sse)')] = None, host: Annotated[str | None, typer.Option('--host', help='Host to bind to when using http transport (default: 127.0.0.1)')] = None, port: Annotated[int | None, typer.Option('--port', '-p', help='Port to bind to when using http transport (default: 8000)')] = None, log_level: Annotated[str | None, typer.Option('--log-level', '-l', help='Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)')] = None) -> None+dev(server_spec: str) -> None```-Run a MCP server or connect to a remote one.+Run an MCP server with the MCP Inspector for development.-The server can be specified in three ways:-1. Module approach: server.py - runs the module directly, looking for an object named mcp/server/app.+**Args:**+- `server_spec`: Python file to run, optionally with \:object suffix-2. Import approach: server.py:app - imports and runs the specified server object.-3. URL approach: http://server-url - connects to a remote server and creates a proxy.+### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L245" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+```python+run(server_spec: str) -> None+```-Note: This command runs the server directly. You are responsible for ensuring-all dependencies are available.+Run an MCP server or connect to a remote one.++The server can be specified in three ways:+1. Module approach: server.py - runs the module directly, looking for an object named 'mcp', 'server', or 'app'+2. Import approach: server.py:app - imports and runs the specified server object+3. URL approach: http://server-url - connects to a remote server and creates a proxyServer arguments can be passed after -- :fastmcp run server.py -- --config config.json --debug+**Args:**+- `server_spec`: Python file, object specification (file\:obj), or URL-### `install` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L313"><Icon icon="github" size="14" /></a></sup>-```python-install(server_spec: str = typer.Argument(..., help='Python file to run, optionally with :object suffix'), server_name: Annotated[str | None, typer.Option('--name', '-n', help="Custom name for the server (defaults to server's name attribute or file name)")] = None, with_editable: Annotated[Path | None, typer.Option('--with-editable', '-e', help='Directory containing pyproject.toml to install in editable mode', exists=True, file_okay=False, resolve_path=True)] = None, with_packages: Annotated[list[str], typer.Option('--with', help='Additional packages to install')] = [], env_vars: Annotated[list[str], typer.Option('--env-var', '-v', help='Environment variables in KEY=VALUE format')] = [], env_file: Annotated[Path | None, typer.Option('--env-file', '-f', help='Load environment variables from a .env file', exists=True, file_okay=True, dir_okay=False, resolve_path=True)] = None) -> None-```---Install a MCP server in the Claude desktop app.--Environment variables are preserved once added and only updated if new values-are explicitly provided.---### `inspect` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L444"><Icon icon="github" size="14" /></a></sup>+### `inspect` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L344" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-inspect(server_spec: str = typer.Argument(..., help='Python file to inspect, optionally with :object suffix'), output: Annotated[Path, typer.Option('--output', '-o', help='Output file path for the JSON report (default: server-info.json)')] = Path('server-info.json')) -> None+inspect(server_spec: str) -> None```-Inspect a FastMCP server and generate a JSON report.+Inspect an MCP server and generate a JSON report.-This command analyzes a FastMCP server (v1.x or v2.x) and generates-a comprehensive JSON report containing information about the server's-name, instructions, version, tools, prompts, resources, templates,-and capabilities.+This command analyzes an MCP server and generates a comprehensive JSON report+containing information about the server's name, instructions, version, tools,+prompts, resources, templates, and capabilities.**Examples:**@@ -85,3 +74,6 @@ fastmcp inspect server.py -o report.jsonfastmcp inspect server.py:mcp -o analysis.jsonfastmcp inspect path/to/server.py:app -o /tmp/server-info.json+**Args:**+- `server_spec`: Python file to inspect, optionally with \:object suffix+diff --git a/docs/python-sdk/fastmcp-cli-install-__init__.mdx b/docs/python-sdk/fastmcp-cli-install-__init__.mdxnew file mode 100644index 000000000..3909565f2--- /dev/null+++ b/docs/python-sdk/fastmcp-cli-install-__init__.mdx@@ -0,0 +1,9 @@+---+title: __init__+sidebarTitle: __init__+---++# `fastmcp.cli.install`+++Install subcommands for FastMCP CLI using Cyclopts.diff --git a/docs/python-sdk/fastmcp-cli-install-claude_code.mdx b/docs/python-sdk/fastmcp-cli-install-claude_code.mdxnew file mode 100644index 000000000..207756e69--- /dev/null+++ b/docs/python-sdk/fastmcp-cli-install-claude_code.mdx@@ -0,0 +1,68 @@+---+title: claude_code+sidebarTitle: claude_code+---++# `fastmcp.cli.install.claude_code`+++Claude Code integration for FastMCP install using Cyclopts.++## Functions++### `find_claude_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/claude_code.py#L19" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+find_claude_command() -> str | None+```+++Find the Claude Code CLI command.++Checks common installation locations since 'claude' is often a shell alias+that doesn't work with subprocess calls.+++### `check_claude_code_available` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/claude_code.py#L67" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+check_claude_code_available() -> bool+```+++Check if Claude Code CLI is available.+++### `install_claude_code` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/claude_code.py#L72" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+install_claude_code(file: Path, server_object: str | None, name: str) -> bool+```+++Install FastMCP server in Claude Code.++**Args:**+- `file`: Path to the server file+- `server_object`: Optional server object name (for \:object suffix)+- `name`: Name for the server in Claude Code+- `with_editable`: Optional directory to install in editable mode+- `with_packages`: Optional list of additional packages to install+- `env_vars`: Optional dictionary of environment variables++**Returns:**+- True if installation was successful, False otherwise+++### `claude_code_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/claude_code.py#L153" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+claude_code_command(server_spec: str) -> None+```+++Install an MCP server in Claude Code.++**Args:**+- `server_spec`: Python file to install, optionally with \:object suffix+diff --git a/docs/python-sdk/fastmcp-cli-install-claude_desktop.mdx b/docs/python-sdk/fastmcp-cli-install-claude_desktop.mdxnew file mode 100644index 000000000..ceb3ee328--- /dev/null+++ b/docs/python-sdk/fastmcp-cli-install-claude_desktop.mdx@@ -0,0 +1,55 @@+---+title: claude_desktop+sidebarTitle: claude_desktop+---++# `fastmcp.cli.install.claude_desktop`+++Claude Desktop integration for FastMCP install using Cyclopts.++## Functions++### `get_claude_config_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/claude_desktop.py#L19" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_claude_config_path() -> Path | None+```+++Get the Claude config directory based on platform.+++### `install_claude_desktop` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/claude_desktop.py#L37" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+install_claude_desktop(file: Path, server_object: str | None, name: str) -> bool+```+++Install FastMCP server in Claude Desktop.++**Args:**+- `file`: Path to the server file+- `server_object`: Optional server object name (for \:object suffix)+- `name`: Name for the server in Claude's config+- `with_editable`: Optional directory to install in editable mode+- `with_packages`: Optional list of additional packages to install+- `env_vars`: Optional dictionary of environment variables++**Returns:**+- True if installation was successful, False otherwise+++### `claude_desktop_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/claude_desktop.py#L126" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+claude_desktop_command(server_spec: str) -> None+```+++Install an MCP server in Claude Desktop.++**Args:**+- `server_spec`: Python file to install, optionally with \:object suffix+diff --git a/docs/python-sdk/fastmcp-cli-install-cursor.mdx b/docs/python-sdk/fastmcp-cli-install-cursor.mdxnew file mode 100644index 000000000..29c20d827--- /dev/null+++ b/docs/python-sdk/fastmcp-cli-install-cursor.mdx@@ -0,0 +1,78 @@+---+title: cursor+sidebarTitle: cursor+---++# `fastmcp.cli.install.cursor`+++Cursor integration for FastMCP install using Cyclopts.++## Functions++### `generate_cursor_deeplink` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/cursor.py#L20" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+generate_cursor_deeplink(server_name: str, server_config: StdioMCPServer) -> str+```+++Generate a Cursor deeplink for installing the MCP server.++**Args:**+- `server_name`: Name of the server+- `server_config`: Server configuration++**Returns:**+- Deeplink URL that can be clicked to install the server+++### `open_deeplink` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/cursor.py#L44" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+open_deeplink(deeplink: str) -> bool+```+++Attempt to open a deeplink URL using the system's default handler.++**Args:**+- `deeplink`: The deeplink URL to open++**Returns:**+- True if the command succeeded, False otherwise+++### `install_cursor` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/cursor.py#L67" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+install_cursor(file: Path, server_object: str | None, name: str) -> bool+```+++Install FastMCP server in Cursor.++**Args:**+- `file`: Path to the server file+- `server_object`: Optional server object name (for \:object suffix)+- `name`: Name for the server in Cursor+- `with_editable`: Optional directory to install in editable mode+- `with_packages`: Optional list of additional packages to install+- `env_vars`: Optional dictionary of environment variables++**Returns:**+- True if installation was successful, False otherwise+++### `cursor_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/cursor.py#L136" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+cursor_command(server_spec: str) -> None+```+++Install an MCP server in Cursor.++**Args:**+- `server_spec`: Python file to install, optionally with \:object suffix+diff --git a/docs/python-sdk/fastmcp-cli-install-mcp_config.mdx b/docs/python-sdk/fastmcp-cli-install-mcp_config.mdxnew file mode 100644index 000000000..f22480400--- /dev/null+++ b/docs/python-sdk/fastmcp-cli-install-mcp_config.mdx@@ -0,0 +1,46 @@+---+title: mcp_config+sidebarTitle: mcp_config+---++# `fastmcp.cli.install.mcp_config`+++MCP configuration JSON generation for FastMCP install using Cyclopts.++## Functions++### `install_mcp_config` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/mcp_config.py#L19" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+install_mcp_config(file: Path, server_object: str | None, name: str) -> bool+```+++Generate MCP configuration JSON for manual installation.++**Args:**+- `file`: Path to the server file+- `server_object`: Optional server object name (for \:object suffix)+- `name`: Name for the server in MCP config+- `with_editable`: Optional directory to install in editable mode+- `with_packages`: Optional list of additional packages to install+- `env_vars`: Optional dictionary of environment variables+- `copy`: If True, copy to clipboard instead of printing to stdout++**Returns:**+- True if generation was successful, False otherwise+++### `mcp_config_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/mcp_config.py#L96" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+mcp_config_command(server_spec: str) -> None+```+++Generate MCP configuration JSON for manual installation.++**Args:**+- `server_spec`: Python file to install, optionally with \:object suffix+diff --git a/docs/python-sdk/fastmcp-cli-install-shared.mdx b/docs/python-sdk/fastmcp-cli-install-shared.mdxnew file mode 100644index 000000000..5279742eb--- /dev/null+++ b/docs/python-sdk/fastmcp-cli-install-shared.mdx@@ -0,0 +1,31 @@+---+title: shared+sidebarTitle: shared+---++# `fastmcp.cli.install.shared`+++Shared utilities for install commands.++## Functions++### `parse_env_var` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/shared.py#L15" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+parse_env_var(env_var: str) -> tuple[str, str]+```+++Parse environment variable string in format KEY=VALUE.+++### `process_common_args` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/install/shared.py#L26" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+process_common_args(server_spec: str, server_name: str | None, with_packages: list[str], env_vars: list[str], env_file: Path | None) -> tuple[Path, str | None, str, list[str], dict[str, str] | None]+```+++Process common arguments shared by all install commands.+diff --git a/docs/python-sdk/fastmcp-cli-run.mdx b/docs/python-sdk/fastmcp-cli-run.mdxindex 78adc9056..16cb54405 100644--- a/docs/python-sdk/fastmcp-cli-run.mdx+++ b/docs/python-sdk/fastmcp-cli-run.mdx@@ -6,11 +6,11 @@ sidebarTitle: run# `fastmcp.cli.run`-FastMCP run command implementation.+FastMCP run command implementation with enhanced type hints.## Functions-### `is_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L14"><Icon icon="github" size="14" /></a></sup>+### `is_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L18" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonis_url(path: str) -> bool@@ -20,7 +20,7 @@ is_url(path: str) -> boolCheck if a string is a URL.-### `parse_file_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L20"><Icon icon="github" size="14" /></a></sup>+### `parse_file_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L24" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonparse_file_path(server_spec: str) -> tuple[Path, str | None]@@ -36,7 +36,7 @@ Parse a file path that may include a server object specification.- Tuple of (file_path, server_object)-### `import_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L51"><Icon icon="github" size="14" /></a></sup>+### `import_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L55" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonimport_server(file: Path, server_object: str | None = None) -> Any@@ -53,7 +53,7 @@ Import a MCP server from a file.- The server object-### `create_client_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L121"><Icon icon="github" size="14" /></a></sup>+### `create_client_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L125" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncreate_client_server(url: str) -> Any@@ -69,7 +69,7 @@ Create a FastMCP server from a client URL.- A FastMCP server instance-### `import_server_with_args` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L141"><Icon icon="github" size="14" /></a></sup>+### `import_server_with_args` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L145" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonimport_server_with_args(file: Path, server_object: str | None = None, server_args: list[str] | None = None) -> Any@@ -87,10 +87,10 @@ Import a server with optional command line arguments.- The imported server object-### `run_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L165"><Icon icon="github" size="14" /></a></sup>+### `run_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/run.py#L169" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-run_command(server_spec: str, transport: str | None = None, host: str | None = None, port: int | None = None, log_level: str | None = None, server_args: list[str] | None = None) -> None+run_command(server_spec: str, transport: TransportType | None = None, host: str | None = None, port: int | None = None, path: str | None = None, log_level: LogLevelType | None = None, server_args: list[str] | None = None, show_banner: bool = True) -> None```@@ -101,6 +101,8 @@ Run a MCP server or connect to a remote one.- `transport`: Transport protocol to use- `host`: Host to bind to when using http transport- `port`: Port to bind to when using http transport+- `path`: Path to bind to when using http transport- `log_level`: Log level- `server_args`: Additional arguments to pass to the server+- `show_banner`: Whether to show the server bannerdiff --git a/docs/python-sdk/fastmcp-client-auth-bearer.mdx b/docs/python-sdk/fastmcp-client-auth-bearer.mdxindex c83e354b5..c04905b14 100644--- a/docs/python-sdk/fastmcp-client-auth-bearer.mdx+++ b/docs/python-sdk/fastmcp-client-auth-bearer.mdx@@ -7,11 +7,11 @@ sidebarTitle: bearer## Classes-### `BearerAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/bearer.py#L11"><Icon icon="github" size="14" /></a></sup>+### `BearerAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/bearer.py#L11" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>**Methods:**-#### `auth_flow` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/bearer.py#L15"><Icon icon="github" size="14" /></a></sup>+#### `auth_flow` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/bearer.py#L15" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonauth_flow(self, request)diff --git a/docs/python-sdk/fastmcp-client-auth-oauth.mdx b/docs/python-sdk/fastmcp-client-auth-oauth.mdxindex 19ad489e9..fe24548ee 100644--- a/docs/python-sdk/fastmcp-client-auth-oauth.mdx+++ b/docs/python-sdk/fastmcp-client-auth-oauth.mdx@@ -7,16 +7,46 @@ sidebarTitle: oauth## Functions-### `default_cache_dir` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L38"><Icon icon="github" size="14" /></a></sup>+### `default_cache_dir` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L35" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythondefault_cache_dir() -> Path```-### `OAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L295"><Icon icon="github" size="14" /></a></sup>+### `discover_oauth_metadata` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L153" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-OAuth(mcp_url: str, scopes: str | list[str] | None = None, client_name: str = 'FastMCP Client', token_storage_cache_dir: Path | None = None, additional_client_metadata: dict[str, Any] | None = None) -> _MCPOAuthClientProvider+discover_oauth_metadata(server_base_url: str, httpx_kwargs: dict[str, Any] | None = None) -> OAuthMetadata | None+```+++Discover OAuth metadata from the server using RFC 8414 well-known endpoint.++**Args:**+- `server_base_url`: Base URL of the OAuth server (e.g., "https\://example.com")+- `httpx_kwargs`: Additional kwargs for httpx client++**Returns:**+- OAuth metadata if found, None otherwise+++### `check_if_auth_required` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L188" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+check_if_auth_required(mcp_url: str, httpx_kwargs: dict[str, Any] | None = None) -> bool+```+++Check if the MCP endpoint requires authentication by making a test request.++**Returns:**+- True if auth appears to be required, False otherwise+++### `OAuth` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L218" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+OAuth(mcp_url: str, scopes: str | list[str] | None = None, client_name: str = 'FastMCP Client', token_storage_cache_dir: Path | None = None, additional_client_metadata: dict[str, Any] | None = None) -> OAuthClientProvider```@@ -38,52 +68,72 @@ httpx.AsyncClient (or appropriate FastMCP client/transport instance)## Classes-### `ServerOAuthMetadata` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L43"><Icon icon="github" size="14" /></a></sup>+### `FileTokenStorage` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L39" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>-More flexible OAuth metadata model that accepts broader ranges of values-than the restrictive MCP standard model.+File-based token storage implementation for OAuth credentials and tokens.+Implements the mcp.client.auth.TokenStorage protocol.-This handles real-world OAuth servers like PayPal that may support-additional methods not in the MCP specification.+Each instance is tied to a specific server URL for proper token isolation.-### `OAuthClientProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L68"><Icon icon="github" size="14" /></a></sup>+**Methods:**+#### `get_base_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L54" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>-OAuth client provider with more flexible OAuth metadata discovery.+```python+get_base_url(url: str) -> str+```+Extract the base URL (scheme + host) from a URL.-### `FileTokenStorage` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L116"><Icon icon="github" size="14" /></a></sup>+#### `get_cache_key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L59" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>-File-based token storage implementation for OAuth credentials and tokens.-Implements the mcp.client.auth.TokenStorage protocol.+```python+get_cache_key(self) -> str+```-Each instance is tied to a specific server URL for proper token isolation.+Generate a safe filesystem key from the server's base URL.-**Methods:**+#### `get_tokens` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L74" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_tokens(self) -> OAuthToken | None+```-#### `get_base_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L131"><Icon icon="github" size="14" /></a></sup>+Load tokens from file storage.+++#### `set_tokens` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L91" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-get_base_url(url: str) -> str+set_tokens(self, tokens: OAuthToken) -> None```-Extract the base URL (scheme + host) from a URL.+Save tokens to file storage.-#### `get_cache_key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L136"><Icon icon="github" size="14" /></a></sup>+#### `get_client_info` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L97" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-get_cache_key(self) -> str+get_client_info(self) -> OAuthClientInformationFull | None```-Generate a safe filesystem key from the server's base URL.+Load client information from file storage.+++#### `set_client_info` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L125" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+set_client_info(self, client_info: OAuthClientInformationFull) -> None+```++Save client information to file storage.-#### `clear` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L208"><Icon icon="github" size="14" /></a></sup>+#### `clear` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L131" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonclear(self) -> None@@ -92,7 +142,7 @@ clear(self) -> NoneClear all cached data for this server.-#### `clear_all` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L217"><Icon icon="github" size="14" /></a></sup>+#### `clear_all` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/auth/oauth.py#L140" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonclear_all(cls, cache_dir: Path | None = None) -> Nonediff --git a/docs/python-sdk/fastmcp-client-client.mdx b/docs/python-sdk/fastmcp-client-client.mdxindex 3b99527e7..a1ff804bf 100644--- a/docs/python-sdk/fastmcp-client-client.mdx+++ b/docs/python-sdk/fastmcp-client-client.mdx@@ -7,7 +7,16 @@ sidebarTitle: client## Classes-### `Client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L60"><Icon icon="github" size="14" /></a></sup>+### `ClientSessionState` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L74" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++Holds all session-related state for a Client instance.++This allows clean separation of configuration (which is copied) from+session state (which should be fresh for each new client instance).+++### `Client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L90" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>MCP client that delegates connection management to a Transport instance.@@ -16,14 +25,34 @@ The Client class is responsible for MCP protocol logic, while the Transporthandles connection establishment and management. Client provides methods forworking with resources, prompts, tools and other MCP capabilities.+This client supports reentrant context managers (multiple concurrent+`async with client:` blocks) using reference counting and background session+management. This allows efficient session reuse in any scenario with+nested or concurrent client usage.++MCP SDK 1.10 introduced automatic list_tools() calls during call_tool()+execution. This created a race condition where events could be reset while+other tasks were waiting on them, causing deadlocks. The issue was exposed+in proxy scenarios but affects any reentrant usage.++The solution uses reference counting to track active context managers,+a background task to manage the session lifecycle, events to coordinate+between tasks, and ensures all session state changes happen within a lock.+Events are only created when needed, never reset outside locks.++This design prevents race conditions where tasks wait on events that get+replaced by other tasks, ensuring reliable coordination in concurrent scenarios.+**Args:**-- `transport`: Connection source specification, which can be\:-- ClientTransport\: Direct transport instance-- FastMCP\: In-process FastMCP server-- AnyUrl | str\: URL to connect to-- Path\: File path for local socket-- MCPConfig\: MCP server configuration-- dict\: Transport configuration+- `transport`:+Connection source specification, which can be\:++ - ClientTransport\: Direct transport instance+ - FastMCP\: In-process FastMCP server+ - AnyUrl or str\: URL to connect to+ - Path\: File path for local socket+ - MCPConfig\: MCP server configuration+ - dict\: Transport configuration- `roots`: Optional RootsList or RootsHandler for filesystem access- `sampling_handler`: Optional handler for sampling requests- `log_handler`: Optional handler for log messages@@ -35,20 +64,22 @@ Set to 0 to disable. If None, uses the value in the FastMCP global settings.**Examples:**-```python # Connect to FastMCP server client =-Client("http://localhost:8080")+```python+# Connect to FastMCP server+client = Client("http://localhost:8080")async with client:- # List available resources resources = await client.list_resources()+ # List available resources+ resources = await client.list_resources()- # Call a tool result = await client.call_tool("my_tool", {"param":- "value"})+ # Call a tool+ result = await client.call_tool("my_tool", {"param": "value"})```**Methods:**-#### `session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L207"><Icon icon="github" size="14" /></a></sup>+#### `session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L273" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsession(self) -> ClientSession@@ -57,7 +88,7 @@ session(self) -> ClientSessionGet the current active session. Raises RuntimeError if not connected.-#### `initialize_result` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L217"><Icon icon="github" size="14" /></a></sup>+#### `initialize_result` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L283" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoninitialize_result(self) -> mcp.types.InitializeResult@@ -66,7 +97,7 @@ initialize_result(self) -> mcp.types.InitializeResultGet the result of the initialization request.-#### `set_roots` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L225"><Icon icon="github" size="14" /></a></sup>+#### `set_roots` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L291" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset_roots(self, roots: RootsList | RootsHandler) -> None@@ -75,7 +106,7 @@ set_roots(self, roots: RootsList | RootsHandler) -> NoneSet the roots for the client. This does not automatically call `send_roots_list_changed`.-#### `set_sampling_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L229"><Icon icon="github" size="14" /></a></sup>+#### `set_sampling_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L295" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset_sampling_callback(self, sampling_callback: SamplingHandler) -> None@@ -84,7 +115,16 @@ set_sampling_callback(self, sampling_callback: SamplingHandler) -> NoneSet the sampling callback for the client.-#### `is_connected` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L235"><Icon icon="github" size="14" /></a></sup>+#### `set_elicitation_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L301" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+set_elicitation_callback(self, elicitation_callback: ElicitationHandler) -> None+```++Set the elicitation callback for the client.+++#### `is_connected` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L309" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonis_connected(self) -> bool@@ -92,3 +132,368 @@ is_connected(self) -> boolCheck if the client is currently connected.++#### `new` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L313" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+new(self) -> Client[ClientTransportT]+```++Create a new client instance with the same configuration but fresh session state.++This creates a new client with the same transport, handlers, and configuration,+but with no active session. Useful for creating independent sessions that don't+share state with the original client.++**Returns:**+- A new Client instance with the same configuration but disconnected state.+++#### `close` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L476" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+close(self)+```++#### `ping` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L482" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+ping(self) -> bool+```++Send a ping request.+++#### `cancel` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L487" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+cancel(self, request_id: str | int, reason: str | None = None) -> None+```++Send a cancellation notification for an in-progress request.+++#### `progress` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L504" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+progress(self, progress_token: str | int, progress: float, total: float | None = None, message: str | None = None) -> None+```++Send a progress notification.+++#### `set_logging_level` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L516" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+set_logging_level(self, level: mcp.types.LoggingLevel) -> None+```++Send a logging/setLevel request.+++#### `send_roots_list_changed` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L520" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+send_roots_list_changed(self) -> None+```++Send a roots/list_changed notification.+++#### `list_resources_mcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L526" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_resources_mcp(self) -> mcp.types.ListResourcesResult+```++Send a resources/list request and return the complete MCP protocol result.++**Returns:**+- mcp.types.ListResourcesResult: The complete response object from the protocol,+containing the list of resources and any additional metadata.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `list_resources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L539" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_resources(self) -> list[mcp.types.Resource]+```++Retrieve a list of resources available on the server.++**Returns:**+- list\[mcp.types.Resource]: A list of Resource objects.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `list_resource_templates_mcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L551" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_resource_templates_mcp(self) -> mcp.types.ListResourceTemplatesResult+```++Send a resources/listResourceTemplates request and return the complete MCP protocol result.++**Returns:**+- mcp.types.ListResourceTemplatesResult: The complete response object from the protocol,+containing the list of resource templates and any additional metadata.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `list_resource_templates` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L566" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_resource_templates(self) -> list[mcp.types.ResourceTemplate]+```++Retrieve a list of resource templates available on the server.++**Returns:**+- list\[mcp.types.ResourceTemplate]: A list of ResourceTemplate objects.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `read_resource_mcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L580" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read_resource_mcp(self, uri: AnyUrl | str) -> mcp.types.ReadResourceResult+```++Send a resources/read request and return the complete MCP protocol result.++**Args:**+- `uri`: The URI of the resource to read. Can be a string or an AnyUrl object.++**Returns:**+- mcp.types.ReadResourceResult: The complete response object from the protocol,+containing the resource contents and any additional metadata.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `read_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L600" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read_resource(self, uri: AnyUrl | str) -> list[mcp.types.TextResourceContents | mcp.types.BlobResourceContents]+```++Read the contents of a resource or resolved template.++**Args:**+- `uri`: The URI of the resource to read. Can be a string or an AnyUrl object.++**Returns:**+- list\[mcp.types.TextResourceContents | mcp.types.BlobResourceContents]: A list of content+objects, typically containing either text or binary data.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `list_prompts_mcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L639" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_prompts_mcp(self) -> mcp.types.ListPromptsResult+```++Send a prompts/list request and return the complete MCP protocol result.++**Returns:**+- mcp.types.ListPromptsResult: The complete response object from the protocol,+containing the list of prompts and any additional metadata.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `list_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L652" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_prompts(self) -> list[mcp.types.Prompt]+```++Retrieve a list of prompts available on the server.++**Returns:**+- list\[mcp.types.Prompt]: A list of Prompt objects.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `get_prompt_mcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L665" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_prompt_mcp(self, name: str, arguments: dict[str, Any] | None = None) -> mcp.types.GetPromptResult+```++Send a prompts/get request and return the complete MCP protocol result.++**Args:**+- `name`: The name of the prompt to retrieve.+- `arguments`: Arguments to pass to the prompt. Defaults to None.++**Returns:**+- mcp.types.GetPromptResult: The complete response object from the protocol,+containing the prompt messages and any additional metadata.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `get_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L699" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_prompt(self, name: str, arguments: dict[str, Any] | None = None) -> mcp.types.GetPromptResult+```++Retrieve a rendered prompt message list from the server.++**Args:**+- `name`: The name of the prompt to retrieve.+- `arguments`: Arguments to pass to the prompt. Defaults to None.++**Returns:**+- mcp.types.GetPromptResult: The complete response object from the protocol,+containing the prompt messages and any additional metadata.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `complete_mcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L720" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+complete_mcp(self, ref: mcp.types.ResourceReference | mcp.types.PromptReference, argument: dict[str, str]) -> mcp.types.CompleteResult+```++Send a completion request and return the complete MCP protocol result.++**Args:**+- `ref`: The reference to complete.+- `argument`: Arguments to pass to the completion request.++**Returns:**+- mcp.types.CompleteResult: The complete response object from the protocol,+containing the completion and any additional metadata.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `complete` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L741" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+complete(self, ref: mcp.types.ResourceReference | mcp.types.PromptReference, argument: dict[str, str]) -> mcp.types.Completion+```++Send a completion request to the server.++**Args:**+- `ref`: The reference to complete.+- `argument`: Arguments to pass to the completion request.++**Returns:**+- mcp.types.Completion: The completion object.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `list_tools_mcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L763" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_tools_mcp(self) -> mcp.types.ListToolsResult+```++Send a tools/list request and return the complete MCP protocol result.++**Returns:**+- mcp.types.ListToolsResult: The complete response object from the protocol,+containing the list of tools and any additional metadata.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `list_tools` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L776" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_tools(self) -> list[mcp.types.Tool]+```++Retrieve a list of tools available on the server.++**Returns:**+- list\[mcp.types.Tool]: A list of Tool objects.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `call_tool_mcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L790" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+call_tool_mcp(self, name: str, arguments: dict[str, Any], progress_handler: ProgressHandler | None = None, timeout: datetime.timedelta | float | int | None = None) -> mcp.types.CallToolResult+```++Send a tools/call request and return the complete MCP protocol result.++This method returns the raw CallToolResult object, which includes an isError flag+and other metadata. It does not raise an exception if the tool call results in an error.++**Args:**+- `name`: The name of the tool to call.+- `arguments`: Arguments to pass to the tool.+- `timeout`: The timeout for the tool call. Defaults to None.+- `progress_handler`: The progress handler to use for the tool call. Defaults to None.++**Returns:**+- mcp.types.CallToolResult: The complete response object from the protocol,+containing the tool result and any additional metadata.++**Raises:**+- `RuntimeError`: If called while the client is not connected.+++#### `call_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L826" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+call_tool(self, name: str, arguments: dict[str, Any] | None = None, timeout: datetime.timedelta | float | int | None = None, progress_handler: ProgressHandler | None = None, raise_on_error: bool = True) -> CallToolResult+```++Call a tool on the server.++Unlike call_tool_mcp, this method raises a ToolError if the tool call results in an error.++**Args:**+- `name`: The name of the tool to call.+- `arguments`: Arguments to pass to the tool. Defaults to None.+- `timeout`: The timeout for the tool call. Defaults to None.+- `progress_handler`: The progress handler to use for the tool call. Defaults to None.++**Returns:**+-+The content returned by the tool. If the tool returns structured+outputs, they are returned as a dataclass (if an output schema+is available) or a dictionary; otherwise, a list of content+blocks is returned. Note: to receive both structured and+unstructured outputs, use call_tool_mcp instead and access the+raw result object.++**Raises:**+- `ToolError`: If the tool call results in an error.+- `RuntimeError`: If called while the client is not connected.+++### `CallToolResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/client.py#L898" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>diff --git a/docs/python-sdk/fastmcp-client-elicitation.mdx b/docs/python-sdk/fastmcp-client-elicitation.mdxnew file mode 100644index 000000000..5e8957f32--- /dev/null+++ b/docs/python-sdk/fastmcp-client-elicitation.mdx@@ -0,0 +1,18 @@+---+title: elicitation+sidebarTitle: elicitation+---++# `fastmcp.client.elicitation`++## Functions++### `create_elicitation_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/elicitation.py#L36" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+create_elicitation_callback(elicitation_handler: ElicitationHandler) -> ElicitationFnT+```++## Classes++### `ElicitResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/elicitation.py#L21" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>diff --git a/docs/python-sdk/fastmcp-client-logging.mdx b/docs/python-sdk/fastmcp-client-logging.mdxindex 83da895c3..e4a36db09 100644--- a/docs/python-sdk/fastmcp-client-logging.mdx+++ b/docs/python-sdk/fastmcp-client-logging.mdx@@ -7,7 +7,13 @@ sidebarTitle: logging## Functions-### `create_log_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/logging.py#L20"><Icon icon="github" size="14" /></a></sup>+### `default_log_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/logging.py#L15" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+default_log_handler(message: LogMessage) -> None+```++### `create_log_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/logging.py#L19" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncreate_log_callback(handler: LogHandler | None = None) -> LoggingFnTdiff --git a/docs/python-sdk/fastmcp-client-messages.mdx b/docs/python-sdk/fastmcp-client-messages.mdxnew file mode 100644index 000000000..ef1b87436--- /dev/null+++ b/docs/python-sdk/fastmcp-client-messages.mdx@@ -0,0 +1,107 @@+---+title: messages+sidebarTitle: messages+---++# `fastmcp.client.messages`++## Classes++### `MessageHandler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L16" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++This class is used to handle MCP messages sent to the client. It is used to handle all messages,+requests, notifications, and exceptions. Users can override any of the hooks+++**Methods:**++#### `dispatch` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L30" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+dispatch(self, message: Message) -> None+```++#### `on_message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L74" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_message(self, message: Message) -> None+```++#### `on_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L77" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_request(self, message: RequestResponder[mcp.types.ServerRequest, mcp.types.ClientResult]) -> None+```++#### `on_ping` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L82" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_ping(self, message: mcp.types.PingRequest) -> None+```++#### `on_list_roots` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L85" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_list_roots(self, message: mcp.types.ListRootsRequest) -> None+```++#### `on_create_message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L88" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_create_message(self, message: mcp.types.CreateMessageRequest) -> None+```++#### `on_notification` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L91" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_notification(self, message: mcp.types.ServerNotification) -> None+```++#### `on_exception` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L94" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_exception(self, message: Exception) -> None+```++#### `on_progress` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L97" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_progress(self, message: mcp.types.ProgressNotification) -> None+```++#### `on_logging_message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L100" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_logging_message(self, message: mcp.types.LoggingMessageNotification) -> None+```++#### `on_tool_list_changed` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L105" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_tool_list_changed(self, message: mcp.types.ToolListChangedNotification) -> None+```++#### `on_resource_list_changed` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L110" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_resource_list_changed(self, message: mcp.types.ResourceListChangedNotification) -> None+```++#### `on_prompt_list_changed` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L115" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_prompt_list_changed(self, message: mcp.types.PromptListChangedNotification) -> None+```++#### `on_resource_updated` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L120" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_resource_updated(self, message: mcp.types.ResourceUpdatedNotification) -> None+```++#### `on_cancelled` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/messages.py#L125" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_cancelled(self, message: mcp.types.CancelledNotification) -> None+```diff --git a/docs/python-sdk/fastmcp-client-oauth_callback.mdx b/docs/python-sdk/fastmcp-client-oauth_callback.mdxindex e251c5ac4..beddcd64f 100644--- a/docs/python-sdk/fastmcp-client-oauth_callback.mdx+++ b/docs/python-sdk/fastmcp-client-oauth_callback.mdx@@ -15,7 +15,7 @@ and display styled responses to users.## Functions-### `create_callback_html` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L25"><Icon icon="github" size="14" /></a></sup>+### `create_callback_html` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L25" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncreate_callback_html(message: str, is_success: bool = True, title: str = 'FastMCP OAuth', server_url: str | None = None) -> str@@ -25,7 +25,7 @@ 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#L197"><Icon icon="github" size="14" /></a></sup>+### `create_oauth_callback_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L197" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncreate_oauth_callback_server(port: int, callback_path: str = '/callback', server_url: str | None = None, response_future: asyncio.Future | None = None) -> Server@@ -46,17 +46,17 @@ Create an OAuth callback server.## Classes-### `CallbackResponse` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L183"><Icon icon="github" size="14" /></a></sup>+### `CallbackResponse` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L183" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>**Methods:**-#### `from_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L190"><Icon icon="github" size="14" /></a></sup>+#### `from_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L190" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_dict(cls, data: dict[str, str]) -> CallbackResponse```-#### `to_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L193"><Icon icon="github" size="14" /></a></sup>+#### `to_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/oauth_callback.py#L193" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonto_dict(self) -> dict[str, str]diff --git a/docs/python-sdk/fastmcp-client-progress.mdx b/docs/python-sdk/fastmcp-client-progress.mdxindex aecd0f37b..123839072 100644--- a/docs/python-sdk/fastmcp-client-progress.mdx+++ b/docs/python-sdk/fastmcp-client-progress.mdx@@ -5,4 +5,21 @@ sidebarTitle: progress# `fastmcp.client.progress`-*This module is empty or contains only private/internal implementations.*+## Functions++### `default_progress_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/progress.py#L12" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+default_progress_handler(progress: float, total: float | None, message: str | None) -> None+```+++Default handler for progress notifications.++Logs progress updates at debug level, properly handling missing total or message values.++**Args:**+- `progress`: Current progress value+- `total`: Optional total expected value+- `message`: Optional status message+diff --git a/docs/python-sdk/fastmcp-client-roots.mdx b/docs/python-sdk/fastmcp-client-roots.mdxindex a081bc2fa..842c63d5a 100644--- a/docs/python-sdk/fastmcp-client-roots.mdx+++ b/docs/python-sdk/fastmcp-client-roots.mdx@@ -7,13 +7,13 @@ sidebarTitle: roots## Functions-### `convert_roots_list` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/roots.py#L19"><Icon icon="github" size="14" /></a></sup>+### `convert_roots_list` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/roots.py#L19" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonconvert_roots_list(roots: RootsList) -> list[mcp.types.Root]```-### `create_roots_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/roots.py#L33"><Icon icon="github" size="14" /></a></sup>+### `create_roots_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/roots.py#L33" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncreate_roots_callback(handler: RootsList | RootsHandler) -> ListRootsFnTdiff --git a/docs/python-sdk/fastmcp-client-sampling.mdx b/docs/python-sdk/fastmcp-client-sampling.mdxindex 53d3893de..ac90fdedd 100644--- a/docs/python-sdk/fastmcp-client-sampling.mdx+++ b/docs/python-sdk/fastmcp-client-sampling.mdx@@ -7,7 +7,7 @@ sidebarTitle: sampling## Functions-### `create_sampling_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/sampling.py#L25"><Icon icon="github" size="14" /></a></sup>+### `create_sampling_callback` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/sampling.py#L25" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncreate_sampling_callback(sampling_handler: SamplingHandler) -> SamplingFnTdiff --git a/docs/python-sdk/fastmcp-client-transports.mdx b/docs/python-sdk/fastmcp-client-transports.mdxindex adbab20ee..8e29e754f 100644--- a/docs/python-sdk/fastmcp-client-transports.mdx+++ b/docs/python-sdk/fastmcp-client-transports.mdx@@ -7,7 +7,7 @@ sidebarTitle: transports## Functions-### `infer_transport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L837"><Icon icon="github" size="14" /></a></sup>+### `infer_transport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L849" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoninfer_transport(transport: ClientTransport | FastMCP | FastMCP1Server | AnyUrl | Path | MCPConfig | dict[str, Any] | str) -> ClientTransport@@ -57,13 +57,13 @@ transport = infer_transport(config)## Classes-### `SessionKwargs` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L52"><Icon icon="github" size="14" /></a></sup>+### `SessionKwargs` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L57" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Keyword arguments for the MCP ClientSession constructor.-### `ClientTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L63"><Icon icon="github" size="14" /></a></sup>+### `ClientTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L69" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Abstract base class for different MCP client transport mechanisms.@@ -72,25 +72,79 @@ A Transport is responsible for establishing and managing connectionsto an MCP server, and providing a ClientSession within an async context.-### `WSTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L109"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `connect_session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L80" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+connect_session(self, **session_kwargs: Unpack[SessionKwargs]) -> AsyncIterator[ClientSession]+```++Establishes a connection and yields an active ClientSession.++The ClientSession is *not* expected to be initialized in this context manager.++The session is guaranteed to be valid only within the scope of the+async context manager. Connection setup and teardown are handled+within this context.++**Args:**+- `**session_kwargs`: Keyword arguments to pass to the ClientSession+ constructor (e.g., callbacks, timeouts).+++#### `close` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L106" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+close(self)+```++Close the transport.+++### `WSTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L115" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Transport implementation that connects to an MCP server via WebSockets.-### `SSETransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L148"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `connect_session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L133" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+connect_session(self, **session_kwargs: Unpack[SessionKwargs]) -> AsyncIterator[ClientSession]+```++### `SSETransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L154" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Transport implementation that connects to an MCP server via Server-Sent Events.-### `StreamableHttpTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L223"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `connect_session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L190" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+connect_session(self, **session_kwargs: Unpack[SessionKwargs]) -> AsyncIterator[ClientSession]+```++### `StreamableHttpTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L226" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Transport implementation that connects to an MCP server via Streamable HTTP Requests.-### `StdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L299"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `connect_session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L262" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+connect_session(self, **session_kwargs: Unpack[SessionKwargs]) -> AsyncIterator[ClientSession]+```++### `StdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L299" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Base transport for connecting to an MCP server via subprocess with stdio.@@ -99,37 +153,63 @@ This is a base class that can be subclassed for specific command-basedtransports like Python, Node, Uvx, etc.-### `PythonStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L416"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `connect_session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L342" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+connect_session(self, **session_kwargs: Unpack[SessionKwargs]) -> AsyncIterator[ClientSession]+```++#### `connect` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L355" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+connect(self, **session_kwargs: Unpack[SessionKwargs]) -> ClientSession | None+```++#### `disconnect` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L406" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+disconnect(self)+```++#### `close` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L421" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+close(self)+```++### `PythonStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L430" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Transport for running Python scripts.-### `FastMCPStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L462"><Icon icon="github" size="14" /></a></sup>+### `FastMCPStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L476" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Transport for running FastMCP servers using the FastMCP CLI.-### `NodeStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L489"><Icon icon="github" size="14" /></a></sup>+### `NodeStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L503" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Transport for running Node.js scripts.-### `UvxStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L531"><Icon icon="github" size="14" /></a></sup>+### `UvxStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L545" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Transport for running commands via the uvx tool.-### `NpxStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L597"><Icon icon="github" size="14" /></a></sup>+### `NpxStdioTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L611" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Transport for running commands via the npx tool.-### `FastMCPTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L659"><Icon icon="github" size="14" /></a></sup>+### `FastMCPTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L673" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>In-memory transport for FastMCP servers.@@ -140,7 +220,15 @@ servers from the low-level MCP SDK. This is particularly useful for unittests or scenarios where client and server run in the same runtime.-### `MCPConfigTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L713"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `connect_session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L692" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+connect_session(self, **session_kwargs: Unpack[SessionKwargs]) -> AsyncIterator[ClientSession]+```++### `MCPConfigTransport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L727" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Transport for connecting to one or more MCP servers defined in an MCPConfig.@@ -190,3 +278,11 @@ async with client:icons = await client.read_resource("weather://weather/icons/sunny")```++**Methods:**++#### `connect_session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/client/transports.py#L801" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+connect_session(self, **session_kwargs: Unpack[SessionKwargs]) -> AsyncIterator[ClientSession]+```diff --git a/docs/python-sdk/fastmcp-exceptions.mdx b/docs/python-sdk/fastmcp-exceptions.mdxindex 6b54286b5..26e62012a 100644--- a/docs/python-sdk/fastmcp-exceptions.mdx+++ b/docs/python-sdk/fastmcp-exceptions.mdx@@ -10,55 +10,55 @@ Custom exceptions for FastMCP.## Classes-### `FastMCPError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L6"><Icon icon="github" size="14" /></a></sup>+### `FastMCPError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L6" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Base error for FastMCP.-### `ValidationError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L10"><Icon icon="github" size="14" /></a></sup>+### `ValidationError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L10" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Error in validating parameters or return values.-### `ResourceError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L14"><Icon icon="github" size="14" /></a></sup>+### `ResourceError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L14" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Error in resource operations.-### `ToolError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L18"><Icon icon="github" size="14" /></a></sup>+### `ToolError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L18" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Error in tool operations.-### `PromptError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L22"><Icon icon="github" size="14" /></a></sup>+### `PromptError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L22" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Error in prompt operations.-### `InvalidSignature` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L26"><Icon icon="github" size="14" /></a></sup>+### `InvalidSignature` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L26" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Invalid signature for use with FastMCP.-### `ClientError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L30"><Icon icon="github" size="14" /></a></sup>+### `ClientError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L30" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Error in client operations.-### `NotFoundError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L34"><Icon icon="github" size="14" /></a></sup>+### `NotFoundError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L34" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Object not found.-### `DisabledError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L38"><Icon icon="github" size="14" /></a></sup>+### `DisabledError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/exceptions.py#L38" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Object is disabled.diff --git a/docs/python-sdk/fastmcp-mcp_config.mdx b/docs/python-sdk/fastmcp-mcp_config.mdxnew file mode 100644index 000000000..3c6839dad--- /dev/null+++ b/docs/python-sdk/fastmcp-mcp_config.mdx@@ -0,0 +1,150 @@+---+title: mcp_config+sidebarTitle: mcp_config+---++# `fastmcp.mcp_config`+++Canonical MCP Configuration Format.++This module defines the standard configuration format for Model Context Protocol (MCP) servers.+It provides a client-agnostic, extensible format that can be used across all MCP implementations.++The configuration format supports both stdio and remote (HTTP/SSE) transports, with comprehensive+field definitions for server metadata, authentication, and execution parameters.++Example configuration:+ {+ "mcpServers": {+ "my-server": {+ "command": "npx",+ "args": ["-y", "@my/mcp-server"],+ "env": {"API_KEY": "secret"},+ "timeout": 30000,+ "description": "My MCP server"+ }+ }+ }+++## Functions++### `infer_transport_type_from_url` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L43" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+infer_transport_type_from_url(url: str | AnyUrl) -> Literal['http', 'sse']+```+++Infer the appropriate transport type from the given URL.+++### `update_config_file` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L253" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+update_config_file(file_path: Path, server_name: str, server_config: StdioMCPServer | RemoteMCPServer) -> None+```+++Update MCP configuration file with new server, preserving existing fields.+++## Classes++### `StdioMCPServer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L63" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++MCP server configuration for stdio transport.++This is the canonical configuration format for MCP servers using stdio transport.+++**Methods:**++#### `to_transport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L93" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+to_transport(self) -> StdioTransport+```++### `RemoteMCPServer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L104" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++MCP server configuration for HTTP/SSE transport.++This is the canonical configuration format for MCP servers using remote transports.+++**Methods:**++#### `to_transport` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L140" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+to_transport(self) -> StreamableHttpTransport | SSETransport+```++### `MCPConfig` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L165" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++Canonical MCP configuration format.++This defines the standard configuration format for Model Context Protocol servers.+The format is designed to be client-agnostic and extensible for future use cases.+++**Methods:**++#### `from_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L177" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+from_dict(cls, config: dict[str, Any]) -> MCPConfig+```++Parse MCP configuration from dictionary format.+++#### `to_dict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L212" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+to_dict(self) -> dict[str, Any]+```++Convert MCPConfig to dictionary format, preserving all fields.+++#### `write_to_file` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L225" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+write_to_file(self, file_path: Path) -> None+```++Write configuration to JSON file.+++#### `from_file` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L232" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+from_file(cls, file_path: Path) -> MCPConfig+```++Load configuration from JSON file.+++#### `add_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L243" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+add_server(self, name: str, server: StdioMCPServer | RemoteMCPServer) -> None+```++Add or update a server in the configuration.+++#### `remove_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/mcp_config.py#L247" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+remove_server(self, name: str) -> None+```++Remove a server from the configuration.+diff --git a/docs/python-sdk/fastmcp-prompts-prompt.mdx b/docs/python-sdk/fastmcp-prompts-prompt.mdxindex 726962933..13019b9f3 100644--- a/docs/python-sdk/fastmcp-prompts-prompt.mdx+++ b/docs/python-sdk/fastmcp-prompts-prompt.mdx@@ -10,10 +10,10 @@ Base classes for FastMCP prompts.## Functions-### `Message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L32"><Icon icon="github" size="14" /></a></sup>+### `Message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L31" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-Message(content: str | MCPContent, role: Role | None = None, **kwargs: Any) -> PromptMessage+Message(content: str | ContentBlock, role: Role | None = None, **kwargs: Any) -> PromptMessage```@@ -22,13 +22,13 @@ A user-friendly constructor for PromptMessage.## Classes-### `PromptArgument` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L54"><Icon icon="github" size="14" /></a></sup>+### `PromptArgument` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L53" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>An argument that can be passed to a prompt.-### `Prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L66"><Icon icon="github" size="14" /></a></sup>+### `Prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L65" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A prompt template that can be rendered with parameters.@@ -36,7 +36,19 @@ A prompt template that can be rendered with parameters.**Methods:**-#### `to_mcp_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L73"><Icon icon="github" size="14" /></a></sup>+#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L72" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+enable(self) -> None+```++#### `disable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L80" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+disable(self) -> None+```++#### `to_mcp_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L88" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonto_mcp_prompt(self, **overrides: Any) -> MCPPrompt@@ -45,10 +57,10 @@ to_mcp_prompt(self, **overrides: Any) -> MCPPromptConvert the prompt to an MCP prompt.-#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L91"><Icon icon="github" size="14" /></a></sup>+#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L107" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-from_function(fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, description: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionPrompt+from_function(fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, title: str | None = None, description: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionPrompt```Create a Prompt from a function.@@ -60,7 +72,16 @@ The function can return:- A sequence of any of the above-### `FunctionPrompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L119"><Icon icon="github" size="14" /></a></sup>+#### `render` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L133" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+render(self, arguments: dict[str, Any] | None = None) -> list[PromptMessage]+```++Render the prompt with arguments.+++### `FunctionPrompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L141" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A prompt that is a function.@@ -68,10 +89,10 @@ A prompt that is a function.**Methods:**-#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L125"><Icon icon="github" size="14" /></a></sup>+#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L147" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-from_function(cls, fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, description: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionPrompt+from_function(cls, fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, title: str | None = None, description: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionPrompt```Create a Prompt from a function.@@ -82,3 +103,12 @@ The function can return:- A dict (converted to a message)- A sequence of any of the above++#### `render` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt.py#L305" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+render(self, arguments: dict[str, Any] | None = None) -> list[PromptMessage]+```++Render the prompt with arguments.+diff --git a/docs/python-sdk/fastmcp-prompts-prompt_manager.mdx b/docs/python-sdk/fastmcp-prompts-prompt_manager.mdxindex 2ba84f742..a0c1f88cf 100644--- a/docs/python-sdk/fastmcp-prompts-prompt_manager.mdx+++ b/docs/python-sdk/fastmcp-prompts-prompt_manager.mdx@@ -7,7 +7,7 @@ sidebarTitle: prompt_manager## Classes-### `PromptManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L21"><Icon icon="github" size="14" /></a></sup>+### `PromptManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L21" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Manages FastMCP prompts.@@ -15,7 +15,7 @@ Manages FastMCP prompts.**Methods:**-#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L45"><Icon icon="github" size="14" /></a></sup>+#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L45" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonmount(self, server: MountedServer) -> None@@ -24,7 +24,43 @@ mount(self, server: MountedServer) -> NoneAdds a mounted server as a source for prompts.-#### `add_prompt_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L114"><Icon icon="github" size="14" /></a></sup>+#### `has_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L89" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+has_prompt(self, key: str) -> bool+```++Check if a prompt exists.+++#### `get_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L94" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_prompt(self, key: str) -> Prompt+```++Get prompt by key.+++#### `get_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L101" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_prompts(self) -> dict[str, Prompt]+```++Gets the complete, unfiltered inventory of all prompts.+++#### `list_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L107" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_prompts(self) -> list[Prompt]+```++Lists all prompts, applying protocol filtering.+++#### `add_prompt_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L114" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_prompt_from_fn(self, fn: Callable[..., PromptResult | Awaitable[PromptResult]], name: str | None = None, description: str | None = None, tags: set[str] | None = None) -> FunctionPrompt@@ -33,7 +69,7 @@ add_prompt_from_fn(self, fn: Callable[..., PromptResult | Awaitable[PromptResultCreate a prompt from a function.-#### `add_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L134"><Icon icon="github" size="14" /></a></sup>+#### `add_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L134" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_prompt(self, prompt: Prompt) -> Prompt@@ -41,3 +77,13 @@ add_prompt(self, prompt: Prompt) -> PromptAdd a prompt to the manager.++#### `render_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/prompts/prompt_manager.py#L152" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+render_prompt(self, name: str, arguments: dict[str, Any] | None = None) -> GetPromptResult+```++Internal API for servers: Finds and renders a prompt, respecting the+filtered protocol path.+diff --git a/docs/python-sdk/fastmcp-resources-resource.mdx b/docs/python-sdk/fastmcp-resources-resource.mdxindex ac6c40139..46969c09c 100644--- a/docs/python-sdk/fastmcp-resources-resource.mdx+++ b/docs/python-sdk/fastmcp-resources-resource.mdx@@ -10,7 +10,7 @@ Base classes and interfaces for FastMCP resources.## Classes-### `Resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L32"><Icon icon="github" size="14" /></a></sup>+### `Resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L32" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Base class for all resources.@@ -18,13 +18,25 @@ Base class for all resources.**Methods:**-#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L48"><Icon icon="github" size="14" /></a></sup>+#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L47" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-from_function(fn: Callable[[], Any], uri: str | AnyUrl, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResource+enable(self) -> None```-#### `set_default_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L69"><Icon icon="github" size="14" /></a></sup>+#### `disable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L55" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+disable(self) -> None+```++#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L64" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+from_function(fn: Callable[..., Any], uri: str | AnyUrl, name: str | None = None, title: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResource+```++#### `set_default_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L87" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset_default_mime_type(cls, mime_type: str | None) -> str@@ -33,7 +45,7 @@ set_default_mime_type(cls, mime_type: str | None) -> strSet default MIME type if not provided.-#### `set_default_name` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L76"><Icon icon="github" size="14" /></a></sup>+#### `set_default_name` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L94" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset_default_name(self) -> Self@@ -42,7 +54,16 @@ set_default_name(self) -> SelfSet default name from URI if not provided.-#### `to_mcp_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L91"><Icon icon="github" size="14" /></a></sup>+#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L105" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read(self) -> str | bytes+```++Read the resource content.+++#### `to_mcp_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L109" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonto_mcp_resource(self, **overrides: Any) -> MCPResource@@ -51,7 +72,7 @@ to_mcp_resource(self, **overrides: Any) -> MCPResourceConvert the resource to an MCPResource.-#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L105"><Icon icon="github" size="14" /></a></sup>+#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L124" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonkey(self) -> str@@ -63,7 +84,7 @@ keys having a certain value, as the same tool loaded from differenthierarchies of servers may have different keys.-### `FunctionResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L115"><Icon icon="github" size="14" /></a></sup>+### `FunctionResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L134" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A resource that defers data loading by wrapping a function.@@ -80,11 +101,20 @@ The function can return:**Methods:**-#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L131"><Icon icon="github" size="14" /></a></sup>+#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L150" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-from_function(cls, fn: Callable[[], Any], uri: str | AnyUrl, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResource+from_function(cls, fn: Callable[..., Any], uri: str | AnyUrl, name: str | None = None, title: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResource```Create a FunctionResource from a function.++#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource.py#L175" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read(self) -> str | bytes+```++Read the resource by calling the wrapped function.+diff --git a/docs/python-sdk/fastmcp-resources-resource_manager.mdx b/docs/python-sdk/fastmcp-resources-resource_manager.mdxindex f3b4fa65f..52a8c766f 100644--- a/docs/python-sdk/fastmcp-resources-resource_manager.mdx+++ b/docs/python-sdk/fastmcp-resources-resource_manager.mdx@@ -10,7 +10,7 @@ Resource manager functionality.## Classes-### `ResourceManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L28"><Icon icon="github" size="14" /></a></sup>+### `ResourceManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L28" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Manages FastMCP resources.@@ -18,7 +18,7 @@ Manages FastMCP resources.**Methods:**-#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L60"><Icon icon="github" size="14" /></a></sup>+#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L60" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonmount(self, server: MountedServer) -> None@@ -27,7 +27,43 @@ mount(self, server: MountedServer) -> NoneAdds a mounted server as a source for resources and templates.-#### `add_resource_or_template_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L182"><Icon icon="github" size="14" /></a></sup>+#### `get_resources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L64" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_resources(self) -> dict[str, Resource]+```++Get all registered resources, keyed by URI.+++#### `get_resource_templates` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L68" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_resource_templates(self) -> dict[str, ResourceTemplate]+```++Get all registered templates, keyed by URI template.+++#### `list_resources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L168" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_resources(self) -> list[Resource]+```++Lists all resources, applying protocol filtering.+++#### `list_resource_templates` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L175" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_resource_templates(self) -> list[ResourceTemplate]+```++Lists all templates, applying protocol filtering.+++#### `add_resource_or_template_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L182" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_resource_or_template_from_fn(self, fn: Callable[..., Any], uri: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> Resource | ResourceTemplate@@ -48,7 +84,7 @@ Add a resource or template to the manager from a function.- returns the existing resource or template.-#### `add_resource_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L230"><Icon icon="github" size="14" /></a></sup>+#### `add_resource_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L230" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_resource_from_fn(self, fn: Callable[..., Any], uri: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> Resource@@ -69,7 +105,7 @@ Add a resource to the manager from a function.- returns the existing resource.-#### `add_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L270"><Icon icon="github" size="14" /></a></sup>+#### `add_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L270" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_resource(self, resource: Resource) -> Resource@@ -83,7 +119,7 @@ will be used as the storage key. To overwrite it, callResource.with_key() before calling this method.-#### `add_template_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L292"><Icon icon="github" size="14" /></a></sup>+#### `add_template_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L292" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_template_from_fn(self, fn: Callable[..., Any], uri_template: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> ResourceTemplate@@ -92,7 +128,7 @@ add_template_from_fn(self, fn: Callable[..., Any], uri_template: str, name: strCreate a template from a function.-#### `add_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L319"><Icon icon="github" size="14" /></a></sup>+#### `add_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L319" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_template(self, template: ResourceTemplate) -> ResourceTemplate@@ -109,3 +145,37 @@ ResourceTemplate.with_key() before calling this method.- The added template. If a template with the same URI already exists,- returns the existing template.++#### `has_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L345" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+has_resource(self, uri: AnyUrl | str) -> bool+```++Check if a resource exists.+++#### `get_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L362" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_resource(self, uri: AnyUrl | str) -> Resource+```++Get resource by URI, checking concrete resources first, then templates.++**Args:**+- `uri`: The URI of the resource to get++**Raises:**+- `NotFoundError`: If no resource or template matching the URI is found.+++#### `read_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/resource_manager.py#L407" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read_resource(self, uri: AnyUrl | str) -> str | bytes+```++Internal API for servers: Finds and reads a resource, respecting the+filtered protocol path.+diff --git a/docs/python-sdk/fastmcp-resources-template.mdx b/docs/python-sdk/fastmcp-resources-template.mdxindex 99f8218e1..014d0b121 100644--- a/docs/python-sdk/fastmcp-resources-template.mdx+++ b/docs/python-sdk/fastmcp-resources-template.mdx@@ -10,13 +10,13 @@ Resource template functionality.## Functions-### `build_regex` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L28"><Icon icon="github" size="14" /></a></sup>+### `build_regex` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L28" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonbuild_regex(template: str) -> re.Pattern```-### `match_uri_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L44"><Icon icon="github" size="14" /></a></sup>+### `match_uri_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L44" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonmatch_uri_template(uri: str, uri_template: str) -> dict[str, str] | None@@ -24,7 +24,7 @@ match_uri_template(uri: str, uri_template: str) -> dict[str, str] | None## Classes-### `ResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L52"><Icon icon="github" size="14" /></a></sup>+### `ResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L52" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A template for dynamically creating resources.@@ -32,13 +32,25 @@ A template for dynamically creating resources.**Methods:**-#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L69"><Icon icon="github" size="14" /></a></sup>+#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L68" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-from_function(fn: Callable[..., Any], uri_template: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResourceTemplate+enable(self) -> None```-#### `set_default_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L90"><Icon icon="github" size="14" /></a></sup>+#### `disable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L76" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+disable(self) -> None+```++#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L85" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+from_function(fn: Callable[..., Any], uri_template: str, name: str | None = None, title: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResourceTemplate+```++#### `set_default_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L108" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset_default_mime_type(cls, mime_type: str | None) -> str@@ -47,7 +59,7 @@ set_default_mime_type(cls, mime_type: str | None) -> strSet default MIME type if not provided.-#### `matches` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L96"><Icon icon="github" size="14" /></a></sup>+#### `matches` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L114" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonmatches(self, uri: str) -> dict[str, Any] | None@@ -56,7 +68,25 @@ matches(self, uri: str) -> dict[str, Any] | NoneCheck if URI matches template and extract parameters.-#### `to_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L124"><Icon icon="github" size="14" /></a></sup>+#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L118" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read(self, arguments: dict[str, Any]) -> str | bytes+```++Read the resource content.+++#### `create_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L124" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+create_resource(self, uri: str, params: dict[str, Any]) -> Resource+```++Create a resource from the template with the given parameters.+++#### `to_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L142" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonto_mcp_template(self, **overrides: Any) -> MCPResourceTemplate@@ -65,7 +95,7 @@ to_mcp_template(self, **overrides: Any) -> MCPResourceTemplateConvert the resource template to an MCPResourceTemplate.-#### `from_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L135"><Icon icon="github" size="14" /></a></sup>+#### `from_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L154" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_mcp_template(cls, mcp_template: MCPResourceTemplate) -> ResourceTemplate@@ -74,7 +104,7 @@ from_mcp_template(cls, mcp_template: MCPResourceTemplate) -> ResourceTemplateCreates a FastMCP ResourceTemplate from a raw MCP ResourceTemplate object.-#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L148"><Icon icon="github" size="14" /></a></sup>+#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L167" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonkey(self) -> str@@ -86,7 +116,7 @@ keys having a certain value, as the same tool loaded from differenthierarchies of servers may have different keys.-### `FunctionResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L158"><Icon icon="github" size="14" /></a></sup>+### `FunctionResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L177" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A template for dynamically creating resources.@@ -94,10 +124,19 @@ A template for dynamically creating resources.**Methods:**-#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L179"><Icon icon="github" size="14" /></a></sup>+#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L182" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read(self, arguments: dict[str, Any]) -> str | bytes+```++Read the resource content.+++#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/template.py#L198" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-from_function(cls, fn: Callable[..., Any], uri_template: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResourceTemplate+from_function(cls, fn: Callable[..., Any], uri_template: str, name: str | None = None, title: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None, enabled: bool | None = None) -> FunctionResourceTemplate```Create a template from a function.diff --git a/docs/python-sdk/fastmcp-resources-types.mdx b/docs/python-sdk/fastmcp-resources-types.mdxindex 7fa595b8e..cc71f5c6b 100644--- a/docs/python-sdk/fastmcp-resources-types.mdx+++ b/docs/python-sdk/fastmcp-resources-types.mdx@@ -10,19 +10,41 @@ Concrete resource implementations.## Classes-### `TextResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L21"><Icon icon="github" size="14" /></a></sup>+### `TextResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L21" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A resource that reads from a string.-### `BinaryResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L31"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L26" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read(self) -> str+```++Read the text content.+++### `BinaryResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L31" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A resource that reads from bytes.-### `FileResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L41"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L36" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read(self) -> bytes+```++Read the binary content.+++### `FileResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L41" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A resource that reads from a file.@@ -32,7 +54,7 @@ Set is_binary=True to read file as binary data instead of text.**Methods:**-#### `validate_absolute_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L59"><Icon icon="github" size="14" /></a></sup>+#### `validate_absolute_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L59" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonvalidate_absolute_path(cls, path: Path) -> Path@@ -41,7 +63,7 @@ validate_absolute_path(cls, path: Path) -> PathEnsure path is absolute.-#### `set_binary_from_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L67"><Icon icon="github" size="14" /></a></sup>+#### `set_binary_from_mime_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L67" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset_binary_from_mime_type(cls, is_binary: bool, info: ValidationInfo) -> bool@@ -50,13 +72,33 @@ set_binary_from_mime_type(cls, is_binary: bool, info: ValidationInfo) -> boolSet is_binary based on mime_type if not explicitly set.-### `HttpResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L84"><Icon icon="github" size="14" /></a></sup>+#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L74" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read(self) -> str | bytes+```++Read the file content.+++### `HttpResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L84" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A resource that reads from an HTTP endpoint.-### `DirectoryResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L100"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L92" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read(self) -> str | bytes+```++Read the HTTP content.+++### `DirectoryResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L100" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A resource that lists files in a directory.@@ -64,7 +106,7 @@ A resource that lists files in a directory.**Methods:**-#### `validate_absolute_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L116"><Icon icon="github" size="14" /></a></sup>+#### `validate_absolute_path` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L116" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonvalidate_absolute_path(cls, path: Path) -> Path@@ -73,7 +115,7 @@ validate_absolute_path(cls, path: Path) -> PathEnsure path is absolute.-#### `list_files` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L122"><Icon icon="github" size="14" /></a></sup>+#### `list_files` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L122" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonlist_files(self) -> list[Path]@@ -81,3 +123,12 @@ list_files(self) -> list[Path]List files in the directory.++#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/resources/types.py#L144" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read(self) -> str+```++Read the directory listing.+diff --git a/docs/python-sdk/fastmcp-server-auth-auth.mdx b/docs/python-sdk/fastmcp-server-auth-auth.mdxindex 5fd5cce45..d7e2e4960 100644--- a/docs/python-sdk/fastmcp-server-auth-auth.mdx+++ b/docs/python-sdk/fastmcp-server-auth-auth.mdx@@ -7,4 +7,24 @@ sidebarTitle: auth## Classes-### `OAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/auth.py#L14"><Icon icon="github" size="14" /></a></sup>+### `OAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/auth.py#L14" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++**Methods:**++#### `verify_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/auth.py#L47" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+verify_token(self, token: str) -> AccessToken | None+```++Verify a bearer token and return access info if valid.++This method implements the TokenVerifier protocol by delegating+to our existing load_access_token method.++**Args:**+- `token`: The token string to validate++**Returns:**+- AccessToken object if valid, None if invalid or expired+diff --git a/docs/python-sdk/fastmcp-server-auth-providers-bearer.mdx b/docs/python-sdk/fastmcp-server-auth-providers-bearer.mdxindex f6a6285be..f68341f8d 100644--- a/docs/python-sdk/fastmcp-server-auth-providers-bearer.mdx+++ b/docs/python-sdk/fastmcp-server-auth-providers-bearer.mdx@@ -7,23 +7,23 @@ sidebarTitle: bearer## Classes-### `JWKData` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L29"><Icon icon="github" size="14" /></a></sup>+### `JWKData` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L31" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>JSON Web Key data structure.-### `JWKSData` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L42"><Icon icon="github" size="14" /></a></sup>+### `JWKSData` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L44" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>JSON Web Key Set data structure.-### `RSAKeyPair` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L49"><Icon icon="github" size="14" /></a></sup>+### `RSAKeyPair` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L51" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>**Methods:**-#### `generate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L54"><Icon icon="github" size="14" /></a></sup>+#### `generate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L56" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythongenerate(cls) -> 'RSAKeyPair'@@ -35,7 +35,7 @@ Generate an RSA key pair for testing.- (private_key_pem, public_key_pem)-#### `create_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L88"><Icon icon="github" size="14" /></a></sup>+#### `create_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L90" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncreate_token(self, subject: str = 'fastmcp-user', issuer: str = 'https://fastmcp.example.com', audience: str | list[str] | None = None, scopes: list[str] | None = None, expires_in_seconds: int = 3600, additional_claims: dict[str, Any] | None = None, kid: str | None = None) -> str@@ -57,13 +57,96 @@ Generate a test JWT token for testing purposes.- Signed JWT token string-### `BearerAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L149"><Icon icon="github" size="14" /></a></sup>+### `BearerAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L152" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Simple JWT Bearer Token validator for hosted MCP servers.-Uses RS256 asymmetric encryption. Supports either static public key+Uses RS256 asymmetric encryption by default but supports all JWA algorithms. Supports either static public keyor JWKS URI for key rotation.Note that this provider DOES NOT permit client registration or revocation, or any OAuth flows.It is intended to be used with a control plane that manages clients and tokens.++**Methods:**++#### `load_access_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L313" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+load_access_token(self, token: str) -> AccessToken | None+```++Validates the provided JWT bearer token.++**Args:**+- `token`: The JWT token string to validate++**Returns:**+- AccessToken object if valid, None if invalid or expired+++#### `verify_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L419" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+verify_token(self, token: str) -> AccessToken | None+```++Verify a bearer token and return access info if valid.++This method implements the TokenVerifier protocol by delegating+to our existing load_access_token method.++**Args:**+- `token`: The JWT token string to validate++**Returns:**+- AccessToken object if valid, None if invalid or expired+++#### `get_client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L435" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_client(self, client_id: str) -> OAuthClientInformationFull | None+```++#### `register_client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L438" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+register_client(self, client_info: OAuthClientInformationFull) -> None+```++#### `authorize` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L441" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+authorize(self, client: OAuthClientInformationFull, params: AuthorizationParams) -> str+```++#### `load_authorization_code` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L446" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+load_authorization_code(self, client: OAuthClientInformationFull, authorization_code: str) -> AuthorizationCode | None+```++#### `exchange_authorization_code` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L451" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+exchange_authorization_code(self, client: OAuthClientInformationFull, authorization_code: AuthorizationCode) -> OAuthToken+```++#### `load_refresh_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L456" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+load_refresh_token(self, client: OAuthClientInformationFull, refresh_token: str) -> RefreshToken | None+```++#### `exchange_refresh_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L461" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+exchange_refresh_token(self, client: OAuthClientInformationFull, refresh_token: RefreshToken, scopes: list[str]) -> OAuthToken+```++#### `revoke_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer.py#L469" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+revoke_token(self, token: AccessToken | RefreshToken) -> None+```diff --git a/docs/python-sdk/fastmcp-server-auth-providers-bearer_env.mdx b/docs/python-sdk/fastmcp-server-auth-providers-bearer_env.mdxindex e1984efb6..10bc8637b 100644--- a/docs/python-sdk/fastmcp-server-auth-providers-bearer_env.mdx+++ b/docs/python-sdk/fastmcp-server-auth-providers-bearer_env.mdx@@ -7,13 +7,13 @@ sidebarTitle: bearer_env## Classes-### `EnvBearerAuthProviderSettings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer_env.py#L8"><Icon icon="github" size="14" /></a></sup>+### `EnvBearerAuthProviderSettings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer_env.py#L8" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Settings for the BearerAuthProvider.-### `EnvBearerAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer_env.py#L24"><Icon icon="github" size="14" /></a></sup>+### `EnvBearerAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/bearer_env.py#L25" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A BearerAuthProvider that loads settings from environment variables. Anydiff --git a/docs/python-sdk/fastmcp-server-auth-providers-in_memory.mdx b/docs/python-sdk/fastmcp-server-auth-providers-in_memory.mdxindex c11f3b87e..cb97653c8 100644--- a/docs/python-sdk/fastmcp-server-auth-providers-in_memory.mdx+++ b/docs/python-sdk/fastmcp-server-auth-providers-in_memory.mdx@@ -7,9 +7,90 @@ sidebarTitle: in_memory## Classes-### `InMemoryOAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L31"><Icon icon="github" size="14" /></a></sup>+### `InMemoryOAuthProvider` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L31" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>An in-memory OAuth provider for testing purposes.It simulates the OAuth 2.1 flow locally without external calls.++**Methods:**++#### `get_client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L65" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_client(self, client_id: str) -> OAuthClientInformationFull | None+```++#### `register_client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L68" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+register_client(self, client_info: OAuthClientInformationFull) -> None+```++#### `authorize` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L76" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+authorize(self, client: OAuthClientInformationFull, params: AuthorizationParams) -> str+```++Simulates user authorization and generates an authorization code.+Returns a redirect URI with the code and state.+++#### `load_authorization_code` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L129" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+load_authorization_code(self, client: OAuthClientInformationFull, authorization_code: str) -> AuthorizationCode | None+```++#### `exchange_authorization_code` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L142" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+exchange_authorization_code(self, client: OAuthClientInformationFull, authorization_code: AuthorizationCode) -> OAuthToken+```++#### `load_refresh_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L193" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+load_refresh_token(self, client: OAuthClientInformationFull, refresh_token: str) -> RefreshToken | None+```++#### `exchange_refresh_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L208" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+exchange_refresh_token(self, client: OAuthClientInformationFull, refresh_token: RefreshToken, scopes: list[str]) -> OAuthToken+```++#### `load_access_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L263" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+load_access_token(self, token: str) -> AccessToken | None+```++#### `verify_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L274" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+verify_token(self, token: str) -> AccessToken | None+```++Verify a bearer token and return access info if valid.++This method implements the TokenVerifier protocol by delegating+to our existing load_access_token method.++**Args:**+- `token`: The token string to validate++**Returns:**+- AccessToken object if valid, None if invalid or expired+++#### `revoke_token` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/auth/providers/in_memory.py#L331" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+revoke_token(self, token: AccessToken | RefreshToken) -> None+```++Revokes an access or refresh token and its counterpart.+diff --git a/docs/python-sdk/fastmcp-server-context.mdx b/docs/python-sdk/fastmcp-server-context.mdxindex 4cc497740..b41e84aa0 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#L36"><Icon icon="github" size="14" /></a></sup>+### `set_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L50" 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-### `Context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L45"><Icon icon="github" size="14" /></a></sup>+### `Context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L59" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Context object providing access to MCP capabilities.@@ -53,7 +53,7 @@ The context is optional - tools that don't need it can omit the parameter.**Methods:**-#### `request_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L98"><Icon icon="github" size="14" /></a></sup>+#### `request_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L116" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonrequest_context(self) -> RequestContext@@ -64,7 +64,50 @@ Access to the underlying request context.If called outside of a request context, this will raise a ValueError.-#### `client_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L168"><Icon icon="github" size="14" /></a></sup>+#### `report_progress` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L126" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+report_progress(self, progress: float, total: float | None = None, message: str | None = None) -> None+```++Report progress for the current operation.++**Args:**+- `progress`: Current progress value e.g. 24+- `total`: Optional total value e.g. 100+++#### `read_resource` <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>++```python+read_resource(self, uri: str | AnyUrl) -> list[ReadResourceContents]+```++Read a resource by URI.++**Args:**+- `uri`: Resource URI to read++**Returns:**+- The resource content as either text or bytes+++#### `log` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L165" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+log(self, message: str, level: LoggingLevel | None = None, logger_name: str | None = None) -> None+```++Send a log message to the client.++**Args:**+- `message`: Log message+- `level`: Optional log level. One of "debug", "info", "notice", "warning", "error", "critical",+"alert", or "emergency". Default is "info".+- `logger_name`: Optional logger name+++#### `client_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L189" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonclient_id(self) -> str | None@@ -73,7 +116,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#L177"><Icon icon="github" size="14" /></a></sup>+#### `request_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L198" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonrequest_id(self) -> str@@ -82,7 +125,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#L182"><Icon icon="github" size="14" /></a></sup>+#### `session_id` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L203" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsession_id(self) -> str | None@@ -99,16 +142,148 @@ the same client session.- for stdio and in-memory transports which don't use session IDs.-#### `session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L213"><Icon icon="github" size="14" /></a></sup>+#### `session` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L234" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-session(self)+session(self) -> ServerSession```Access to the underlying session for advanced usage.-#### `get_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L282"><Icon icon="github" size="14" /></a></sup>+#### `debug` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L239" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+debug(self, message: str, logger_name: str | None = None) -> None+```++Send a debug log message.+++#### `info` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L243" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+info(self, message: str, logger_name: str | None = None) -> None+```++Send an info log message.+++#### `warning` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L247" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+warning(self, message: str, logger_name: str | None = None) -> None+```++Send a warning log message.+++#### `error` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L251" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+error(self, message: str, logger_name: str | None = None) -> None+```++Send an error log message.+++#### `list_roots` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L255" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+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#L260" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+send_tool_list_changed(self) -> None+```++Send 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#L264" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+send_resource_list_changed(self) -> None+```++Send 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#L268" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+send_prompt_list_changed(self) -> None+```++Send a prompt list changed notification to the client.+++#### `sample` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/context.py#L272" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+sample(self, messages: str | list[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) -> ContentBlock+```++Send a sampling request to the client and await the response.++Call this method at any time to have the server request an LLM+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#L319" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+elicit(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#L331" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+elicit(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#L341" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+elicit(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#L350" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+elicit(self, message: str, response_type: type[T] | list[str] | None = None) -> AcceptedElicitation[T] | AcceptedElicitation[dict[str, Any]] | AcceptedElicitation[str] | DeclinedElicitation | CancelledElicitation+```++Send an elicitation request to the client and await the response.++Call this method at any time to request additional information from+the user through the client. The client must support elicitation,+or the request will error.++Note that the MCP protocol only supports simple object schemas with+primitive types. You can provide a dataclass, TypedDict, or BaseModel to+comply. If you provide a primitive type, an object schema with a single+"value" field will be generated for the MCP interaction and+automatically deconstructed into the primitive type upon response.++If the response_type is None, the generated schema will be that of an+empty object in order to comply with the MCP protocol requirements.+Clients must send an empty object ("{}")in response.++**Args:**+- `message`: A human-readable message explaining what information is needed+- `response_type`: The type of the response, which should be a primitive+type or dataclass or BaseModel. If it is a primitive type, an+object 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#L443" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_http_request(self) -> Requestdiff --git a/docs/python-sdk/fastmcp-server-dependencies.mdx b/docs/python-sdk/fastmcp-server-dependencies.mdxindex dce54051b..7fd03e574 100644--- a/docs/python-sdk/fastmcp-server-dependencies.mdx+++ b/docs/python-sdk/fastmcp-server-dependencies.mdx@@ -7,19 +7,19 @@ sidebarTitle: dependencies## Functions-### `get_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L27"><Icon icon="github" size="14" /></a></sup>+### `get_context` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L27" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_context() -> Context```-### `get_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L39"><Icon icon="github" size="14" /></a></sup>+### `get_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L39" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_http_request() -> Request```-### `get_http_headers` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L48"><Icon icon="github" size="14" /></a></sup>+### `get_http_headers` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/dependencies.py#L48" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_http_headers(include_all: bool = False) -> dict[str, str]diff --git a/docs/python-sdk/fastmcp-server-elicitation.mdx b/docs/python-sdk/fastmcp-server-elicitation.mdxnew file mode 100644index 000000000..f3878efd7--- /dev/null+++ b/docs/python-sdk/fastmcp-server-elicitation.mdx@@ -0,0 +1,54 @@+---+title: elicitation+sidebarTitle: elicitation+---++# `fastmcp.server.elicitation`++## Functions++### `get_elicitation_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/elicitation.py#L42" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_elicitation_schema(response_type: type[T]) -> dict[str, Any]+```+++Get the schema for an elicitation response.++**Args:**+- `response_type`: The type of the response+++### `validate_elicitation_json_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/elicitation.py#L58" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+validate_elicitation_json_schema(schema: dict[str, Any]) -> None+```+++Validate that a JSON schema follows MCP elicitation requirements.++This ensures the schema is compatible with MCP elicitation requirements:+- Must be an object schema+- Must only contain primitive field types (string, number, integer, boolean)+- Must be flat (no nested objects or arrays of objects)+- Allows const fields (for Literal types) and enum fields (for Enum types)+- Only primitive types and their nullable variants are allowed++**Args:**+- `schema`: The JSON schema to validate++**Raises:**+- `TypeError`: If the schema doesn't meet MCP elicitation requirements+++## Classes++### `AcceptedElicitation` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/elicitation.py#L30" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++Result when user accepts the elicitation.+++### `ScalarElicitationType` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/elicitation.py#L38" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>diff --git a/docs/python-sdk/fastmcp-server-http.mdx b/docs/python-sdk/fastmcp-server-http.mdxindex 75afb765f..48902385d 100644--- a/docs/python-sdk/fastmcp-server-http.mdx+++ b/docs/python-sdk/fastmcp-server-http.mdx@@ -7,13 +7,13 @@ sidebarTitle: http## Functions-### `set_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L48"><Icon icon="github" size="14" /></a></sup>+### `set_http_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L48" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset_http_request(request: Request) -> Generator[Request, None, None]```-### `setup_auth_middleware_and_routes` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L72"><Icon icon="github" size="14" /></a></sup>+### `setup_auth_middleware_and_routes` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L72" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsetup_auth_middleware_and_routes(auth: OAuthProvider) -> tuple[list[Middleware], list[BaseRoute], list[str]]@@ -29,7 +29,7 @@ Set up authentication middleware and routes if auth is enabled.- Tuple of (middleware, auth_routes, required_scopes)-### `create_base_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L110"><Icon icon="github" size="14" /></a></sup>+### `create_base_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L110" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncreate_base_app(routes: list[BaseRoute], middleware: list[Middleware], debug: bool = False, lifespan: Callable | None = None) -> StarletteWithLifespan@@ -48,7 +48,7 @@ Create a base Starlette app with common middleware and routes.- A Starlette application-### `create_sse_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L138"><Icon icon="github" size="14" /></a></sup>+### `create_sse_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L138" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncreate_sse_app(server: FastMCP[LifespanResultT], message_path: str, sse_path: str, auth: OAuthProvider | None = None, debug: bool = False, routes: list[BaseRoute] | None = None, middleware: list[Middleware] | None = None) -> StarletteWithLifespan@@ -70,7 +70,7 @@ Returns:A Starlette application with RequestContextMiddleware-### `create_streamable_http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L246"><Icon icon="github" size="14" /></a></sup>+### `create_streamable_http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L242" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncreate_streamable_http_app(server: FastMCP[LifespanResultT], streamable_http_path: str, event_store: EventStore | None = None, auth: OAuthProvider | None = None, json_response: bool = False, stateless_http: bool = False, debug: bool = False, routes: list[BaseRoute] | None = None, middleware: list[Middleware] | None = None) -> StarletteWithLifespan@@ -96,17 +96,17 @@ Return an instance of the StreamableHTTP server app.## Classes-### `StarletteWithLifespan` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L41"><Icon icon="github" size="14" /></a></sup>+### `StarletteWithLifespan` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L41" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>**Methods:**-#### `lifespan` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L43"><Icon icon="github" size="14" /></a></sup>+#### `lifespan` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L43" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonlifespan(self) -> Lifespan```-### `RequestContextMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L56"><Icon icon="github" size="14" /></a></sup>+### `RequestContextMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/http.py#L56" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Middleware that stores each request in a ContextVardiff --git a/docs/python-sdk/fastmcp-server-low_level.mdx b/docs/python-sdk/fastmcp-server-low_level.mdxnew file mode 100644index 000000000..2f7197358--- /dev/null+++ b/docs/python-sdk/fastmcp-server-low_level.mdx@@ -0,0 +1,18 @@+---+title: low_level+sidebarTitle: low_level+---++# `fastmcp.server.low_level`++## Classes++### `LowLevelServer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/low_level.py#L14" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++**Methods:**++#### `create_initialization_options` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/low_level.py#L24" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+create_initialization_options(self, notification_options: NotificationOptions | None = None, experimental_capabilities: dict[str, dict[str, Any]] | None = None, **kwargs: Any) -> InitializationOptions+```diff --git a/docs/python-sdk/fastmcp-server-middleware-error_handling.mdx b/docs/python-sdk/fastmcp-server-middleware-error_handling.mdxindex 735b3c3e5..842c31ce0 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#L15"><Icon icon="github" size="14" /></a></sup>+### `ErrorHandlingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L15" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Middleware that provides consistent error handling and logging.@@ -21,7 +21,16 @@ proper MCP error responses. Also tracks error patterns for monitoring.**Methods:**-#### `get_error_stats` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L121"><Icon icon="github" size="14" /></a></sup>+#### `on_message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L110" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_message(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Handle errors for all messages.+++#### `get_error_stats` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L121" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_error_stats(self) -> dict[str, int]@@ -30,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#L126"><Icon icon="github" size="14" /></a></sup>+### `RetryMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/error_handling.py#L126" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Middleware that implements automatic retry logic for failed requests.@@ -38,3 +47,14 @@ Middleware that implements automatic retry logic for failed requests.Retries requests that fail with transient errors, using exponentialbackoff 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#L182" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_request(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Implement retry logic for requests.+diff --git a/docs/python-sdk/fastmcp-server-middleware-logging.mdx b/docs/python-sdk/fastmcp-server-middleware-logging.mdxindex c45e3096a..9beb8300a 100644--- a/docs/python-sdk/fastmcp-server-middleware-logging.mdx+++ b/docs/python-sdk/fastmcp-server-middleware-logging.mdx@@ -10,7 +10,7 @@ Comprehensive logging middleware for FastMCP servers.## Classes-### `LoggingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/logging.py#L10"><Icon icon="github" size="14" /></a></sup>+### `LoggingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/logging.py#L10" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Middleware that provides comprehensive request and response logging.@@ -19,7 +19,18 @@ Logs all MCP messages with configurable detail levels. Useful for debugging,monitoring, and understanding server usage patterns.-### `StructuredLoggingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/logging.py#L87"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `on_message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/logging.py#L71" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_message(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Log all messages.+++### `StructuredLoggingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/logging.py#L92" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Middleware that provides structured JSON logging for better log analysis.@@ -27,3 +38,14 @@ Middleware that provides structured JSON logging for better log analysis.Outputs structured logs that are easier to parse and analyze with logaggregation tools like ELK stack, Splunk, or cloud logging services.++**Methods:**++#### `on_message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/logging.py#L149" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_message(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Log structured message information.+diff --git a/docs/python-sdk/fastmcp-server-middleware-middleware.mdx b/docs/python-sdk/fastmcp-server-middleware-middleware.mdxindex 179864e5d..f9cf66a64 100644--- a/docs/python-sdk/fastmcp-server-middleware-middleware.mdx+++ b/docs/python-sdk/fastmcp-server-middleware-middleware.mdx@@ -7,7 +7,7 @@ sidebarTitle: middleware## Functions-### `make_middleware_wrapper` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L106"><Icon icon="github" size="14" /></a></sup>+### `make_middleware_wrapper` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L86" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonmake_middleware_wrapper(middleware: Middleware, call_next: CallNext[T, R]) -> CallNext[T, R]@@ -21,36 +21,88 @@ passed to other functions that expect a call_next function.## Classes-### `CallNext` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L36"><Icon icon="github" size="14" /></a></sup>+### `CallNext` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L42" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>-### `CallToolResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L56"><Icon icon="github" size="14" /></a></sup>+### `ServerResultProtocol` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L62" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>-### `ListToolsResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L62"><Icon icon="github" size="14" /></a></sup>+### `MiddlewareContext` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L67" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>-### `ListResourcesResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L67"><Icon icon="github" size="14" /></a></sup>-### `ListResourceTemplatesResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L72"><Icon icon="github" size="14" /></a></sup>+Unified context for all middleware operations.-### `ListPromptsResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L77"><Icon icon="github" size="14" /></a></sup>-### `ServerResultProtocol` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L82"><Icon icon="github" size="14" /></a></sup>+**Methods:**-### `MiddlewareContext` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L87"><Icon icon="github" size="14" /></a></sup>+#### `copy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L82" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+```python+copy(self, **kwargs: Any) -> MiddlewareContext[T]+```-Unified context for all middleware operations.+### `Middleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L99" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++Base class for FastMCP middleware with dispatching hooks.**Methods:**-#### `copy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L102"><Icon icon="github" size="14" /></a></sup>+#### `on_message` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L146" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-copy(self, **kwargs: Any) -> MiddlewareContext[T]+on_message(self, context: MiddlewareContext[Any], call_next: CallNext[Any, Any]) -> Any+```++#### `on_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L153" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_request(self, context: MiddlewareContext[mt.Request], call_next: CallNext[mt.Request, Any]) -> Any```-### `Middleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L119"><Icon icon="github" size="14" /></a></sup>+#### `on_notification` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L160" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+```python+on_notification(self, context: MiddlewareContext[mt.Notification], call_next: CallNext[mt.Notification, Any]) -> Any+```-Base class for FastMCP middleware with dispatching hooks.+#### `on_call_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L167" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+```python+on_call_tool(self, context: MiddlewareContext[mt.CallToolRequestParams], call_next: CallNext[mt.CallToolRequestParams, mt.CallToolResult]) -> mt.CallToolResult+```++#### `on_read_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L174" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_read_resource(self, context: MiddlewareContext[mt.ReadResourceRequestParams], call_next: CallNext[mt.ReadResourceRequestParams, mt.ReadResourceResult]) -> mt.ReadResourceResult+```++#### `on_get_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L181" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_get_prompt(self, context: MiddlewareContext[mt.GetPromptRequestParams], call_next: CallNext[mt.GetPromptRequestParams, mt.GetPromptResult]) -> mt.GetPromptResult+```++#### `on_list_tools` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L188" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_list_tools(self, context: MiddlewareContext[mt.ListToolsRequest], call_next: CallNext[mt.ListToolsRequest, list[Tool]]) -> list[Tool]+```++#### `on_list_resources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L195" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_list_resources(self, context: MiddlewareContext[mt.ListResourcesRequest], call_next: CallNext[mt.ListResourcesRequest, list[Resource]]) -> list[Resource]+```++#### `on_list_resource_templates` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L202" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_list_resource_templates(self, context: MiddlewareContext[mt.ListResourceTemplatesRequest], call_next: CallNext[mt.ListResourceTemplatesRequest, list[ResourceTemplate]]) -> list[ResourceTemplate]+```++#### `on_list_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/middleware.py#L209" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_list_prompts(self, context: MiddlewareContext[mt.ListPromptsRequest], call_next: CallNext[mt.ListPromptsRequest, list[Prompt]]) -> list[Prompt]+```diff --git a/docs/python-sdk/fastmcp-server-middleware-rate_limiting.mdx b/docs/python-sdk/fastmcp-server-middleware-rate_limiting.mdxindex a983ce3f4..1c6da0c11 100644--- a/docs/python-sdk/fastmcp-server-middleware-rate_limiting.mdx+++ b/docs/python-sdk/fastmcp-server-middleware-rate_limiting.mdx@@ -10,25 +10,53 @@ Rate limiting middleware for protecting FastMCP servers from abuse.## Classes-### `RateLimitError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L15"><Icon icon="github" size="14" /></a></sup>+### `RateLimitError` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L15" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Error raised when rate limit is exceeded.-### `TokenBucketRateLimiter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L22"><Icon icon="github" size="14" /></a></sup>+### `TokenBucketRateLimiter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L22" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Token bucket implementation for rate limiting.-### `SlidingWindowRateLimiter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L61"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `consume` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L38" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+consume(self, tokens: int = 1) -> bool+```++Try to consume tokens from the bucket.++**Args:**+- `tokens`: Number of tokens to consume++**Returns:**+- True if tokens were available and consumed, False otherwise+++### `SlidingWindowRateLimiter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L61" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Sliding window rate limiter implementation.-### `RateLimitingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L92"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `is_allowed` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L76" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+is_allowed(self) -> bool+```++Check if a request is allowed.+++### `RateLimitingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L92" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Middleware that implements rate limiting to prevent server abuse.@@ -37,7 +65,18 @@ Uses a token bucket algorithm by default, allowing for burst trafficwhile maintaining a sustainable long-term rate.-### `SlidingWindowRateLimitingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L170"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `on_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L152" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_request(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Apply rate limiting to requests.+++### `SlidingWindowRateLimitingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L170" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Middleware that implements sliding window rate limiting.@@ -45,3 +84,14 @@ Middleware that implements sliding window rate limiting.Uses a sliding window approach which provides more precise rate limitingbut uses more memory to track individual request timestamps.++**Methods:**++#### `on_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/rate_limiting.py#L219" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_request(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Apply sliding window rate limiting to requests.+diff --git a/docs/python-sdk/fastmcp-server-middleware-timing.mdx b/docs/python-sdk/fastmcp-server-middleware-timing.mdxindex c2805a3f7..dafcc1586 100644--- a/docs/python-sdk/fastmcp-server-middleware-timing.mdx+++ b/docs/python-sdk/fastmcp-server-middleware-timing.mdx@@ -10,7 +10,7 @@ Timing middleware for measuring and logging request performance.## Classes-### `TimingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L10"><Icon icon="github" size="14" /></a></sup>+### `TimingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L10" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Middleware that logs the execution time of requests.@@ -19,7 +19,18 @@ Only measures and logs timing for request messages (not notifications).Provides insights into performance characteristics of your MCP server.-### `DetailedTimingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L60"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `on_request` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L39" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_request(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Time request execution and log the results.+++### `DetailedTimingMiddleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L60" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Enhanced timing middleware with per-operation breakdowns.@@ -27,3 +38,68 @@ Enhanced timing middleware with per-operation breakdowns.Provides detailed timing information for different types of MCP operations,allowing you to identify performance bottlenecks in specific operations.++**Methods:**++#### `on_call_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L111" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_call_tool(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Time tool execution.+++#### `on_read_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L118" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_read_resource(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Time resource reading.+++#### `on_get_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L127" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_get_prompt(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Time prompt retrieval.+++#### `on_list_tools` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L134" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_list_tools(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Time tool listing.+++#### `on_list_resources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L140" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_list_resources(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Time resource listing.+++#### `on_list_resource_templates` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L146" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_list_resource_templates(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Time resource template listing.+++#### `on_list_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/middleware/timing.py#L152" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+on_list_prompts(self, context: MiddlewareContext, call_next: CallNext) -> Any+```++Time prompt listing.+diff --git a/docs/python-sdk/fastmcp-server-openapi.mdx b/docs/python-sdk/fastmcp-server-openapi.mdxindex e57a6fd18..bc1a1f730 100644--- a/docs/python-sdk/fastmcp-server-openapi.mdx+++ b/docs/python-sdk/fastmcp-server-openapi.mdx@@ -10,13 +10,13 @@ FastMCP server implementation for OpenAPI integration.## Classes-### `MCPType` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L76"><Icon icon="github" size="14" /></a></sup>+### `MCPType` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L78" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Type of FastMCP component to create from a route.-### `RouteType` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L95"><Icon icon="github" size="14" /></a></sup>+### `RouteType` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L97" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Deprecated: Use MCPType instead.@@ -24,31 +24,64 @@ Deprecated: Use MCPType instead.This enum is kept for backward compatibility and will be removed in a future version.-### `RouteMap` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L109"><Icon icon="github" size="14" /></a></sup>+### `RouteMap` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L111" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Mapping configuration for HTTP routes to FastMCP component types.-### `OpenAPITool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L227"><Icon icon="github" size="14" /></a></sup>+### `OpenAPITool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L229" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Tool implementation for OpenAPI endpoints.-### `OpenAPIResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L478"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L262" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+run(self, arguments: dict[str, Any]) -> ToolResult+```++Execute the HTTP request based on the route configuration.+++### `OpenAPIResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L523" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Resource implementation for OpenAPI endpoints.-### `OpenAPIResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L597"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L552" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read(self) -> str | bytes+```++Fetch the resource data by making an HTTP request.+++### `OpenAPIResourceTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L642" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Resource template implementation for OpenAPI endpoints.-### `FastMCPOpenAPI` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L651"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `create_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L671" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+create_resource(self, uri: str, params: dict[str, Any], context: Context | None = None) -> Resource+```++Create a resource with the given parameters.+++### `FastMCPOpenAPI` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/openapi.py#L696" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>FastMCP server implementation that creates components from an OpenAPI schema.diff --git a/docs/python-sdk/fastmcp-server-proxy.mdx b/docs/python-sdk/fastmcp-server-proxy.mdxindex e480b9167..db83a5611 100644--- a/docs/python-sdk/fastmcp-server-proxy.mdx+++ b/docs/python-sdk/fastmcp-server-proxy.mdx@@ -5,27 +5,144 @@ sidebarTitle: proxy# `fastmcp.server.proxy`+## Functions++### `default_proxy_roots_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L479" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+default_proxy_roots_handler(context: RequestContext[ClientSession, LifespanContextT]) -> RootsList+```+++A handler that forwards the list roots request from the remote server to the proxy's connected clients and relays the response back to the remote server.++## Classes-### `ProxyToolManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L36"><Icon icon="github" size="14" /></a></sup>+### `ProxyToolManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L48" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A ToolManager that sources its tools from a remote client in addition to local and mounted tools.-### `ProxyResourceManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L81"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `get_tools` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L55" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_tools(self) -> dict[str, Tool]+```++Gets the unfiltered tool inventory including local, mounted, and proxy tools.+++#### `list_tools` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L76" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_tools(self) -> list[Tool]+```++Gets the filtered list of tools including local, mounted, and proxy tools.+++#### `call_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L81" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+call_tool(self, key: str, arguments: dict[str, Any]) -> ToolResult+```++Calls a tool, trying local/mounted first, then proxy if not found.+++### `ProxyResourceManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L97" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A ResourceManager that sources its resources from a remote client in addition to local and mounted resources.-### `ProxyPromptManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L159"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `get_resources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L104" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_resources(self) -> dict[str, Resource]+```++Gets the unfiltered resource inventory including local, mounted, and proxy resources.+++#### `get_resource_templates` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L127" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_resource_templates(self) -> dict[str, ResourceTemplate]+```++Gets the unfiltered template inventory including local, mounted, and proxy templates.+++#### `list_resources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L150" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_resources(self) -> list[Resource]+```++Gets the filtered list of resources including local, mounted, and proxy resources.+++#### `list_resource_templates` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L155" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_resource_templates(self) -> list[ResourceTemplate]+```++Gets the filtered list of templates including local, mounted, and proxy templates.+++#### `read_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L160" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read_resource(self, uri: AnyUrl | str) -> str | bytes+```++Reads a resource, trying local/mounted first, then proxy if not found.+++### `ProxyPromptManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L178" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A PromptManager that sources its prompts from a remote client in addition to local and mounted prompts.-### `ProxyTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L209"><Icon icon="github" size="14" /></a></sup>+**Methods:**++#### `get_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L185" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_prompts(self) -> dict[str, Prompt]+```++Gets the unfiltered prompt inventory including local, mounted, and proxy prompts.+++#### `list_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L208" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_prompts(self) -> list[Prompt]+```++Gets the filtered list of prompts including local, mounted, and proxy prompts.+++#### `render_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L213" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+render_prompt(self, name: str, arguments: dict[str, Any] | None = None) -> GetPromptResult+```++Renders a prompt, trying local/mounted first, then proxy if not found.+++### `ProxyTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L230" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A Tool that represents and executes a tool on a remote server.@@ -33,7 +150,7 @@ A Tool that represents and executes a tool on a remote server.**Methods:**-#### `from_mcp_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L219"><Icon icon="github" size="14" /></a></sup>+#### `from_mcp_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L240" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_mcp_tool(cls, client: Client, mcp_tool: mcp.types.Tool) -> ProxyTool@@ -42,7 +159,16 @@ from_mcp_tool(cls, client: Client, mcp_tool: mcp.types.Tool) -> ProxyToolFactory method to create a ProxyTool from a raw MCP tool schema.-### `ProxyResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L246"><Icon icon="github" size="14" /></a></sup>+#### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L252" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+run(self, arguments: dict[str, Any], context: Context | None = None) -> ToolResult+```++Executes the tool by making a call through the client.+++### `ProxyResource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L271" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A Resource that represents and reads a resource from a remote server.@@ -50,7 +176,7 @@ A Resource that represents and reads a resource from a remote server.**Methods:**-#### `from_mcp_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L260"><Icon icon="github" size="14" /></a></sup>+#### `from_mcp_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L291" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_mcp_resource(cls, client: Client, mcp_resource: mcp.types.Resource) -> ProxyResource@@ -59,7 +185,16 @@ from_mcp_resource(cls, client: Client, mcp_resource: mcp.types.Resource) -> ProxFactory method to create a ProxyResource from a raw MCP resource schema.-### `ProxyTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L287"><Icon icon="github" size="14" /></a></sup>+#### `read` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L306" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+read(self) -> str | bytes+```++Read the resource content from the remote server.+++### `ProxyTemplate` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L321" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A ResourceTemplate that represents and creates resources from a remote server template.@@ -67,7 +202,7 @@ A ResourceTemplate that represents and creates resources from a remote server te**Methods:**-#### `from_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L297"><Icon icon="github" size="14" /></a></sup>+#### `from_mcp_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L331" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_mcp_template(cls, client: Client, mcp_template: mcp.types.ResourceTemplate) -> ProxyTemplate@@ -76,7 +211,16 @@ from_mcp_template(cls, client: Client, mcp_template: mcp.types.ResourceTemplate)Factory method to create a ProxyTemplate from a raw MCP template schema.-### `ProxyPrompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L343"><Icon icon="github" size="14" /></a></sup>+#### `create_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L345" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+create_resource(self, uri: str, params: dict[str, Any], context: Context | None = None) -> ProxyResource+```++Create a resource from the template by calling the remote server.+++### `ProxyPrompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L378" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A Prompt that represents and renders a prompt from a remote server.@@ -84,7 +228,7 @@ A Prompt that represents and renders a prompt from a remote server.**Methods:**-#### `from_mcp_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L355"><Icon icon="github" size="14" /></a></sup>+#### `from_mcp_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L390" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_mcp_prompt(cls, client: Client, mcp_prompt: mcp.types.Prompt) -> ProxyPrompt@@ -93,9 +237,63 @@ from_mcp_prompt(cls, client: Client, mcp_prompt: mcp.types.Prompt) -> ProxyPrompFactory method to create a ProxyPrompt from a raw MCP prompt schema.-### `FastMCPProxy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L381"><Icon icon="github" size="14" /></a></sup>+#### `render` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L410" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+render(self, arguments: dict[str, Any]) -> list[PromptMessage]+```++Render the prompt by making a call through the client.+++### `FastMCPProxy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L417" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A FastMCP server that acts as a proxy to a remote MCP-compliant server.-It uses specialized managers that fulfill requests via an HTTP client.+It uses specialized managers that fulfill requests via a client factory.+++### `ProxyClient` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L489" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++A proxy client that forwards advanced interactions between a remote MCP server and the proxy's connected clients.+Supports forwarding roots, sampling, elicitation, logging, and progress.+++**Methods:**++#### `default_sampling_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L520" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+default_sampling_handler(cls, messages: list[mcp.types.SamplingMessage], params: mcp.types.CreateMessageRequestParams, context: RequestContext[ClientSession, LifespanContextT]) -> mcp.types.CreateMessageResult+```++A handler that forwards the sampling request from the remote server to the proxy's connected clients and relays the response back to the remote server.+++#### `default_elicitation_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L546" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+default_elicitation_handler(cls, message: str, response_type: type, params: mcp.types.ElicitRequestParams, context: RequestContext[ClientSession, LifespanContextT]) -> ElicitResult+```++A handler that forwards the elicitation request from the remote server to the proxy's connected clients and relays the response back to the remote server.+++#### `default_log_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L564" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+default_log_handler(cls, message: LogMessage) -> None+```++A handler that forwards the log notification from the remote server to the proxy's connected clients.+++#### `default_progress_handler` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/proxy.py#L572" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+default_progress_handler(cls, progress: float, total: float | None, message: str | None) -> None+```++A handler that forwards the progress notification from the remote server to the proxy's connected clients.diff --git a/docs/python-sdk/fastmcp-server-server.mdx b/docs/python-sdk/fastmcp-server-server.mdxindex 8e6cc2bf5..986e382bd 100644--- a/docs/python-sdk/fastmcp-server-server.mdx+++ b/docs/python-sdk/fastmcp-server-server.mdx@@ -10,7 +10,23 @@ FastMCP - A more ergonomic interface for MCP servers.## Functions-### `add_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1879"><Icon icon="github" size="14" /></a></sup>+### `default_lifespan` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L86" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+default_lifespan(server: FastMCP[LifespanResultT]) -> AsyncIterator[Any]+```+++Default lifespan context manager that does nothing.++**Args:**+- `server`: The server instance this lifespan is managing++**Returns:**+- An empty context object+++### `add_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L2047" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_resource_prefix(uri: str, prefix: str, prefix_format: Literal['protocol', 'path'] | None = None) -> str@@ -48,7 +64,7 @@ add_resource_prefix("resource:///absolute/path", "prefix")- `ValueError`: If the URI doesn't match the expected protocol\://path format-### `remove_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1939"><Icon icon="github" size="14" /></a></sup>+### `remove_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L2107" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonremove_resource_prefix(uri: str, prefix: str, prefix_format: Literal['protocol', 'path'] | None = None) -> str@@ -87,7 +103,7 @@ remove_resource_prefix("resource://prefix//absolute/path", "prefix")- `ValueError`: If the URI doesn't match the expected protocol\://path format-### `has_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L2006"><Icon icon="github" size="14" /></a></sup>+### `has_resource_prefix` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L2174" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonhas_resource_prefix(uri: str, prefix: str, prefix_format: Literal['protocol', 'path'] | None = None) -> bool@@ -127,32 +143,44 @@ False## Classes-### `FastMCP` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L113"><Icon icon="github" size="14" /></a></sup>+### `FastMCP` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L117" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>**Methods:**-#### `settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L264"><Icon icon="github" size="14" /></a></sup>+#### `settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L268" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsettings(self) -> Settings```-#### `name` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L275"><Icon icon="github" size="14" /></a></sup>+#### `name` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L279" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonname(self) -> str```-#### `instructions` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L279"><Icon icon="github" size="14" /></a></sup>+#### `instructions` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L283" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoninstructions(self) -> str | None```-#### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L304"><Icon icon="github" size="14" /></a></sup>+#### `run_async` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L286" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-run(self, transport: Transport | None = None, **transport_kwargs: Any) -> None+run_async(self, transport: Transport | None = None, show_banner: bool = True, **transport_kwargs: Any) -> None+```++Run the FastMCP server asynchronously.++**Args:**+- `transport`: Transport protocol to use ("stdio", "sse", or "streamable-http")+++#### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L316" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+run(self, transport: Transport | None = None, show_banner: bool = True, **transport_kwargs: Any) -> None```Run the FastMCP server. Note this is a synchronous function.@@ -161,13 +189,76 @@ Run the FastMCP server. Note this is a synchronous function.- `transport`: Transport protocol to use ("stdio", "sse", or "streamable-http")-#### `add_middleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L338"><Icon icon="github" size="14" /></a></sup>+#### `add_middleware` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L358" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_middleware(self, middleware: Middleware) -> None```-#### `custom_route` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L384"><Icon icon="github" size="14" /></a></sup>+#### `get_tools` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L361" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_tools(self) -> dict[str, Tool]+```++Get all registered tools, indexed by registered key.+++#### `get_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L365" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_tool(self, key: str) -> Tool+```++#### `get_resources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L371" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_resources(self) -> dict[str, Resource]+```++Get all registered resources, indexed by registered key.+++#### `get_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L375" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_resource(self, key: str) -> Resource+```++#### `get_resource_templates` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L381" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_resource_templates(self) -> dict[str, ResourceTemplate]+```++Get all registered resource templates, indexed by registered key.+++#### `get_resource_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L385" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_resource_template(self, key: str) -> ResourceTemplate+```++Get a registered resource template by key.+++#### `get_prompts` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L392" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_prompts(self) -> dict[str, Prompt]+```++List all available prompts.+++#### `get_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L398" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_prompt(self, key: str) -> Prompt+```++#### `custom_route` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L404" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncustom_route(self, path: str, methods: list[str], name: str | None = None, include_in_schema: bool = True)@@ -188,10 +279,10 @@ Starlette's reverse URL lookup feature)- `include_in_schema`: Whether to include in OpenAPI schema, defaults to True-#### `add_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L742"><Icon icon="github" size="14" /></a></sup>+#### `add_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L762" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-add_tool(self, tool: Tool) -> None+add_tool(self, tool: Tool) -> Tool```Add a tool to the server.@@ -202,8 +293,11 @@ with the Context type annotation. See the @tool decorator for examples.**Args:**- `tool`: The Tool instance to register+**Returns:**+- The tool instance that was added to the server.+-#### `remove_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L754"><Icon icon="github" size="14" /></a></sup>+#### `remove_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L788" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonremove_tool(self, name: str) -> None@@ -218,19 +312,19 @@ Remove a tool from the server.- `NotFoundError`: If the tool is not found-#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L767"><Icon icon="github" size="14" /></a></sup>+#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L810" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythontool(self, name_or_fn: AnyFunction) -> FunctionTool```-#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L780"><Icon icon="github" size="14" /></a></sup>+#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L825" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythontool(self, name_or_fn: str | None = None) -> Callable[[AnyFunction], FunctionTool]```-#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L792"><Icon icon="github" size="14" /></a></sup>+#### `tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L839" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythontool(self, name_or_fn: str | AnyFunction | None = None) -> Callable[[AnyFunction], FunctionTool] | FunctionTool@@ -254,6 +348,7 @@ This decorator supports multiple calling patterns:- `name`: Optional name for the tool (keyword-only, alternative to name_or_fn)- `description`: Optional description of what the tool does- `tags`: Optional set of tags for categorizing the tool+- `output_schema`: Optional JSON schema for the tool's output- `annotations`: Optional annotations about the tool's behavior- `exclude_args`: Optional list of argument names to exclude from the tool schema- `enabled`: Optional boolean to enable or disable the tool@@ -284,10 +379,10 @@ server.tool(my_function, name="custom_name")```-#### `add_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L912"><Icon icon="github" size="14" /></a></sup>+#### `add_resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L966" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-add_resource(self, resource: Resource) -> None+add_resource(self, resource: Resource) -> Resource```Add a resource to the server.@@ -295,11 +390,14 @@ Add a resource to the server.**Args:**- `resource`: A Resource instance to add+**Returns:**+- The resource instance that was added to the server.-#### `add_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L922"><Icon icon="github" size="14" /></a></sup>++#### `add_template` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L989" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-add_template(self, template: ResourceTemplate) -> None+add_template(self, template: ResourceTemplate) -> ResourceTemplate```Add a resource template to the server.@@ -307,8 +405,11 @@ Add a resource template to the server.**Args:**- `template`: A ResourceTemplate instance to add+**Returns:**+- The template instance that was added to the server.+-#### `add_resource_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L930"><Icon icon="github" size="14" /></a></sup>+#### `add_resource_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1011" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_resource_fn(self, fn: AnyFunction, uri: str, name: str | None = None, description: str | None = None, mime_type: str | None = None, tags: set[str] | None = None) -> None@@ -328,7 +429,7 @@ has parameters, it will be registered as a template resource.- `tags`: Optional set of tags for categorizing the resource-#### `resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L969"><Icon icon="github" size="14" /></a></sup>+#### `resource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1050" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonresource(self, uri: str) -> Callable[[AnyFunction], Resource | ResourceTemplate]@@ -386,10 +487,10 @@ async def get_weather(city: str) -> str:```-#### `add_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1092"><Icon icon="github" size="14" /></a></sup>+#### `add_prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1176" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-add_prompt(self, prompt: Prompt) -> None+add_prompt(self, prompt: Prompt) -> Prompt```Add a prompt to the server.@@ -397,20 +498,23 @@ Add a prompt to the server.**Args:**- `prompt`: A Prompt instance to add+**Returns:**+- The prompt instance that was added to the server.+-#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1102"><Icon icon="github" size="14" /></a></sup>+#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1200" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonprompt(self, name_or_fn: AnyFunction) -> FunctionPrompt```-#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1113"><Icon icon="github" size="14" /></a></sup>+#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1212" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonprompt(self, name_or_fn: str | None = None) -> Callable[[AnyFunction], FunctionPrompt]```-#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1123"><Icon icon="github" size="14" /></a></sup>+#### `prompt` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1223" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonprompt(self, name_or_fn: str | AnyFunction | None = None) -> Callable[[AnyFunction], FunctionPrompt] | FunctionPrompt@@ -487,7 +591,44 @@ Decorator to register a prompt.```-#### `sse_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1344"><Icon icon="github" size="14" /></a></sup>+#### `run_stdio_async` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1360" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+run_stdio_async(self, show_banner: bool = True) -> None+```++Run the server using stdio transport.+++#### `run_http_async` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1380" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+run_http_async(self, show_banner: bool = True, transport: Literal['http', 'streamable-http', 'sse'] = 'http', host: str | None = None, port: int | None = None, log_level: str | None = None, path: str | None = None, uvicorn_config: dict[str, Any] | None = None, middleware: list[ASGIMiddleware] | None = None, stateless_http: bool | None = None) -> None+```++Run the server using HTTP transport.++**Args:**+- `transport`: Transport protocol to use - either "streamable-http" (default) 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 server+- `middleware`: A list of middleware to apply to the app+- `stateless_http`: Whether to use stateless HTTP (defaults to settings.stateless_http)+++#### `run_sse_async` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1454" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+run_sse_async(self, host: str | None = None, port: int | None = None, log_level: str | None = None, path: str | None = None, uvicorn_config: dict[str, Any] | None = None) -> None+```++Run the server using SSE transport.+++#### `sse_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1482" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsse_app(self, path: str | None = None, message_path: str | None = None, middleware: list[ASGIMiddleware] | None = None) -> StarletteWithLifespan@@ -501,7 +642,7 @@ Create a Starlette app for the SSE server.- `middleware`: A list of middleware to apply to the app-#### `streamable_http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1375"><Icon icon="github" size="14" /></a></sup>+#### `streamable_http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1513" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonstreamable_http_app(self, path: str | None = None, middleware: list[ASGIMiddleware] | None = None) -> StarletteWithLifespan@@ -514,7 +655,7 @@ Create a Starlette app for the StreamableHTTP server.- `middleware`: A list of middleware to apply to the app-#### `http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1396"><Icon icon="github" size="14" /></a></sup>+#### `http_app` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1534" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonhttp_app(self, path: str | None = None, middleware: list[ASGIMiddleware] | None = None, json_response: bool | None = None, stateless_http: bool | None = None, transport: Literal['http', 'streamable-http', 'sse'] = 'http') -> StarletteWithLifespan@@ -531,7 +672,13 @@ Create a Starlette app using the specified HTTP transport.- A Starlette application configured with the specified transport-#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1470"><Icon icon="github" size="14" /></a></sup>+#### `run_streamable_http_async` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1583" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+run_streamable_http_async(self, host: str | None = None, port: int | None = None, log_level: str | None = None, path: str | None = None, uvicorn_config: dict[str, Any] | None = None) -> None+```++#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1608" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonmount(self, server: FastMCP[LifespanResultT], prefix: str | None = None, as_proxy: bool | None = None) -> None@@ -585,7 +732,48 @@ automatically determined based on whether the server has a custom lifespan- `prompt_separator`: Deprecated. Separator character for prompt names.-#### `from_openapi` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1720"><Icon icon="github" size="14" /></a></sup>+#### `import_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1732" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+import_server(self, server: FastMCP[LifespanResultT], prefix: str | None = None, tool_separator: str | None = None, resource_separator: str | None = None, prompt_separator: str | None = None) -> None+```++Import the MCP objects from another FastMCP server into this one,+optionally with a given prefix.++Note that when a server is *imported*, its objects are immediately+registered to the importing server. This is a one-time operation and+future changes to the imported server will not be reflected in the+importing server. Server-level configurations and lifespans are not imported.++When a server is imported with a prefix:+- The tools are imported with prefixed names+ Example: If server has a tool named "get_weather", it will be+ available as "prefix_get_weather"+- The resources are imported with prefixed URIs using the new format+ Example: If server has a resource with URI "weather://forecast", it will+ be available as "weather://prefix/forecast"+- The templates are imported with prefixed URI templates using the new format+ Example: If server has a template with URI "weather://location/{id}", it will+ be available as "weather://prefix/location/{id}"+- The prompts are imported with prefixed names+ Example: If server has a prompt named "weather_prompt", it will be available as+ "prefix_weather_prompt"++When a server is imported without a prefix (prefix=None), its tools, resources,+templates, and prompts are imported with their original names.++**Args:**+- `server`: The FastMCP server to import+- `prefix`: Optional prefix to use for the imported server's objects. If None,+objects are imported with their original names.+- `tool_separator`: Deprecated. Separator for tool names.+- `resource_separator`: Deprecated and ignored. Prefix is now+applied using the protocol\://prefix/path format+- `prompt_separator`: Deprecated. Separator for prompt names.+++#### `from_openapi` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1857" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_openapi(cls, openapi_spec: dict[str, Any], client: httpx.AsyncClient, route_maps: list[RouteMap] | None = None, route_map_fn: OpenAPIRouteMapFn | None = None, mcp_component_fn: OpenAPIComponentFn | None = None, mcp_names: dict[str, str] | None = None, tags: set[str] | None = None, **settings: Any) -> FastMCPOpenAPI@@ -594,7 +782,7 @@ from_openapi(cls, openapi_spec: dict[str, Any], client: httpx.AsyncClient, routeCreate a FastMCP server from an OpenAPI specification.-#### `from_fastapi` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1748"><Icon icon="github" size="14" /></a></sup>+#### `from_fastapi` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1885" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_fastapi(cls, app: Any, name: str | None = None, route_maps: list[RouteMap] | None = None, route_map_fn: OpenAPIRouteMapFn | None = None, mcp_component_fn: OpenAPIComponentFn | None = None, mcp_names: dict[str, str] | None = None, httpx_client_kwargs: dict[str, Any] | None = None, tags: set[str] | None = None, **settings: Any) -> FastMCPOpenAPI@@ -603,7 +791,7 @@ from_fastapi(cls, app: Any, name: str | None = None, route_maps: list[RouteMap]Create a FastMCP server from a FastAPI application.-#### `as_proxy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1790"><Icon icon="github" size="14" /></a></sup>+#### `as_proxy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1927" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonas_proxy(cls, backend: Client[ClientTransportT] | ClientTransport | FastMCP[Any] | AnyUrl | Path | MCPConfig | dict[str, Any] | str, **settings: Any) -> FastMCPProxy@@ -617,7 +805,7 @@ instance or any value accepted as the `transport` argument of`fastmcp.client.Client` constructor.-#### `from_client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1820"><Icon icon="github" size="14" /></a></sup>+#### `from_client` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1988" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_client(cls, client: Client[ClientTransportT], **settings: Any) -> FastMCPProxy@@ -626,4 +814,4 @@ from_client(cls, client: Client[ClientTransportT], **settings: Any) -> FastMCPPrCreate a FastMCP proxy server from a FastMCP client.-### `MountedServer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L1873"><Icon icon="github" size="14" /></a></sup>+### `MountedServer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/server/server.py#L2041" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>diff --git a/docs/python-sdk/fastmcp-settings.mdx b/docs/python-sdk/fastmcp-settings.mdxindex 6725277cb..7f546c31b 100644--- a/docs/python-sdk/fastmcp-settings.mdx+++ b/docs/python-sdk/fastmcp-settings.mdx@@ -7,7 +7,7 @@ sidebarTitle: settings## Classes-### `ExtendedEnvSettingsSource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L26"><Icon icon="github" size="14" /></a></sup>+### `ExtendedEnvSettingsSource` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L27" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A special EnvSettingsSource that allows for multiple env var prefixes to be used.@@ -17,15 +17,15 @@ Raises a deprecation warning if the old `FASTMCP_SERVER_` prefix is used.**Methods:**-#### `get_field_value` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L33"><Icon icon="github" size="14" /></a></sup>+#### `get_field_value` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L34" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_field_value(self, field: FieldInfo, field_name: str) -> tuple[Any, str, bool]```-### `ExtendedSettingsConfigDict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L53"><Icon icon="github" size="14" /></a></sup>+### `ExtendedSettingsConfigDict` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L54" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>-### `Settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L57"><Icon icon="github" size="14" /></a></sup>+### `Settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L58" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>FastMCP settings.@@ -33,13 +33,13 @@ FastMCP settings.**Methods:**-#### `settings_customise_sources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L69"><Icon icon="github" size="14" /></a></sup>+#### `settings_customise_sources` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L70" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsettings_customise_sources(cls, settings_cls: type[BaseSettings], init_settings: PydanticBaseSettingsSource, env_settings: PydanticBaseSettingsSource, dotenv_settings: PydanticBaseSettingsSource, file_secret_settings: PydanticBaseSettingsSource) -> tuple[PydanticBaseSettingsSource, ...]```-#### `settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L87"><Icon icon="github" size="14" /></a></sup>+#### `settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L88" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsettings(self) -> Self@@ -49,7 +49,13 @@ This property is for backwards compatibility with FastMCP < 2.8.0,which accessed fastmcp.settings.settings-#### `setup_logging` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L182"><Icon icon="github" size="14" /></a></sup>+#### `normalize_log_level` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L107" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+normalize_log_level(cls, v)+```++#### `setup_logging` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/settings.py#L175" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonsetup_logging(self) -> Selfdiff --git a/docs/python-sdk/fastmcp-tools-tool.mdx b/docs/python-sdk/fastmcp-tools-tool.mdxindex 07aef85a9..60c8fff9a 100644--- a/docs/python-sdk/fastmcp-tools-tool.mdx+++ b/docs/python-sdk/fastmcp-tools-tool.mdx@@ -7,7 +7,7 @@ sidebarTitle: tool## Functions-### `default_serializer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L34"><Icon icon="github" size="14" /></a></sup>+### `default_serializer` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L48" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythondefault_serializer(data: Any) -> str@@ -15,7 +15,17 @@ default_serializer(data: Any) -> str## Classes-### `Tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L38"><Icon icon="github" size="14" /></a></sup>+### `ToolResult` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L52" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++**Methods:**++#### `to_mcp_result` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L83" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+to_mcp_result(self) -> list[ContentBlock] | tuple[list[ContentBlock], dict[str, Any]]+```++### `Tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L91" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Internal tool registration info.@@ -23,46 +33,82 @@ Internal tool registration info.**Methods:**-#### `to_mcp_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L49"><Icon icon="github" size="14" /></a></sup>+#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L109" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+enable(self) -> None+```++#### `disable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L117" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+disable(self) -> None+```++#### `to_mcp_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L125" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonto_mcp_tool(self, **overrides: Any) -> MCPTool```-#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L59"><Icon icon="github" size="14" /></a></sup>+#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L144" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-from_function(fn: Callable[..., Any], name: str | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, exclude_args: list[str] | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> FunctionTool+from_function(fn: Callable[..., Any], name: str | None = None, title: str | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, exclude_args: list[str] | None = None, output_schema: dict[str, Any] | None | NotSetT | Literal[False] = NotSet, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> FunctionTool```Create a Tool from a function.-#### `from_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L86"><Icon icon="github" size="14" /></a></sup>+#### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L170" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-from_tool(cls, tool: Tool, transform_fn: Callable[..., Any] | None = None, name: str | None = None, transform_args: dict[str, ArgTransform] | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> TransformedTool+run(self, arguments: dict[str, Any]) -> ToolResult```-### `FunctionTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L113"><Icon icon="github" size="14" /></a></sup>+Run the tool with arguments.++This method is not implemented in the base Tool class and must be+implemented by subclasses.++`run()` can EITHER return a list of ContentBlocks, or a tuple of+(list of ContentBlocks, dict of structured output).+++#### `from_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L183" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+from_tool(cls, tool: Tool, transform_fn: Callable[..., Any] | None = None, name: str | None = None, title: str | None | NotSetT = NotSet, transform_args: dict[str, ArgTransform] | None = None, description: str | None | NotSetT = NotSet, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, output_schema: dict[str, Any] | None | Literal[False] = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> TransformedTool+```++### `FunctionTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L214" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>**Methods:**-#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L117"><Icon icon="github" size="14" /></a></sup>+#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L218" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-from_function(cls, fn: Callable[..., Any], name: str | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, exclude_args: list[str] | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> FunctionTool+from_function(cls, fn: Callable[..., Any], name: str | None = None, title: str | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, exclude_args: list[str] | None = None, output_schema: dict[str, Any] | None | NotSetT | Literal[False] = NotSet, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> FunctionTool```Create a Tool from a function.-### `ParsedFunction` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L194"><Icon icon="github" size="14" /></a></sup>+#### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L264" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+run(self, arguments: dict[str, Any]) -> ToolResult+```++Run the tool with arguments.+++### `ParsedFunction` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L310" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>**Methods:**-#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L201"><Icon icon="github" size="14" /></a></sup>+#### `from_function` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool.py#L318" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-from_function(cls, fn: Callable[..., Any], exclude_args: list[str] | None = None, validate: bool = True) -> ParsedFunction+from_function(cls, fn: Callable[..., Any], exclude_args: list[str] | None = None, validate: bool = True, wrap_non_object_output_schema: bool = True) -> ParsedFunction```diff --git a/docs/python-sdk/fastmcp-tools-tool_manager.mdx b/docs/python-sdk/fastmcp-tools-tool_manager.mdxindex 75328aca1..f9b6b61f7 100644--- a/docs/python-sdk/fastmcp-tools-tool_manager.mdx+++ b/docs/python-sdk/fastmcp-tools-tool_manager.mdx@@ -7,7 +7,7 @@ sidebarTitle: tool_manager## Classes-### `ToolManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L22"><Icon icon="github" size="14" /></a></sup>+### `ToolManager` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L21" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Manages FastMCP tools.@@ -15,7 +15,7 @@ Manages FastMCP tools.**Methods:**-#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L46"><Icon icon="github" size="14" /></a></sup>+#### `mount` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L45" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonmount(self, server: MountedServer) -> None@@ -24,7 +24,43 @@ mount(self, server: MountedServer) -> NoneAdds a mounted server as a source for tools.-#### `add_tool_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L113"><Icon icon="github" size="14" /></a></sup>+#### `has_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L87" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+has_tool(self, key: str) -> bool+```++Check if a tool exists.+++#### `get_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L92" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_tool(self, key: str) -> Tool+```++Get tool by key.+++#### `get_tools` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L99" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+get_tools(self) -> dict[str, Tool]+```++Gets the complete, unfiltered inventory of all tools.+++#### `list_tools` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L105" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+list_tools(self) -> list[Tool]+```++Lists all tools, applying protocol filtering.+++#### `add_tool_from_fn` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L112" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_tool_from_fn(self, fn: Callable[..., Any], name: str | None = None, description: str | None = None, tags: set[str] | None = None, annotations: ToolAnnotations | None = None, serializer: Callable[[Any], str] | None = None, exclude_args: list[str] | None = None) -> Tool@@ -33,7 +69,7 @@ add_tool_from_fn(self, fn: Callable[..., Any], name: str | None = None, descriptAdd a tool to the server.-#### `add_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L142"><Icon icon="github" size="14" /></a></sup>+#### `add_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L141" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonadd_tool(self, tool: Tool) -> Tool@@ -42,7 +78,7 @@ add_tool(self, tool: Tool) -> ToolRegister a tool with the server.-#### `remove_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L159"><Icon icon="github" size="14" /></a></sup>+#### `remove_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L158" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonremove_tool(self, key: str) -> None@@ -56,3 +92,13 @@ Remove a tool from the server.**Raises:**- `NotFoundError`: If the tool is not found++#### `call_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_manager.py#L172" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+call_tool(self, key: str, arguments: dict[str, Any]) -> ToolResult+```++Internal API for servers: Finds and calls a tool, respecting the+filtered protocol path.+diff --git a/docs/python-sdk/fastmcp-tools-tool_transform.mdx b/docs/python-sdk/fastmcp-tools-tool_transform.mdxindex 6a7ea8ceb..f39ece8f4 100644--- a/docs/python-sdk/fastmcp-tools-tool_transform.mdx+++ b/docs/python-sdk/fastmcp-tools-tool_transform.mdx@@ -5,9 +5,66 @@ sidebarTitle: tool_transform# `fastmcp.tools.tool_transform`+## Functions++### `forward` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L25" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+forward(**kwargs) -> ToolResult+```+++Forward to parent tool with argument transformation applied.++This function can only be called from within a transformed tool's custom+function. It applies argument transformation (renaming, validation) before+calling the parent tool.++For example, if the parent tool has args `x` and `y`, but the transformed+tool has args `a` and `b`, and an `transform_args` was provided that maps `x` to+`a` and `y` to `b`, then `forward(a=1, b=2)` will call the parent tool with+`x=1` and `y=2`.++**Args:**+- `**kwargs`: Arguments to forward to the parent tool (using transformed names).++**Returns:**+- The ToolResult from the parent tool execution.++**Raises:**+- `RuntimeError`: If called outside a transformed tool context.+- `TypeError`: If provided arguments don't match the transformed schema.+++### `forward_raw` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L55" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+forward_raw(**kwargs) -> ToolResult+```+++Forward directly to parent tool without transformation.++This function bypasses all argument transformation and validation, calling the parent+tool directly with the provided arguments. Use this when you need to call the parent+with its original parameter names and structure.++For example, if the parent tool has args `x` and `y`, then `forward_raw(x=1,+y=2)` will call the parent tool with `x=1` and `y=2`.++**Args:**+- `**kwargs`: Arguments to pass directly to the parent tool (using original names).++**Returns:**+- The ToolResult from the parent tool execution.++**Raises:**+- `RuntimeError`: If called outside a transformed tool context.++## Classes-### `ArgTransform` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L85"><Icon icon="github" size="14" /></a></sup>+### `ArgTransform` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L82" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Configuration for transforming a parent tool's argument.@@ -69,26 +126,46 @@ ArgTransform(name="new_name", description="New desc", default=None, type=int)```-### `TransformedTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L199"><Icon icon="github" size="14" /></a></sup>+### `TransformedTool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L196" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>A tool that is transformed from another tool.This class represents a tool that has been created by transforming another tool.It supports argument renaming, schema modification, custom function injection,-and provides context for the forward() and forward_raw() functions.+structured output control, and provides context for the forward() and forward_raw() functions.The transformation can be purely schema-based (argument renaming, dropping, etc.)or can include a custom function that uses forward() to call the parent tool-with transformed arguments.+with transformed arguments. Output schemas and structured outputs are automatically+inherited from the parent tool but can be overridden or disabled.**Methods:**-#### `from_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L280"><Icon icon="github" size="14" /></a></sup>+#### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L223" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-from_tool(cls, tool: Tool, name: str | None = None, description: str | None = None, tags: set[str] | None = None, transform_fn: Callable[..., Any] | None = None, transform_args: dict[str, ArgTransform] | None = None, annotations: ToolAnnotations | None = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> TransformedTool+run(self, arguments: dict[str, Any]) -> ToolResult+```++Run the tool with context set for forward() functions.++This method executes the tool's function while setting up the context+that allows forward() and forward_raw() to work correctly within custom+functions.++**Args:**+- `arguments`: Dictionary of arguments to pass to the tool's function.++**Returns:**+- ToolResult object containing content and optional structured output.+++#### `from_tool` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/tools/tool_transform.py#L324" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+from_tool(cls, tool: Tool, name: str | None = None, title: str | None | NotSetT = NotSet, description: str | None | NotSetT = NotSet, tags: set[str] | None = None, transform_fn: Callable[..., Any] | None = None, transform_args: dict[str, ArgTransform] | None = None, annotations: ToolAnnotations | None = None, output_schema: dict[str, Any] | None | Literal[False] = None, serializer: Callable[[Any], str] | None = None, enabled: bool | None = None) -> TransformedTool```Create a transformed tool from a parent tool.@@ -99,6 +176,7 @@ Create a transformed tool from a parent tool.to call the parent tool. Functions with **kwargs receive transformedargument names.- `name`: New name for the tool. Defaults to parent tool's name.+- `title`: New title for the tool. Defaults to parent tool's title.- `transform_args`: Optional transformations for parent tool arguments.Only specified arguments are transformed, others pass through unchanged\:- Simple rename (str)@@ -107,6 +185,10 @@ Only specified arguments are transformed, others pass through unchanged\:- `description`: New description. Defaults to parent's description.- `tags`: New tags. Defaults to parent's tags.- `annotations`: New annotations. Defaults to parent's annotations.+- `output_schema`: Control output schema for structured outputs\:+- None (default)\: Inherit from transform_fn if available, then parent tool+- dict\: Use custom output schema+- False\: Disable output schema and structured outputs- `serializer`: New serializer. Defaults to parent's serializer.**Returns:**@@ -137,3 +219,23 @@ async def flexible(**kwargs) -> str:Tool.from_tool(parent, transform_fn=flexible, transform_args={"a": "x"})```+# Control structured outputs and schemas+```python+# Custom output schema+Tool.from_tool(parent, output_schema={+ "type": "object",+ "properties": {"status": {"type": "string"}}+})++# Disable structured outputs+Tool.from_tool(parent, output_schema=False)++# Return ToolResult for full control+async def custom_output(**kwargs) -> ToolResult:+ result = await forward(**kwargs)+ return ToolResult(+ content=[TextContent(text="Summary")],+ structured_content={"processed": True}+ )+```+diff --git a/docs/python-sdk/fastmcp-utilities-cache.mdx b/docs/python-sdk/fastmcp-utilities-cache.mdxindex 49b0794a2..d06374aeb 100644--- a/docs/python-sdk/fastmcp-utilities-cache.mdx+++ b/docs/python-sdk/fastmcp-utilities-cache.mdx@@ -7,23 +7,23 @@ sidebarTitle: cache## Classes-### `TimedCache` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L7"><Icon icon="github" size="14" /></a></sup>+### `TimedCache` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L7" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>**Methods:**-#### `set` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L14"><Icon icon="github" size="14" /></a></sup>+#### `set` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L14" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonset(self, key: Any, value: Any) -> None```-#### `get` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L18"><Icon icon="github" size="14" /></a></sup>+#### `get` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L18" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget(self, key: Any) -> Any```-#### `clear` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L25"><Icon icon="github" size="14" /></a></sup>+#### `clear` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cache.py#L25" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonclear(self) -> Nonediff --git a/docs/python-sdk/fastmcp-utilities-cli.mdx b/docs/python-sdk/fastmcp-utilities-cli.mdxnew file mode 100644index 000000000..c6c159042--- /dev/null+++ b/docs/python-sdk/fastmcp-utilities-cli.mdx@@ -0,0 +1,25 @@+---+title: cli+sidebarTitle: cli+---++# `fastmcp.utilities.cli`++## Functions++### `log_server_banner` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/cli.py#L26" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+log_server_banner(server: FastMCP[Any], transport: Literal['stdio', 'http', 'sse', 'streamable-http']) -> None+```+++Creates and logs a formatted banner with server information and logo.++**Args:**+- `transport`: The transport protocol being used+- `server_name`: Optional server name to display+- `host`: Host address (for HTTP transports)+- `port`: Port number (for HTTP transports)+- `path`: Server path (for HTTP transports)+diff --git a/docs/python-sdk/fastmcp-utilities-components.mdx b/docs/python-sdk/fastmcp-utilities-components.mdxindex 8a27b2ac7..7c0c1a29a 100644--- a/docs/python-sdk/fastmcp-utilities-components.mdx+++ b/docs/python-sdk/fastmcp-utilities-components.mdx@@ -7,7 +7,7 @@ sidebarTitle: components## Classes-### `FastMCPComponent` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L21"><Icon icon="github" size="14" /></a></sup>+### `FastMCPComponent` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L21" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Base class for FastMCP tools, prompts, resources, and resource templates.@@ -15,7 +15,7 @@ Base class for FastMCP tools, prompts, resources, and resource templates.**Methods:**-#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L48"><Icon icon="github" size="14" /></a></sup>+#### `key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L52" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonkey(self) -> str@@ -27,13 +27,13 @@ keys having a certain value, as the same tool loaded from differenthierarchies of servers may have different keys.-#### `with_key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L57"><Icon icon="github" size="14" /></a></sup>+#### `with_key` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L61" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonwith_key(self, key: str) -> Self```-#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L69"><Icon icon="github" size="14" /></a></sup>+#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L73" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonenable(self) -> None@@ -42,7 +42,7 @@ enable(self) -> NoneEnable the component.-#### `disable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L73"><Icon icon="github" size="14" /></a></sup>+#### `disable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L77" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythondisable(self) -> None@@ -50,3 +50,50 @@ disable(self) -> NoneDisable the component.++#### `copy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L81" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+copy(self) -> Self+```++Create a copy of the component.+++### `MirroredComponent` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L86" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++Base class for components that are mirrored from a remote server.++Mirrored components cannot be enabled or disabled directly. Call copy() first+to create a local version you can modify.+++**Methods:**++#### `enable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L99" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+enable(self) -> None+```++Enable the component.+++#### `disable` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L108" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+disable(self) -> None+```++Disable the component.+++#### `copy` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/components.py#L117" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+copy(self) -> Self+```++Create a copy of the component that can be modified.+diff --git a/docs/python-sdk/fastmcp-utilities-exceptions.mdx b/docs/python-sdk/fastmcp-utilities-exceptions.mdxindex 6b33526dc..be51a4213 100644--- a/docs/python-sdk/fastmcp-utilities-exceptions.mdx+++ b/docs/python-sdk/fastmcp-utilities-exceptions.mdx@@ -7,13 +7,13 @@ sidebarTitle: exceptions## Functions-### `iter_exc` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/exceptions.py#L12"><Icon icon="github" size="14" /></a></sup>+### `iter_exc` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/exceptions.py#L12" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoniter_exc(group: BaseExceptionGroup)```-### `get_catch_handlers` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/exceptions.py#L42"><Icon icon="github" size="14" /></a></sup>+### `get_catch_handlers` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/exceptions.py#L42" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_catch_handlers() -> Mapping[type[BaseException] | Iterable[type[BaseException]], Callable[[BaseExceptionGroup[Any]], Any]]diff --git a/docs/python-sdk/fastmcp-utilities-http.mdx b/docs/python-sdk/fastmcp-utilities-http.mdxindex 661f4e575..609c407e8 100644--- a/docs/python-sdk/fastmcp-utilities-http.mdx+++ b/docs/python-sdk/fastmcp-utilities-http.mdx@@ -7,7 +7,7 @@ sidebarTitle: http## Functions-### `find_available_port` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/http.py#L4"><Icon icon="github" size="14" /></a></sup>+### `find_available_port` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/http.py#L4" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfind_available_port() -> intdiff --git a/docs/python-sdk/fastmcp-utilities-inspect.mdx b/docs/python-sdk/fastmcp-utilities-inspect.mdxindex f7b09c229..850983f9d 100644--- a/docs/python-sdk/fastmcp-utilities-inspect.mdx+++ b/docs/python-sdk/fastmcp-utilities-inspect.mdx@@ -8,33 +8,86 @@ sidebarTitle: inspectUtilities for inspecting FastMCP instances.+## Functions++### `inspect_fastmcp_v2` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L82" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+inspect_fastmcp_v2(mcp: FastMCP[Any]) -> FastMCPInfo+```+++Extract information from a FastMCP v2.x instance.++**Args:**+- `mcp`: The FastMCP v2.x instance to inspect++**Returns:**+- FastMCPInfo dataclass containing the extracted information+++### `inspect_fastmcp_v1` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L182" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+inspect_fastmcp_v1(mcp: Any) -> FastMCPInfo+```+++Extract information from a FastMCP v1.x instance using a Client.++**Args:**+- `mcp`: The FastMCP v1.x instance to inspect++**Returns:**+- FastMCPInfo dataclass containing the extracted information+++### `inspect_fastmcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L311" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+inspect_fastmcp(mcp: FastMCP[Any] | Any) -> FastMCPInfo+```+++Extract information from a FastMCP instance into a dataclass.++This function automatically detects whether the instance is FastMCP v1.x or v2.x+and uses the appropriate extraction method.++**Args:**+- `mcp`: The FastMCP instance to inspect (v1.x or v2.x)++**Returns:**+- FastMCPInfo dataclass containing the extracted information++## Classes-### `ToolInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L16"><Icon icon="github" size="14" /></a></sup>+### `ToolInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L16" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Information about a tool.-### `PromptInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L29"><Icon icon="github" size="14" /></a></sup>+### `PromptInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L29" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Information about a prompt.-### `ResourceInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L41"><Icon icon="github" size="14" /></a></sup>+### `ResourceInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L41" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Information about a resource.-### `TemplateInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L54"><Icon icon="github" size="14" /></a></sup>+### `TemplateInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L54" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Information about a resource template.-### `FastMCPInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L67"><Icon icon="github" size="14" /></a></sup>+### `FastMCPInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/inspect.py#L67" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Information extracted from a FastMCP instance.diff --git a/docs/python-sdk/fastmcp-utilities-json_schema.mdx b/docs/python-sdk/fastmcp-utilities-json_schema.mdxindex 282c03745..451b3dbff 100644--- a/docs/python-sdk/fastmcp-utilities-json_schema.mdx+++ b/docs/python-sdk/fastmcp-utilities-json_schema.mdx@@ -7,7 +7,7 @@ sidebarTitle: json_schema## Functions-### `compress_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/json_schema.py#L130"><Icon icon="github" size="14" /></a></sup>+### `compress_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/json_schema.py#L141" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoncompress_schema(schema: dict, prune_params: list[str] | None = None, prune_defs: bool = True, prune_additional_properties: bool = True, prune_titles: bool = False) -> dictdiff --git a/docs/python-sdk/fastmcp-utilities-json_schema_type.mdx b/docs/python-sdk/fastmcp-utilities-json_schema_type.mdxnew file mode 100644index 000000000..50fba7654--- /dev/null+++ b/docs/python-sdk/fastmcp-utilities-json_schema_type.mdx@@ -0,0 +1,110 @@+---+title: json_schema_type+sidebarTitle: json_schema_type+---++# `fastmcp.utilities.json_schema_type`+++Convert JSON Schema to Python types with validation.++The json_schema_to_type function converts a JSON Schema into a Python type that can be used+for validation with Pydantic. It supports:++- Basic types (string, number, integer, boolean, null)+- Complex types (arrays, objects)+- Format constraints (date-time, email, uri)+- Numeric constraints (minimum, maximum, multipleOf)+- String constraints (minLength, maxLength, pattern)+- Array constraints (minItems, maxItems, uniqueItems)+- Object properties with defaults+- References and recursive schemas+- Enums and constants+- Union types++Example:+ ```python+ schema = {+ "type": "object",+ "properties": {+ "name": {"type": "string", "minLength": 1},+ "age": {"type": "integer", "minimum": 0},+ "email": {"type": "string", "format": "email"}+ },+ "required": ["name", "age"]+ }++ # Name is optional and will be inferred from schema's "title" property if not provided+ Person = json_schema_to_type(schema)+ # Creates a validated dataclass with name, age, and optional email fields+ ```+++## Functions++### `json_schema_to_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/json_schema_type.py#L110" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+json_schema_to_type(schema: Mapping[str, Any], name: str | None = None) -> type+```+++Convert JSON schema to appropriate Python type with validation.++**Args:**+- `schema`: A JSON Schema dictionary defining the type structure and validation rules+- `name`: Optional name for object schemas. Only allowed when schema type is "object".+If not provided for objects, name will be inferred from schema's "title"+property or default to "Root".++**Returns:**+- A Python type (typically a dataclass for objects) with Pydantic validation++**Raises:**+- `ValueError`: If a name is provided for a non-object schema++**Examples:**++Create a dataclass from an object schema:+```python+schema = {+ "type": "object",+ "title": "Person",+ "properties": {+ "name": {"type": "string", "minLength": 1},+ "age": {"type": "integer", "minimum": 0},+ "email": {"type": "string", "format": "email"}+ },+ "required": ["name", "age"]+}++Person = json_schema_to_type(schema)+# Creates a dataclass with name, age, and optional email fields:+# @dataclass+# class Person:+# name: str+# age: int+# email: str | None = None+```+Person(name="John", age=30)++Create a scalar type with constraints:+```python+schema = {+ "type": "string",+ "minLength": 3,+ "pattern": "^[A-Z][a-z]+$"+}++NameType = json_schema_to_type(schema)+# Creates Annotated[str, StringConstraints(min_length=3, pattern="^[A-Z][a-z]+$")]++@dataclass+class Name:+ name: NameType+```+++## Classes++### `JSONSchema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/json_schema_type.py#L77" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>diff --git a/docs/python-sdk/fastmcp-utilities-logging.mdx b/docs/python-sdk/fastmcp-utilities-logging.mdxindex 03ca4a1bb..f4eb26666 100644--- a/docs/python-sdk/fastmcp-utilities-logging.mdx+++ b/docs/python-sdk/fastmcp-utilities-logging.mdx@@ -10,7 +10,7 @@ Logging utilities for FastMCP.## Functions-### `get_logger` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/logging.py#L10"><Icon icon="github" size="14" /></a></sup>+### `get_logger` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/logging.py#L10" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_logger(name: str) -> logging.Logger@@ -26,7 +26,7 @@ Get a logger nested under FastMCP namespace.- a configured logger instance-### `configure_logging` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/logging.py#L22"><Icon icon="github" size="14" /></a></sup>+### `configure_logging` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/logging.py#L22" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonconfigure_logging(level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] | int = 'INFO', logger: logging.Logger | None = None, enable_rich_tracebacks: bool = True) -> Nonediff --git a/docs/python-sdk/fastmcp-utilities-openapi.mdx b/docs/python-sdk/fastmcp-utilities-openapi.mdxindex e64157c68..4cb84f5f4 100644--- a/docs/python-sdk/fastmcp-utilities-openapi.mdx+++ b/docs/python-sdk/fastmcp-utilities-openapi.mdx@@ -7,7 +7,48 @@ sidebarTitle: openapi## Functions-### `parse_openapi_to_http_routes` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L112"><Icon icon="github" size="14" /></a></sup>+### `format_array_parameter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L42" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+format_array_parameter(values: list, parameter_name: str, is_query_parameter: bool = False) -> str | list+```+++Format an array parameter according to OpenAPI specifications.++**Args:**+- `values`: List of values to format+- `parameter_name`: Name of the parameter (for error messages)+- `is_query_parameter`: If True, can return list for explode=True behavior++**Returns:**+- String (comma-separated) or list (for query params with explode=True)+++### `format_deep_object_parameter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L96" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+format_deep_object_parameter(param_value: dict, parameter_name: str) -> dict[str, str]+```+++Format a dictionary parameter for deepObject style serialization.++According to OpenAPI 3.0 spec, deepObject style with explode=true serializes+object properties as separate query parameters with bracket notation.++For example: {"id": "123", "type": "user"} becomes:+param[id]=123¶m[type]=user++**Args:**+- `param_value`: Dictionary value to format+- `parameter_name`: Name of the parameter++**Returns:**+- Dictionary with bracketed parameter names as keys+++### `parse_openapi_to_http_routes` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L205" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonparse_openapi_to_http_routes(openapi_dict: dict[str, Any]) -> list[HTTPRoute]@@ -20,7 +61,7 @@ using the openapi-pydantic library.Supports both OpenAPI 3.0.x and 3.1.x versions.-### `clean_schema_for_display` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L570"><Icon icon="github" size="14" /></a></sup>+### `clean_schema_for_display` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L740" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonclean_schema_for_display(schema: JsonSchema | None) -> JsonSchema | None@@ -30,7 +71,7 @@ clean_schema_for_display(schema: JsonSchema | None) -> JsonSchema | NoneClean up a schema dictionary for display by removing internal/complex fields.-### `generate_example_from_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L630"><Icon icon="github" size="14" /></a></sup>+### `generate_example_from_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L800" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythongenerate_example_from_schema(schema: JsonSchema | None) -> Any@@ -41,7 +82,7 @@ Generate a simple example value from a JSON schema dictionary.Very basic implementation focusing on types.-### `format_json_for_description` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L713"><Icon icon="github" size="14" /></a></sup>+### `format_json_for_description` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L883" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonformat_json_for_description(data: Any, indent: int = 2) -> str@@ -51,7 +92,7 @@ format_json_for_description(data: Any, indent: int = 2) -> strFormats Python data as a JSON string block for markdown.-### `format_description_with_responses` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L722"><Icon icon="github" size="14" /></a></sup>+### `format_description_with_responses` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L892" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonformat_description_with_responses(base_description: str, responses: dict[str, Any], parameters: list[ParameterInfo] | None = None, request_body: RequestBodyInfo | None = None) -> str@@ -74,33 +115,54 @@ including its description, whether it is required, and its content schema.- and the request body.+### `extract_output_schema_from_responses` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L1291" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+extract_output_schema_from_responses(responses: dict[str, ResponseInfo], schema_definitions: dict[str, Any] | None = None) -> dict[str, Any] | None+```+++Extract output schema from OpenAPI responses for use as MCP tool output schema.++This function finds the first successful response (200, 201, 202, 204) with a+JSON-compatible content type and extracts its schema. If the schema is not an+object type, it wraps it to comply with MCP requirements.++**Args:**+- `responses`: Dictionary of ResponseInfo objects keyed by status code+- `schema_definitions`: Optional schema definitions to include in the output schema++**Returns:**+- MCP-compliant output schema with potential wrapping, or None if no suitable schema found++## Classes-### `ParameterInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L42"><Icon icon="github" size="14" /></a></sup>+### `ParameterInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L130" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Represents a single parameter for an HTTP operation in our IR.-### `RequestBodyInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L52"><Icon icon="github" size="14" /></a></sup>+### `RequestBodyInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L142" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Represents the request body for an HTTP operation in our IR.-### `ResponseInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L62"><Icon icon="github" size="14" /></a></sup>+### `ResponseInfo` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L152" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Represents response information in our IR.-### `HTTPRoute` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L70"><Icon icon="github" size="14" /></a></sup>+### `HTTPRoute` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L160" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Intermediate Representation for a single OpenAPI operation.-### `OpenAPIParser` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L164"><Icon icon="github" size="14" /></a></sup>+### `OpenAPIParser` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L257" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Unified parser for OpenAPI schemas with generic type parameters to handle both 3.0 and 3.1.@@ -108,7 +170,7 @@ Unified parser for OpenAPI schemas with generic type parameters to handle both 3**Methods:**-#### `parse` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L469"><Icon icon="github" size="14" /></a></sup>+#### `parse` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi.py#L619" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonparse(self) -> list[HTTPRoute]diff --git a/docs/python-sdk/fastmcp-utilities-tests.mdx b/docs/python-sdk/fastmcp-utilities-tests.mdxindex 78e0180c1..f8f1d8fb8 100644--- a/docs/python-sdk/fastmcp-utilities-tests.mdx+++ b/docs/python-sdk/fastmcp-utilities-tests.mdx@@ -7,7 +7,7 @@ sidebarTitle: tests## Functions-### `temporary_settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L21"><Icon icon="github" size="14" /></a></sup>+### `temporary_settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L22" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythontemporary_settings(**kwargs: Any)@@ -20,7 +20,7 @@ Temporarily override FastMCP setting values.- `**kwargs`: The settings to override, including nested settings.-### `run_server_in_process` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L74"><Icon icon="github" size="14" /></a></sup>+### `run_server_in_process` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L75" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonrun_server_in_process(server_fn: Callable[..., None], *args, **kwargs) -> Generator[str, None, None]@@ -40,3 +40,13 @@ not pickleable, so we need a function that creates and runs one.**Returns:**- The server URL.++### `caplog_for_fastmcp` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/tests.py#L136" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+caplog_for_fastmcp(caplog)+```+++Context manager to capture logs from FastMCP loggers even when propagation is disabled.+diff --git a/docs/python-sdk/fastmcp-utilities-types.mdx b/docs/python-sdk/fastmcp-utilities-types.mdxindex 19a5b7b45..378e0e076 100644--- a/docs/python-sdk/fastmcp-utilities-types.mdx+++ b/docs/python-sdk/fastmcp-utilities-types.mdx@@ -10,7 +10,7 @@ Common types used across FastMCP.## Functions-### `get_cached_typeadapter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L35"><Icon icon="github" size="14" /></a></sup>+### `get_cached_typeadapter` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L31" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonget_cached_typeadapter(cls: T) -> TypeAdapter[T]@@ -23,7 +23,7 @@ However, this isn't feasible for user-generated functions. Instead, we use acache to minimize the cost of creating them as much as possible.-### `issubclass_safe` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L45"><Icon icon="github" size="14" /></a></sup>+### `issubclass_safe` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L41" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonissubclass_safe(cls: type, base: type) -> bool@@ -33,7 +33,7 @@ issubclass_safe(cls: type, base: type) -> boolCheck if cls is a subclass of base, even if cls is a type variable.-### `is_class_member_of_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L55"><Icon icon="github" size="14" /></a></sup>+### `is_class_member_of_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L51" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonis_class_member_of_type(cls: type, base: type) -> bool@@ -46,7 +46,7 @@ Base can be a type, a UnionType, or an Annotated type. Generic types are notconsidered members (e.g. T is not a member of list\[T]).-### `find_kwarg_by_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L77"><Icon icon="github" size="14" /></a></sup>+### `find_kwarg_by_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L73" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfind_kwarg_by_type(fn: Callable, kwarg_type: type) -> str | None@@ -58,15 +58,40 @@ Find the name of the kwarg that is of type kwarg_type.Includes union types that contain the kwarg_type, as well as Annotated types.+### `replace_type` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L293" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+replace_type(type_, type_map: dict[type, type])+```+++Given a (possibly generic, nested, or otherwise complex) type, replaces all+instances of old_type with new_type.++This is useful for transforming types when creating tools.++**Args:**+- `type_`: The type to replace instances of old_type with new_type.+- `old_type`: The type to replace.+- `new_type`: The type to replace old_type with.++**Examples:**++>>> replace_type(list\[int | bool], {int: str})+list\[str | bool]+>>> replace_type(list\[list\[int]], {int: str})+list\[list\[str]]++## Classes-### `FastMCPBaseModel` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L28"><Icon icon="github" size="14" /></a></sup>+### `FastMCPBaseModel` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L24" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Base model for FastMCP models.-### `Image` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L94"><Icon icon="github" size="14" /></a></sup>+### `Image` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L90" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Helper class for returning images from tools.@@ -74,16 +99,16 @@ Helper class for returning images from tools.**Methods:**-#### `to_image_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L131"><Icon icon="github" size="14" /></a></sup>+#### `to_image_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L127" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-to_image_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> ImageContent+to_image_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> mcp.types.ImageContent```Convert to MCP ImageContent.-### `Audio` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L153"><Icon icon="github" size="14" /></a></sup>+### `Audio` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L149" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Helper class for returning audio from tools.@@ -91,13 +116,13 @@ Helper class for returning audio from tools.**Methods:**-#### `to_audio_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L190"><Icon icon="github" size="14" /></a></sup>+#### `to_audio_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L186" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-to_audio_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> AudioContent+to_audio_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> mcp.types.AudioContent```-### `File` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L211"><Icon icon="github" size="14" /></a></sup>+### `File` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L207" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Helper class for returning audio from tools.@@ -105,8 +130,8 @@ Helper class for returning audio from tools.**Methods:**-#### `to_resource_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L250"><Icon icon="github" size="14" /></a></sup>+#### `to_resource_content` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/types.py#L246" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-to_resource_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> EmbeddedResource+to_resource_content(self, mime_type: str | None = None, annotations: Annotations | None = None) -> mcp.types.EmbeddedResource```