diff --git a/docs/docs.json b/docs/docs.json index 0c0677a67..2f5933cc1 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -177,9 +177,11 @@ { "group": "fastmcp.client", "pages": [ + "python-sdk/fastmcp-client-__init__", { "group": "auth", "pages": [ + "python-sdk/fastmcp-client-auth-__init__", "python-sdk/fastmcp-client-auth-bearer", "python-sdk/fastmcp-client-auth-oauth" ] @@ -196,6 +198,7 @@ { "group": "fastmcp.prompts", "pages": [ + "python-sdk/fastmcp-prompts-__init__", "python-sdk/fastmcp-prompts-prompt", "python-sdk/fastmcp-prompts-prompt_manager" ] @@ -203,6 +206,7 @@ { "group": "fastmcp.resources", "pages": [ + "python-sdk/fastmcp-resources-__init__", "python-sdk/fastmcp-resources-resource", "python-sdk/fastmcp-resources-resource_manager", "python-sdk/fastmcp-resources-template", @@ -212,13 +216,16 @@ { "group": "fastmcp.server", "pages": [ + "python-sdk/fastmcp-server-__init__", { "group": "auth", "pages": [ + "python-sdk/fastmcp-server-auth-__init__", "python-sdk/fastmcp-server-auth-auth", { "group": "providers", "pages": [ + "python-sdk/fastmcp-server-auth-providers-__init__", "python-sdk/fastmcp-server-auth-providers-bearer", "python-sdk/fastmcp-server-auth-providers-bearer_env", "python-sdk/fastmcp-server-auth-providers-in_memory" @@ -238,6 +245,7 @@ { "group": "fastmcp.tools", "pages": [ + "python-sdk/fastmcp-tools-__init__", "python-sdk/fastmcp-tools-tool", "python-sdk/fastmcp-tools-tool_manager", "python-sdk/fastmcp-tools-tool_transform" diff --git a/docs/python-sdk/fastmcp-cli-claude.mdx b/docs/python-sdk/fastmcp-cli-claude.mdx index 13fe7d600..6ea44b33e 100644 --- a/docs/python-sdk/fastmcp-cli-claude.mdx +++ b/docs/python-sdk/fastmcp-cli-claude.mdx @@ -30,7 +30,7 @@ update_claude_config(file_spec: str, server_name: str) -> bool Add or update a FastMCP server in Claude's configuration. **Args:** -- `file_spec`: Path to the server file, optionally with :object suffix +- `file_spec`: Path to the server file, optionally with \:object suffix - `server_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 diff --git a/docs/python-sdk/fastmcp-cli-run.mdx b/docs/python-sdk/fastmcp-cli-run.mdx index bdb07beac..7505c7fb4 100644 --- a/docs/python-sdk/fastmcp-cli-run.mdx +++ b/docs/python-sdk/fastmcp-cli-run.mdx @@ -30,7 +30,7 @@ parse_file_path(server_spec: str) -> tuple[Path, str | None] Parse a file path that may include a server object specification. **Args:** -- `server_spec`: Path to file, optionally with :object suffix +- `server_spec`: Path to file, optionally with \:object suffix **Returns:** - Tuple of (file_path, server_object) @@ -47,7 +47,7 @@ Import a MCP server from a file. **Args:** - `file`: Path to the file -- `server_object`: Optional object name in format "module:object" or just "object" +- `server_object`: Optional object name in format "module\:object" or just "object" **Returns:** - The server object @@ -97,7 +97,7 @@ run_command(server_spec: str, transport: str | None = None, host: str | None = N Run a MCP server or connect to a remote one. **Args:** -- `server_spec`: Python file, object specification (file:obj), or URL +- `server_spec`: Python file, object specification (file\:obj), or URL - `transport`: Transport protocol to use - `host`: Host to bind to when using http transport - `port`: Port to bind to when using http transport diff --git a/docs/python-sdk/fastmcp-client-auth-oauth.mdx b/docs/python-sdk/fastmcp-client-auth-oauth.mdx index d299c1a95..f10afba36 100644 --- a/docs/python-sdk/fastmcp-client-auth-oauth.mdx +++ b/docs/python-sdk/fastmcp-client-auth-oauth.mdx @@ -26,8 +26,7 @@ This is intended to be provided to the `auth` parameter of an httpx.AsyncClient (or appropriate FastMCP client/transport instance) **Args:** -- `mcp_url`: Full URL to the MCP endpoint (e.g., -- `"http`: //host/mcp/sse") +- `mcp_url`: Full URL to the MCP endpoint (e.g. "http\://host/mcp/sse/") - `scopes`: OAuth scopes to request. Can be a - `client_name`: Name for this client during registration - `token_storage_cache_dir`: Directory for FileTokenStorage diff --git a/docs/python-sdk/fastmcp-server-auth-providers-bearer.mdx b/docs/python-sdk/fastmcp-server-auth-providers-bearer.mdx index d619de127..5e85ee1e9 100644 --- a/docs/python-sdk/fastmcp-server-auth-providers-bearer.mdx +++ b/docs/python-sdk/fastmcp-server-auth-providers-bearer.mdx @@ -38,7 +38,7 @@ Generate an RSA key pair for testing. #### `create_token` ```python -create_token(self, subject: str = 'fastmcp-user', issuer: str = 'https://fastmcp.example.com', audience: 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 +create_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 ``` Generate a test JWT token for testing purposes. @@ -47,7 +47,7 @@ Generate a test JWT token for testing purposes. - `private_key_pem`: RSA private key in PEM format - `subject`: Subject claim (usually user ID) - `issuer`: Issuer claim -- `audience`: Audience claim (optional) +- `audience`: Audience claim - can be a string or list of strings (optional) - `scopes`: List of scopes to include - `expires_in_seconds`: Token expiration time in seconds - `additional_claims`: Any additional claims to include diff --git a/docs/python-sdk/fastmcp-server-server.mdx b/docs/python-sdk/fastmcp-server-server.mdx index 8f631c002..2b3c1ed83 100644 --- a/docs/python-sdk/fastmcp-server-server.mdx +++ b/docs/python-sdk/fastmcp-server-server.mdx @@ -223,7 +223,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 -- `annotations`: Optional annotations about the tool's behavior (e.g. {"is_async": True}) +- `annotations`: Optional annotations about the tool's behavior (e.g. {"is_async"\: True}) - `exclude_args`: Optional list of argument names to exclude from the tool schema - `enabled`: Optional boolean to enable or disable the tool @@ -294,7 +294,7 @@ If the URI contains parameters (e.g. "resource://{param}") or the function has parameters, it will be registered as a template resource. **Args:** -- `uri`: URI for the resource (e.g. "resource://my-resource" or "resource://{param}") +- `uri`: URI for the resource (e.g. "resource\://my-resource" or "resource\://{param}") - `name`: Optional name for the resource - `description`: Optional description of the resource - `mime_type`: Optional MIME type for the resource diff --git a/docs/python-sdk/fastmcp-tools-tool_transform.mdx b/docs/python-sdk/fastmcp-tools-tool_transform.mdx index c0d10e34d..abee7d5eb 100644 --- a/docs/python-sdk/fastmcp-tools-tool_transform.mdx +++ b/docs/python-sdk/fastmcp-tools-tool_transform.mdx @@ -89,10 +89,10 @@ to call the parent tool. Functions with **kwargs receive transformed argument names. - `name`: New name for the tool. Defaults to parent tool's name. - `transform_args`: Optional transformations for parent tool arguments. -Only specified arguments are transformed, others pass through unchanged: -- str: Simple rename -- ArgTransform: Complex transformation (rename/description/default/drop) -- None: Drop the argument +Only specified arguments are transformed, others pass through unchanged\: +- str\: Simple rename +- ArgTransform\: Complex transformation (rename/description/default/drop) +- None\: Drop the argument - `description`: New description. Defaults to parent's description. - `tags`: New tags. Defaults to parent's tags. - `annotations`: New annotations. Defaults to parent's annotations. diff --git a/docs/python-sdk/fastmcp-utilities-json_schema.mdx b/docs/python-sdk/fastmcp-utilities-json_schema.mdx index bedf79119..ad68473a0 100644 --- a/docs/python-sdk/fastmcp-utilities-json_schema.mdx +++ b/docs/python-sdk/fastmcp-utilities-json_schema.mdx @@ -20,6 +20,6 @@ Remove the given parameters from the schema. - `schema`: The schema to compress - `prune_params`: List of parameter names to remove from properties - `prune_defs`: Whether to remove unused definitions -- `prune_additional_properties`: Whether to remove additionalProperties: false +- `prune_additional_properties`: Whether to remove additionalProperties\: false - `prune_titles`: Whether to remove title fields from the schema diff --git a/justfile b/justfile index a27c2877f..a18451447 100644 --- a/justfile +++ b/justfile @@ -16,11 +16,11 @@ docs: # Generate API reference documentation for all modules api-ref-all: - uvx --with-editable . --refresh-package mdxify mdxify@latest --all --root-module fastmcp + uvx --with-editable . --refresh-package mdxify mdxify@latest --all --root-module fastmcp --anchor-name "SDK Reference" # Generate API reference for specific modules (e.g., just api-ref prefect.flows prefect.tasks) api-ref *MODULES: - uvx --with-editable . --refresh-package mdxify mdxify@latest {{MODULES}} --root-module fastmcp + uvx --with-editable . --refresh-package mdxify mdxify@latest {{MODULES}} --root-module fastmcp --anchor-name "SDK Reference" # Clean up API reference documentation api-ref-clean: diff --git a/src/fastmcp/client/auth/oauth.py b/src/fastmcp/client/auth/oauth.py index ee0e29d77..b858cc17d 100644 --- a/src/fastmcp/client/auth/oauth.py +++ b/src/fastmcp/client/auth/oauth.py @@ -306,8 +306,7 @@ def OAuth( httpx.AsyncClient (or appropriate FastMCP client/transport instance) Args: - mcp_url: Full URL to the MCP endpoint (e.g., - "http://host/mcp/sse/") + mcp_url: Full URL to the MCP endpoint (e.g. "http://host/mcp/sse/") scopes: OAuth scopes to request. Can be a space-separated string or a list of strings. client_name: Name for this client during registration