π The fast, Pythonic way to build MCP servers and clients.
chore: Update SDK documentation (#1675)
marvin-context-protocol[bot]bc84961ab97c
diff --git a/docs/docs.json b/docs/docs.jsonindex 3cd031270..e2bc06e02 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -394,6 +394,14 @@"group": "v1","pages": ["python-sdk/fastmcp-utilities-mcp_server_config-v1-__init__",+ {+ "group": "environments",+ "pages": [+ "python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-__init__",+ "python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-base",+ "python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-uv"+ ]+ },"python-sdk/fastmcp-utilities-mcp_server_config-v1-mcp_server_config",{"group": "sources",diff --git a/docs/python-sdk/fastmcp-cli-cli.mdx b/docs/python-sdk/fastmcp-cli-cli.mdxindex 83677c671..4dddc51ad 100644--- a/docs/python-sdk/fastmcp-cli-cli.mdx+++ b/docs/python-sdk/fastmcp-cli-cli.mdx@@ -10,7 +10,7 @@ FastMCP CLI tools using Cyclopts.## Functions-### `with_argv` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L67" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `with_argv` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L68" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonwith_argv(args: list[str] | None)@@ -27,7 +27,7 @@ Args are provided without the script name, so we preserve sys.argv[0]and replace the rest.-### `version` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L90" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `version` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L91" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonversion()@@ -37,7 +37,7 @@ version()Display version information and platform details.-### `dev` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L128" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `dev` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L129" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythondev(server_spec: str | None = None) -> None@@ -50,7 +50,7 @@ Run an MCP server with the MCP Inspector for development.- `server_spec`: Python file to run, optionally with \:object suffix, or None to auto-detect fastmcp.json-### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L309" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `run` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L310" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonrun(server_spec: str | None = None, *server_args: str) -> None@@ -74,7 +74,7 @@ fastmcp run server.py -- --config config.json --debug- `server_spec`: Python file, object specification (file\:obj), config file, URL, or None to auto-detect-### `inspect` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L521" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `inspect` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L524" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythoninspect(server_spec: str | None = None) -> None@@ -105,7 +105,7 @@ fastmcp inspect # auto-detect fastmcp.json- `server_spec`: Python file to inspect, optionally with \:object suffix, or fastmcp.json-### `prepare` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L754" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `prepare` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/cli/cli.py#L765" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonprepare(config_path: Annotated[str | None, cyclopts.Parameter(help='Path to fastmcp.json configuration file')] = None, output_dir: Annotated[str | None, cyclopts.Parameter(help='Directory to create the persistent environment in')] = None, skip_source: Annotated[bool, cyclopts.Parameter(help='Skip source preparation (e.g., git clone)')] = False) -> Nonediff --git a/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-__init__.mdx b/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-__init__.mdxnew file mode 100644index 000000000..01f147482--- /dev/null+++ b/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-__init__.mdx@@ -0,0 +1,9 @@+---+title: __init__+sidebarTitle: __init__+---++# `fastmcp.utilities.mcp_server_config.v1.environments`+++Environment configuration for MCP servers.diff --git a/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-base.mdx b/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-base.mdxnew file mode 100644index 000000000..52b0de9a8--- /dev/null+++ b/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-base.mdx@@ -0,0 +1,43 @@+---+title: base+sidebarTitle: base+---++# `fastmcp.utilities.mcp_server_config.v1.environments.base`++## Classes++### `Environment` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/environments/base.py#L7" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++Base class for environment configuration.+++**Methods:**++#### `build_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/environments/base.py#L11" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+build_command(self, command: list[str]) -> list[str]+```++Build the full command with environment setup.++**Args:**+- `command`: Base command to wrap with environment setup++**Returns:**+- Full command ready for subprocess execution+++#### `prepare` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/environments/base.py#L22" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+prepare(self, output_dir: Path | None = None) -> None+```++Prepare the environment (optional, can be no-op).++**Args:**+- `output_dir`: Directory for persistent environment setup+diff --git a/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-uv.mdx b/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-uv.mdxnew file mode 100644index 000000000..84d117078--- /dev/null+++ b/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-environments-uv.mdx@@ -0,0 +1,75 @@+---+title: uv+sidebarTitle: uv+---++# `fastmcp.utilities.mcp_server_config.v1.environments.uv`++## Classes++### `UVEnvironment` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/environments/uv.py#L15" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+++Configuration for Python environment setup.+++**Methods:**++#### `build_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/environments/uv.py#L48" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+build_command(self, command: list[str]) -> list[str]+```++Build complete uv run command with environment args and command to execute.++**Args:**+- `command`: Command to execute (e.g., ["fastmcp", "run", "server.py"])++**Returns:**+- Complete command ready for subprocess.run, including "uv" prefix if needed.+- If no environment configuration is set, returns the command unchanged.+++#### `run_with_uv` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/environments/uv.py#L92" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+run_with_uv(self, command: list[str]) -> None+```++Execute a command using uv run with this environment configuration.++**Args:**+- `command`: Command and arguments to execute (e.g., ["fastmcp", "run", "server.py"])+++#### `needs_uv` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/environments/uv.py#L133" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+needs_uv(self) -> bool+```++Deprecated: Use _needs_setup() internally or check if build_command modifies the command.+++#### `build_uv_run_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/environments/uv.py#L137" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+build_uv_run_command(self, command: list[str]) -> list[str]+```++Deprecated: Use build_command() instead.+++#### `prepare` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/environments/uv.py#L141" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>++```python+prepare(self, output_dir: Path | None = None) -> None+```++Prepare the Python environment using uv.++**Args:**+- `output_dir`: Directory where the persistent uv project will be created.+ If None, creates a temporary directory for ephemeral use.+diff --git a/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-mcp_server_config.mdx b/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-mcp_server_config.mdxindex fe7815a9b..7096185a0 100644--- a/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-mcp_server_config.mdx+++ b/docs/python-sdk/fastmcp-utilities-mcp_server_config-v1-mcp_server_config.mdx@@ -15,7 +15,7 @@ command-line arguments.## Functions-### `generate_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L705" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `generate_schema` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L428" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythongenerate_schema(output_path: Path | str | None = None) -> dict[str, Any] | None@@ -38,67 +38,7 @@ validation and auto-completion.## Classes-### `Environment` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L33" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>---Configuration for Python environment setup.---**Methods:**--#### `build_uv_run_command` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L66" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>--```python-build_uv_run_command(self, command: list[str]) -> list[str]-```--Build complete uv run command with environment args and command to execute.--**Args:**-- `command`: Command to execute (e.g., ["fastmcp", "run", "server.py"])--**Returns:**-- Complete command ready for subprocess.run, including "uv" prefix---#### `run_with_uv` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L105" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>--```python-run_with_uv(self, command: list[str]) -> None-```--Execute a command using uv run with this environment configuration.--**Args:**-- `command`: Command and arguments to execute (e.g., ["fastmcp", "run", "server.py"])---#### `needs_uv` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L130" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>--```python-needs_uv(self) -> bool-```--Check if this environment config requires uv to set up.--**Returns:**-- True if any environment settings require uv run---#### `prepare` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L146" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>--```python-prepare(self, output_dir: Path | None = None) -> None-```--Prepare the Python environment using uv.--**Args:**-- `output_dir`: Directory where the persistent uv project will be created.- If None, creates a temporary directory for ephemeral use.---### `Deployment` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L311" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `Deployment` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L34" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Configuration for server deployment and runtime settings.@@ -106,7 +46,7 @@ Configuration for server deployment and runtime settings.**Methods:**-#### `apply_runtime_settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L360" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `apply_runtime_settings` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L83" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonapply_runtime_settings(self, config_path: Path | None = None) -> None@@ -122,7 +62,7 @@ For example: "API_URL": "https://api.${ENVIRONMENT}.example.com"will substitute the value of the ENVIRONMENT variable at runtime.-### `MCPServerConfig` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L409" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+### `MCPServerConfig` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L132" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Configuration for a FastMCP server.@@ -133,7 +73,7 @@ a FastMCP server in a declarative format.**Methods:**-#### `validate_source` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L458" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `validate_source` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L181" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonvalidate_source(cls, v: dict | FileSystemSource) -> FileSystemSource@@ -149,10 +89,10 @@ No string parsing happens here - that's only at CLI boundaries.MCPServerConfig works only with properly typed objects.-#### `validate_environment` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L481" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `validate_environment` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L204" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```python-validate_environment(cls, v: dict | Environment) -> Environment+validate_environment(cls, v: dict | UVEnvironment) -> UVEnvironment```Validate and convert environment to Environment.@@ -162,7 +102,7 @@ Accepts:- dict that can be converted to Environment-#### `validate_deployment` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L497" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `validate_deployment` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L220" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonvalidate_deployment(cls, v: dict | Deployment) -> Deployment@@ -175,7 +115,7 @@ Accepts:- dict that can be converted to Deployment-#### `from_file` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L513" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `from_file` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L236" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_file(cls, file_path: Path) -> MCPServerConfig@@ -195,7 +135,7 @@ Load configuration from a JSON file.- `pydantic.ValidationError`: If the configuration is invalid-#### `from_cli_args` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L536" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `from_cli_args` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L259" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfrom_cli_args(cls, source: FileSystemSource, transport: Literal['stdio', 'http', 'sse', 'streamable-http'] | None = None, host: str | None = None, port: int | None = None, path: str | None = None, log_level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] | None = None, python: str | None = None, dependencies: list[str] | None = None, requirements: str | None = None, project: str | None = None, editable: str | None = None, env: dict[str, str] | None = None, cwd: str | None = None, args: list[str] | None = None) -> MCPServerConfig@@ -226,7 +166,7 @@ goes through a config object.- MCPServerConfig instance-#### `find_config` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L613" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `find_config` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L336" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonfind_config(cls, start_path: Path | None = None) -> Path | None@@ -241,7 +181,7 @@ Find a fastmcp.json file in the specified directory.- Path to the configuration file, or None if not found-#### `prepare` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L632" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `prepare` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L355" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonprepare(self, skip_source: bool = False, output_dir: Path | None = None) -> None@@ -257,7 +197,7 @@ When output_dir is None, does ephemeral caching (for backwards compatibility).- `output_dir`: Directory to create the persistent uv project in (optional)-#### `prepare_environment` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L653" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `prepare_environment` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L376" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonprepare_environment(self, output_dir: Path | None = None) -> None@@ -272,7 +212,7 @@ Prepare the Python environment.Delegates to the environment's prepare() method-#### `prepare_source` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L664" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `prepare_source` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L387" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonprepare_source(self) -> None@@ -283,7 +223,7 @@ Prepare the source for loading.Delegates to the source's prepare() method.-#### `run_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L671" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>+#### `run_server` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py#L394" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>```pythonrun_server(self, **kwargs: Any) -> None