From eac646e7441516d24072bbaa6d3b7021cfc37635 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Mon, 6 Apr 2026 11:18:14 -0400 Subject: [PATCH] chore: split SDK navigation into standalone $ref file (#3773) --- docs/docs.json | 424 +----------------- docs/python-sdk-pages.json | 421 +++++++++++++++++ docs/python-sdk/fastmcp-cli-apps_dev.mdx | 2 +- .../fastmcp-prompts-function_prompt.mdx | 7 +- .../fastmcp-resources-function_resource.mdx | 5 +- .../python-sdk/fastmcp-resources-template.mdx | 7 +- docs/python-sdk/fastmcp-server-context.mdx | 76 ++-- .../fastmcp-server-dependencies.mdx | 150 ++++--- ...cp-server-middleware-response_limiting.mdx | 4 +- .../fastmcp-server-providers-proxy.mdx | 58 +-- .../fastmcp-server-tasks-handlers.mdx | 2 +- .../fastmcp-tools-function_tool.mdx | 23 +- justfile | 4 +- 13 files changed, 610 insertions(+), 573 deletions(-) create mode 100644 docs/python-sdk-pages.json diff --git a/docs/docs.json b/docs/docs.json index 0b0e4f41a..843d67c7e 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -395,427 +395,9 @@ { "anchor": "Python SDK", "icon": "python", - "pages": [ - "python-sdk/fastmcp-decorators", - "python-sdk/fastmcp-dependencies", - "python-sdk/fastmcp-exceptions", - "python-sdk/fastmcp-mcp_config", - "python-sdk/fastmcp-settings", - "python-sdk/fastmcp-telemetry", - "python-sdk/fastmcp-types", - { - "group": "fastmcp.apps", - "pages": [ - "python-sdk/fastmcp-apps-__init__", - "python-sdk/fastmcp-apps-app", - "python-sdk/fastmcp-apps-approval", - "python-sdk/fastmcp-apps-choice", - "python-sdk/fastmcp-apps-config", - "python-sdk/fastmcp-apps-file_upload", - "python-sdk/fastmcp-apps-form", - "python-sdk/fastmcp-apps-generative" - ] - }, - { - "group": "fastmcp.cli", - "pages": [ - "python-sdk/fastmcp-cli-__init__", - "python-sdk/fastmcp-cli-apps_dev", - "python-sdk/fastmcp-cli-auth", - "python-sdk/fastmcp-cli-cimd", - "python-sdk/fastmcp-cli-cli", - "python-sdk/fastmcp-cli-client", - "python-sdk/fastmcp-cli-discovery", - "python-sdk/fastmcp-cli-generate", - { - "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-gemini_cli", - "python-sdk/fastmcp-cli-install-goose", - "python-sdk/fastmcp-cli-install-mcp_json", - "python-sdk/fastmcp-cli-install-shared", - "python-sdk/fastmcp-cli-install-stdio" - ] - }, - "python-sdk/fastmcp-cli-run", - "python-sdk/fastmcp-cli-tasks" - ] - }, - { - "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" - ] - }, - "python-sdk/fastmcp-client-client", - "python-sdk/fastmcp-client-elicitation", - "python-sdk/fastmcp-client-logging", - "python-sdk/fastmcp-client-messages", - { - "group": "mixins", - "pages": [ - "python-sdk/fastmcp-client-mixins-__init__", - "python-sdk/fastmcp-client-mixins-prompts", - "python-sdk/fastmcp-client-mixins-resources", - "python-sdk/fastmcp-client-mixins-task_management", - "python-sdk/fastmcp-client-mixins-tools" - ] - }, - "python-sdk/fastmcp-client-oauth_callback", - "python-sdk/fastmcp-client-progress", - "python-sdk/fastmcp-client-roots", - { - "group": "sampling", - "pages": [ - "python-sdk/fastmcp-client-sampling-__init__", - { - "group": "handlers", - "pages": [ - "python-sdk/fastmcp-client-sampling-handlers-__init__", - "python-sdk/fastmcp-client-sampling-handlers-anthropic", - "python-sdk/fastmcp-client-sampling-handlers-google_genai", - "python-sdk/fastmcp-client-sampling-handlers-openai" - ] - } - ] - }, - "python-sdk/fastmcp-client-tasks", - "python-sdk/fastmcp-client-telemetry", - { - "group": "transports", - "pages": [ - "python-sdk/fastmcp-client-transports-__init__", - "python-sdk/fastmcp-client-transports-base", - "python-sdk/fastmcp-client-transports-config", - "python-sdk/fastmcp-client-transports-http", - "python-sdk/fastmcp-client-transports-inference", - "python-sdk/fastmcp-client-transports-memory", - "python-sdk/fastmcp-client-transports-sse", - "python-sdk/fastmcp-client-transports-stdio" - ] - } - ] - }, - { - "group": "fastmcp.experimental", - "pages": [ - "python-sdk/fastmcp-experimental-__init__", - { - "group": "sampling", - "pages": [ - "python-sdk/fastmcp-experimental-sampling-__init__", - "python-sdk/fastmcp-experimental-sampling-handlers" - ] - }, - { - "group": "transforms", - "pages": [ - "python-sdk/fastmcp-experimental-transforms-__init__", - "python-sdk/fastmcp-experimental-transforms-code_mode" - ] - } - ] - }, - { - "group": "fastmcp.prompts", - "pages": [ - "python-sdk/fastmcp-prompts-__init__", - "python-sdk/fastmcp-prompts-base", - "python-sdk/fastmcp-prompts-function_prompt" - ] - }, - { - "group": "fastmcp.resources", - "pages": [ - "python-sdk/fastmcp-resources-__init__", - "python-sdk/fastmcp-resources-base", - "python-sdk/fastmcp-resources-function_resource", - "python-sdk/fastmcp-resources-template", - "python-sdk/fastmcp-resources-types" - ] - }, - { - "group": "fastmcp.server", - "pages": [ - "python-sdk/fastmcp-server-__init__", - "python-sdk/fastmcp-server-app", - "python-sdk/fastmcp-server-apps", - { - "group": "auth", - "pages": [ - "python-sdk/fastmcp-server-auth-__init__", - "python-sdk/fastmcp-server-auth-auth", - "python-sdk/fastmcp-server-auth-authorization", - "python-sdk/fastmcp-server-auth-cimd", - "python-sdk/fastmcp-server-auth-jwt_issuer", - "python-sdk/fastmcp-server-auth-middleware", - { - "group": "oauth_proxy", - "pages": [ - "python-sdk/fastmcp-server-auth-oauth_proxy-__init__", - "python-sdk/fastmcp-server-auth-oauth_proxy-consent", - "python-sdk/fastmcp-server-auth-oauth_proxy-models", - "python-sdk/fastmcp-server-auth-oauth_proxy-proxy", - "python-sdk/fastmcp-server-auth-oauth_proxy-ui" - ] - }, - "python-sdk/fastmcp-server-auth-oidc_proxy", - { - "group": "providers", - "pages": [ - "python-sdk/fastmcp-server-auth-providers-__init__", - "python-sdk/fastmcp-server-auth-providers-auth0", - "python-sdk/fastmcp-server-auth-providers-aws", - "python-sdk/fastmcp-server-auth-providers-azure", - "python-sdk/fastmcp-server-auth-providers-clerk", - "python-sdk/fastmcp-server-auth-providers-debug", - "python-sdk/fastmcp-server-auth-providers-descope", - "python-sdk/fastmcp-server-auth-providers-discord", - "python-sdk/fastmcp-server-auth-providers-github", - "python-sdk/fastmcp-server-auth-providers-google", - "python-sdk/fastmcp-server-auth-providers-in_memory", - "python-sdk/fastmcp-server-auth-providers-introspection", - "python-sdk/fastmcp-server-auth-providers-jwt", - "python-sdk/fastmcp-server-auth-providers-oci", - "python-sdk/fastmcp-server-auth-providers-propelauth", - "python-sdk/fastmcp-server-auth-providers-scalekit", - "python-sdk/fastmcp-server-auth-providers-supabase", - "python-sdk/fastmcp-server-auth-providers-workos" - ] - }, - "python-sdk/fastmcp-server-auth-redirect_validation", - "python-sdk/fastmcp-server-auth-ssrf" - ] - }, - "python-sdk/fastmcp-server-context", - "python-sdk/fastmcp-server-dependencies", - "python-sdk/fastmcp-server-elicitation", - "python-sdk/fastmcp-server-event_store", - "python-sdk/fastmcp-server-http", - "python-sdk/fastmcp-server-lifespan", - "python-sdk/fastmcp-server-low_level", - { - "group": "middleware", - "pages": [ - "python-sdk/fastmcp-server-middleware-__init__", - "python-sdk/fastmcp-server-middleware-authorization", - "python-sdk/fastmcp-server-middleware-caching", - "python-sdk/fastmcp-server-middleware-dereference", - "python-sdk/fastmcp-server-middleware-error_handling", - "python-sdk/fastmcp-server-middleware-logging", - "python-sdk/fastmcp-server-middleware-middleware", - "python-sdk/fastmcp-server-middleware-ping", - "python-sdk/fastmcp-server-middleware-rate_limiting", - "python-sdk/fastmcp-server-middleware-response_limiting", - "python-sdk/fastmcp-server-middleware-timing", - "python-sdk/fastmcp-server-middleware-tool_injection" - ] - }, - { - "group": "mixins", - "pages": [ - "python-sdk/fastmcp-server-mixins-__init__", - "python-sdk/fastmcp-server-mixins-lifespan", - "python-sdk/fastmcp-server-mixins-mcp_operations", - "python-sdk/fastmcp-server-mixins-transport" - ] - }, - { - "group": "openapi", - "pages": [ - "python-sdk/fastmcp-server-openapi-__init__", - "python-sdk/fastmcp-server-openapi-components", - "python-sdk/fastmcp-server-openapi-routing", - "python-sdk/fastmcp-server-openapi-server" - ] - }, - { - "group": "providers", - "pages": [ - "python-sdk/fastmcp-server-providers-__init__", - "python-sdk/fastmcp-server-providers-aggregate", - "python-sdk/fastmcp-server-providers-base", - "python-sdk/fastmcp-server-providers-fastmcp_provider", - "python-sdk/fastmcp-server-providers-filesystem", - "python-sdk/fastmcp-server-providers-filesystem_discovery", - { - "group": "local_provider", - "pages": [ - "python-sdk/fastmcp-server-providers-local_provider-__init__", - { - "group": "decorators", - "pages": [ - "python-sdk/fastmcp-server-providers-local_provider-decorators-__init__", - "python-sdk/fastmcp-server-providers-local_provider-decorators-prompts", - "python-sdk/fastmcp-server-providers-local_provider-decorators-resources", - "python-sdk/fastmcp-server-providers-local_provider-decorators-tools" - ] - }, - "python-sdk/fastmcp-server-providers-local_provider-local_provider" - ] - }, - { - "group": "openapi", - "pages": [ - "python-sdk/fastmcp-server-providers-openapi-__init__", - "python-sdk/fastmcp-server-providers-openapi-components", - "python-sdk/fastmcp-server-providers-openapi-provider", - "python-sdk/fastmcp-server-providers-openapi-routing" - ] - }, - "python-sdk/fastmcp-server-providers-proxy", - { - "group": "skills", - "pages": [ - "python-sdk/fastmcp-server-providers-skills-__init__", - "python-sdk/fastmcp-server-providers-skills-claude_provider", - "python-sdk/fastmcp-server-providers-skills-directory_provider", - "python-sdk/fastmcp-server-providers-skills-skill_provider", - "python-sdk/fastmcp-server-providers-skills-vendor_providers" - ] - }, - "python-sdk/fastmcp-server-providers-wrapped_provider" - ] - }, - "python-sdk/fastmcp-server-proxy", - { - "group": "sampling", - "pages": [ - "python-sdk/fastmcp-server-sampling-__init__", - "python-sdk/fastmcp-server-sampling-run", - "python-sdk/fastmcp-server-sampling-sampling_tool" - ] - }, - "python-sdk/fastmcp-server-server", - { - "group": "tasks", - "pages": [ - "python-sdk/fastmcp-server-tasks-__init__", - "python-sdk/fastmcp-server-tasks-capabilities", - "python-sdk/fastmcp-server-tasks-config", - "python-sdk/fastmcp-server-tasks-elicitation", - "python-sdk/fastmcp-server-tasks-handlers", - "python-sdk/fastmcp-server-tasks-keys", - "python-sdk/fastmcp-server-tasks-notifications", - "python-sdk/fastmcp-server-tasks-requests", - "python-sdk/fastmcp-server-tasks-routing", - "python-sdk/fastmcp-server-tasks-subscriptions" - ] - }, - "python-sdk/fastmcp-server-telemetry", - { - "group": "transforms", - "pages": [ - "python-sdk/fastmcp-server-transforms-__init__", - "python-sdk/fastmcp-server-transforms-catalog", - "python-sdk/fastmcp-server-transforms-namespace", - "python-sdk/fastmcp-server-transforms-prompts_as_tools", - "python-sdk/fastmcp-server-transforms-resources_as_tools", - { - "group": "search", - "pages": [ - "python-sdk/fastmcp-server-transforms-search-__init__", - "python-sdk/fastmcp-server-transforms-search-base", - "python-sdk/fastmcp-server-transforms-search-bm25", - "python-sdk/fastmcp-server-transforms-search-regex" - ] - }, - "python-sdk/fastmcp-server-transforms-tool_transform", - "python-sdk/fastmcp-server-transforms-version_filter", - "python-sdk/fastmcp-server-transforms-visibility" - ] - } - ] - }, - { - "group": "fastmcp.tools", - "pages": [ - "python-sdk/fastmcp-tools-__init__", - "python-sdk/fastmcp-tools-base", - "python-sdk/fastmcp-tools-function_parsing", - "python-sdk/fastmcp-tools-function_tool", - "python-sdk/fastmcp-tools-tool_transform" - ] - }, - { - "group": "fastmcp.utilities", - "pages": [ - "python-sdk/fastmcp-utilities-__init__", - "python-sdk/fastmcp-utilities-async_utils", - "python-sdk/fastmcp-utilities-auth", - "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-lifespan", - "python-sdk/fastmcp-utilities-logging", - { - "group": "mcp_server_config", - "pages": [ - "python-sdk/fastmcp-utilities-mcp_server_config-__init__", - { - "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", - "pages": [ - "python-sdk/fastmcp-utilities-mcp_server_config-v1-sources-__init__", - "python-sdk/fastmcp-utilities-mcp_server_config-v1-sources-base", - "python-sdk/fastmcp-utilities-mcp_server_config-v1-sources-filesystem" - ] - } - ] - } - ] - }, - "python-sdk/fastmcp-utilities-mime", - { - "group": "openapi", - "pages": [ - "python-sdk/fastmcp-utilities-openapi-__init__", - "python-sdk/fastmcp-utilities-openapi-director", - "python-sdk/fastmcp-utilities-openapi-formatters", - "python-sdk/fastmcp-utilities-openapi-json_schema_converter", - "python-sdk/fastmcp-utilities-openapi-models", - "python-sdk/fastmcp-utilities-openapi-parser", - "python-sdk/fastmcp-utilities-openapi-schemas" - ] - }, - "python-sdk/fastmcp-utilities-pagination", - "python-sdk/fastmcp-utilities-skills", - "python-sdk/fastmcp-utilities-tests", - "python-sdk/fastmcp-utilities-timeout", - "python-sdk/fastmcp-utilities-token_cache", - "python-sdk/fastmcp-utilities-types", - "python-sdk/fastmcp-utilities-ui", - "python-sdk/fastmcp-utilities-version_check", - "python-sdk/fastmcp-utilities-versions" - ] - } - ] + "pages": { + "$ref": "./python-sdk-pages.json" + } } ], "dropdown": "SDK Reference", diff --git a/docs/python-sdk-pages.json b/docs/python-sdk-pages.json new file mode 100644 index 000000000..209f75633 --- /dev/null +++ b/docs/python-sdk-pages.json @@ -0,0 +1,421 @@ +[ + "python-sdk/fastmcp-decorators", + "python-sdk/fastmcp-dependencies", + "python-sdk/fastmcp-exceptions", + "python-sdk/fastmcp-mcp_config", + "python-sdk/fastmcp-settings", + "python-sdk/fastmcp-telemetry", + "python-sdk/fastmcp-types", + { + "group": "fastmcp.apps", + "pages": [ + "python-sdk/fastmcp-apps-__init__", + "python-sdk/fastmcp-apps-app", + "python-sdk/fastmcp-apps-approval", + "python-sdk/fastmcp-apps-choice", + "python-sdk/fastmcp-apps-config", + "python-sdk/fastmcp-apps-file_upload", + "python-sdk/fastmcp-apps-form", + "python-sdk/fastmcp-apps-generative" + ] + }, + { + "group": "fastmcp.cli", + "pages": [ + "python-sdk/fastmcp-cli-__init__", + "python-sdk/fastmcp-cli-apps_dev", + "python-sdk/fastmcp-cli-auth", + "python-sdk/fastmcp-cli-cimd", + "python-sdk/fastmcp-cli-cli", + "python-sdk/fastmcp-cli-client", + "python-sdk/fastmcp-cli-discovery", + "python-sdk/fastmcp-cli-generate", + { + "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-gemini_cli", + "python-sdk/fastmcp-cli-install-goose", + "python-sdk/fastmcp-cli-install-mcp_json", + "python-sdk/fastmcp-cli-install-shared", + "python-sdk/fastmcp-cli-install-stdio" + ] + }, + "python-sdk/fastmcp-cli-run", + "python-sdk/fastmcp-cli-tasks" + ] + }, + { + "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" + ] + }, + "python-sdk/fastmcp-client-client", + "python-sdk/fastmcp-client-elicitation", + "python-sdk/fastmcp-client-logging", + "python-sdk/fastmcp-client-messages", + { + "group": "mixins", + "pages": [ + "python-sdk/fastmcp-client-mixins-__init__", + "python-sdk/fastmcp-client-mixins-prompts", + "python-sdk/fastmcp-client-mixins-resources", + "python-sdk/fastmcp-client-mixins-task_management", + "python-sdk/fastmcp-client-mixins-tools" + ] + }, + "python-sdk/fastmcp-client-oauth_callback", + "python-sdk/fastmcp-client-progress", + "python-sdk/fastmcp-client-roots", + { + "group": "sampling", + "pages": [ + "python-sdk/fastmcp-client-sampling-__init__", + { + "group": "handlers", + "pages": [ + "python-sdk/fastmcp-client-sampling-handlers-__init__", + "python-sdk/fastmcp-client-sampling-handlers-anthropic", + "python-sdk/fastmcp-client-sampling-handlers-google_genai", + "python-sdk/fastmcp-client-sampling-handlers-openai" + ] + } + ] + }, + "python-sdk/fastmcp-client-tasks", + "python-sdk/fastmcp-client-telemetry", + { + "group": "transports", + "pages": [ + "python-sdk/fastmcp-client-transports-__init__", + "python-sdk/fastmcp-client-transports-base", + "python-sdk/fastmcp-client-transports-config", + "python-sdk/fastmcp-client-transports-http", + "python-sdk/fastmcp-client-transports-inference", + "python-sdk/fastmcp-client-transports-memory", + "python-sdk/fastmcp-client-transports-sse", + "python-sdk/fastmcp-client-transports-stdio" + ] + } + ] + }, + { + "group": "fastmcp.experimental", + "pages": [ + "python-sdk/fastmcp-experimental-__init__", + { + "group": "sampling", + "pages": [ + "python-sdk/fastmcp-experimental-sampling-__init__", + "python-sdk/fastmcp-experimental-sampling-handlers" + ] + }, + { + "group": "transforms", + "pages": [ + "python-sdk/fastmcp-experimental-transforms-__init__", + "python-sdk/fastmcp-experimental-transforms-code_mode" + ] + } + ] + }, + { + "group": "fastmcp.prompts", + "pages": [ + "python-sdk/fastmcp-prompts-__init__", + "python-sdk/fastmcp-prompts-base", + "python-sdk/fastmcp-prompts-function_prompt" + ] + }, + { + "group": "fastmcp.resources", + "pages": [ + "python-sdk/fastmcp-resources-__init__", + "python-sdk/fastmcp-resources-base", + "python-sdk/fastmcp-resources-function_resource", + "python-sdk/fastmcp-resources-template", + "python-sdk/fastmcp-resources-types" + ] + }, + { + "group": "fastmcp.server", + "pages": [ + "python-sdk/fastmcp-server-__init__", + "python-sdk/fastmcp-server-app", + "python-sdk/fastmcp-server-apps", + { + "group": "auth", + "pages": [ + "python-sdk/fastmcp-server-auth-__init__", + "python-sdk/fastmcp-server-auth-auth", + "python-sdk/fastmcp-server-auth-authorization", + "python-sdk/fastmcp-server-auth-cimd", + "python-sdk/fastmcp-server-auth-jwt_issuer", + "python-sdk/fastmcp-server-auth-middleware", + { + "group": "oauth_proxy", + "pages": [ + "python-sdk/fastmcp-server-auth-oauth_proxy-__init__", + "python-sdk/fastmcp-server-auth-oauth_proxy-consent", + "python-sdk/fastmcp-server-auth-oauth_proxy-models", + "python-sdk/fastmcp-server-auth-oauth_proxy-proxy", + "python-sdk/fastmcp-server-auth-oauth_proxy-ui" + ] + }, + "python-sdk/fastmcp-server-auth-oidc_proxy", + { + "group": "providers", + "pages": [ + "python-sdk/fastmcp-server-auth-providers-__init__", + "python-sdk/fastmcp-server-auth-providers-auth0", + "python-sdk/fastmcp-server-auth-providers-aws", + "python-sdk/fastmcp-server-auth-providers-azure", + "python-sdk/fastmcp-server-auth-providers-clerk", + "python-sdk/fastmcp-server-auth-providers-debug", + "python-sdk/fastmcp-server-auth-providers-descope", + "python-sdk/fastmcp-server-auth-providers-discord", + "python-sdk/fastmcp-server-auth-providers-github", + "python-sdk/fastmcp-server-auth-providers-google", + "python-sdk/fastmcp-server-auth-providers-in_memory", + "python-sdk/fastmcp-server-auth-providers-introspection", + "python-sdk/fastmcp-server-auth-providers-jwt", + "python-sdk/fastmcp-server-auth-providers-oci", + "python-sdk/fastmcp-server-auth-providers-propelauth", + "python-sdk/fastmcp-server-auth-providers-scalekit", + "python-sdk/fastmcp-server-auth-providers-supabase", + "python-sdk/fastmcp-server-auth-providers-workos" + ] + }, + "python-sdk/fastmcp-server-auth-redirect_validation", + "python-sdk/fastmcp-server-auth-ssrf" + ] + }, + "python-sdk/fastmcp-server-context", + "python-sdk/fastmcp-server-dependencies", + "python-sdk/fastmcp-server-elicitation", + "python-sdk/fastmcp-server-event_store", + "python-sdk/fastmcp-server-http", + "python-sdk/fastmcp-server-lifespan", + "python-sdk/fastmcp-server-low_level", + { + "group": "middleware", + "pages": [ + "python-sdk/fastmcp-server-middleware-__init__", + "python-sdk/fastmcp-server-middleware-authorization", + "python-sdk/fastmcp-server-middleware-caching", + "python-sdk/fastmcp-server-middleware-dereference", + "python-sdk/fastmcp-server-middleware-error_handling", + "python-sdk/fastmcp-server-middleware-logging", + "python-sdk/fastmcp-server-middleware-middleware", + "python-sdk/fastmcp-server-middleware-ping", + "python-sdk/fastmcp-server-middleware-rate_limiting", + "python-sdk/fastmcp-server-middleware-response_limiting", + "python-sdk/fastmcp-server-middleware-timing", + "python-sdk/fastmcp-server-middleware-tool_injection" + ] + }, + { + "group": "mixins", + "pages": [ + "python-sdk/fastmcp-server-mixins-__init__", + "python-sdk/fastmcp-server-mixins-lifespan", + "python-sdk/fastmcp-server-mixins-mcp_operations", + "python-sdk/fastmcp-server-mixins-transport" + ] + }, + { + "group": "openapi", + "pages": [ + "python-sdk/fastmcp-server-openapi-__init__", + "python-sdk/fastmcp-server-openapi-components", + "python-sdk/fastmcp-server-openapi-routing", + "python-sdk/fastmcp-server-openapi-server" + ] + }, + { + "group": "providers", + "pages": [ + "python-sdk/fastmcp-server-providers-__init__", + "python-sdk/fastmcp-server-providers-aggregate", + "python-sdk/fastmcp-server-providers-base", + "python-sdk/fastmcp-server-providers-fastmcp_provider", + "python-sdk/fastmcp-server-providers-filesystem", + "python-sdk/fastmcp-server-providers-filesystem_discovery", + { + "group": "local_provider", + "pages": [ + "python-sdk/fastmcp-server-providers-local_provider-__init__", + { + "group": "decorators", + "pages": [ + "python-sdk/fastmcp-server-providers-local_provider-decorators-__init__", + "python-sdk/fastmcp-server-providers-local_provider-decorators-prompts", + "python-sdk/fastmcp-server-providers-local_provider-decorators-resources", + "python-sdk/fastmcp-server-providers-local_provider-decorators-tools" + ] + }, + "python-sdk/fastmcp-server-providers-local_provider-local_provider" + ] + }, + { + "group": "openapi", + "pages": [ + "python-sdk/fastmcp-server-providers-openapi-__init__", + "python-sdk/fastmcp-server-providers-openapi-components", + "python-sdk/fastmcp-server-providers-openapi-provider", + "python-sdk/fastmcp-server-providers-openapi-routing" + ] + }, + "python-sdk/fastmcp-server-providers-proxy", + { + "group": "skills", + "pages": [ + "python-sdk/fastmcp-server-providers-skills-__init__", + "python-sdk/fastmcp-server-providers-skills-claude_provider", + "python-sdk/fastmcp-server-providers-skills-directory_provider", + "python-sdk/fastmcp-server-providers-skills-skill_provider", + "python-sdk/fastmcp-server-providers-skills-vendor_providers" + ] + }, + "python-sdk/fastmcp-server-providers-wrapped_provider" + ] + }, + "python-sdk/fastmcp-server-proxy", + { + "group": "sampling", + "pages": [ + "python-sdk/fastmcp-server-sampling-__init__", + "python-sdk/fastmcp-server-sampling-run", + "python-sdk/fastmcp-server-sampling-sampling_tool" + ] + }, + "python-sdk/fastmcp-server-server", + { + "group": "tasks", + "pages": [ + "python-sdk/fastmcp-server-tasks-__init__", + "python-sdk/fastmcp-server-tasks-capabilities", + "python-sdk/fastmcp-server-tasks-config", + "python-sdk/fastmcp-server-tasks-elicitation", + "python-sdk/fastmcp-server-tasks-handlers", + "python-sdk/fastmcp-server-tasks-keys", + "python-sdk/fastmcp-server-tasks-notifications", + "python-sdk/fastmcp-server-tasks-requests", + "python-sdk/fastmcp-server-tasks-routing", + "python-sdk/fastmcp-server-tasks-subscriptions" + ] + }, + "python-sdk/fastmcp-server-telemetry", + { + "group": "transforms", + "pages": [ + "python-sdk/fastmcp-server-transforms-__init__", + "python-sdk/fastmcp-server-transforms-catalog", + "python-sdk/fastmcp-server-transforms-namespace", + "python-sdk/fastmcp-server-transforms-prompts_as_tools", + "python-sdk/fastmcp-server-transforms-resources_as_tools", + { + "group": "search", + "pages": [ + "python-sdk/fastmcp-server-transforms-search-__init__", + "python-sdk/fastmcp-server-transforms-search-base", + "python-sdk/fastmcp-server-transforms-search-bm25", + "python-sdk/fastmcp-server-transforms-search-regex" + ] + }, + "python-sdk/fastmcp-server-transforms-tool_transform", + "python-sdk/fastmcp-server-transforms-version_filter", + "python-sdk/fastmcp-server-transforms-visibility" + ] + } + ] + }, + { + "group": "fastmcp.tools", + "pages": [ + "python-sdk/fastmcp-tools-__init__", + "python-sdk/fastmcp-tools-base", + "python-sdk/fastmcp-tools-function_parsing", + "python-sdk/fastmcp-tools-function_tool", + "python-sdk/fastmcp-tools-tool_transform" + ] + }, + { + "group": "fastmcp.utilities", + "pages": [ + "python-sdk/fastmcp-utilities-__init__", + "python-sdk/fastmcp-utilities-async_utils", + "python-sdk/fastmcp-utilities-auth", + "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-lifespan", + "python-sdk/fastmcp-utilities-logging", + { + "group": "mcp_server_config", + "pages": [ + "python-sdk/fastmcp-utilities-mcp_server_config-__init__", + { + "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", + "pages": [ + "python-sdk/fastmcp-utilities-mcp_server_config-v1-sources-__init__", + "python-sdk/fastmcp-utilities-mcp_server_config-v1-sources-base", + "python-sdk/fastmcp-utilities-mcp_server_config-v1-sources-filesystem" + ] + } + ] + } + ] + }, + "python-sdk/fastmcp-utilities-mime", + { + "group": "openapi", + "pages": [ + "python-sdk/fastmcp-utilities-openapi-__init__", + "python-sdk/fastmcp-utilities-openapi-director", + "python-sdk/fastmcp-utilities-openapi-formatters", + "python-sdk/fastmcp-utilities-openapi-json_schema_converter", + "python-sdk/fastmcp-utilities-openapi-models", + "python-sdk/fastmcp-utilities-openapi-parser", + "python-sdk/fastmcp-utilities-openapi-schemas" + ] + }, + "python-sdk/fastmcp-utilities-pagination", + "python-sdk/fastmcp-utilities-skills", + "python-sdk/fastmcp-utilities-tests", + "python-sdk/fastmcp-utilities-timeout", + "python-sdk/fastmcp-utilities-token_cache", + "python-sdk/fastmcp-utilities-types", + "python-sdk/fastmcp-utilities-ui", + "python-sdk/fastmcp-utilities-version_check", + "python-sdk/fastmcp-utilities-versions" + ] + } +] diff --git a/docs/python-sdk/fastmcp-cli-apps_dev.mdx b/docs/python-sdk/fastmcp-cli-apps_dev.mdx index 2f38bbc5b..2cbe0fd3e 100644 --- a/docs/python-sdk/fastmcp-cli-apps_dev.mdx +++ b/docs/python-sdk/fastmcp-cli-apps_dev.mdx @@ -32,7 +32,7 @@ Startup sequence ## Functions -### `run_dev_apps` +### `run_dev_apps` ```python run_dev_apps(server_spec: str) -> None diff --git a/docs/python-sdk/fastmcp-prompts-function_prompt.mdx b/docs/python-sdk/fastmcp-prompts-function_prompt.mdx index 92f369d78..191e36816 100644 --- a/docs/python-sdk/fastmcp-prompts-function_prompt.mdx +++ b/docs/python-sdk/fastmcp-prompts-function_prompt.mdx @@ -10,7 +10,7 @@ Standalone @prompt decorator for FastMCP. ## Functions -### `prompt` +### `prompt` ```python prompt(name_or_fn: str | Callable[..., Any] | None = None) -> Any @@ -83,11 +83,8 @@ register_with_docket(self, docket: Docket) -> None Register this prompt with docket for background execution. -FunctionPrompt registers the underlying function, which has the user's -Depends parameters for docket to resolve. - -#### `add_to_docket` +#### `add_to_docket` ```python add_to_docket(self, docket: Docket, arguments: dict[str, Any] | None, **kwargs: Any) -> Execution diff --git a/docs/python-sdk/fastmcp-resources-function_resource.mdx b/docs/python-sdk/fastmcp-resources-function_resource.mdx index 4977f0d58..28f08a580 100644 --- a/docs/python-sdk/fastmcp-resources-function_resource.mdx +++ b/docs/python-sdk/fastmcp-resources-function_resource.mdx @@ -10,7 +10,7 @@ Standalone @resource decorator for FastMCP. ## Functions -### `resource` +### `resource` ```python resource(uri: str) -> Callable[[F], F] @@ -88,6 +88,3 @@ register_with_docket(self, docket: Docket) -> None Register this resource with docket for background execution. -FunctionResource registers the underlying function, which has the user's -Depends parameters for docket to resolve. - diff --git a/docs/python-sdk/fastmcp-resources-template.mdx b/docs/python-sdk/fastmcp-resources-template.mdx index 06d8ef8ed..540866c5a 100644 --- a/docs/python-sdk/fastmcp-resources-template.mdx +++ b/docs/python-sdk/fastmcp-resources-template.mdx @@ -215,11 +215,8 @@ register_with_docket(self, docket: Docket) -> None Register this template with docket for background execution. -FunctionResourceTemplate registers the underlying function, which has the -user's Depends parameters for docket to resolve. - -#### `add_to_docket` +#### `add_to_docket` ```python add_to_docket(self, docket: Docket, params: dict[str, Any], **kwargs: Any) -> Execution @@ -237,7 +234,7 @@ FunctionResourceTemplate splats the params dict since .fn expects **kwargs. - `**kwargs`: Additional kwargs passed to docket.add() -#### `from_function` +#### `from_function` ```python from_function(cls, fn: Callable[..., Any], uri_template: str, name: str | None = None, version: str | int | None = None, title: str | None = None, description: str | None = None, icons: list[Icon] | None = None, mime_type: str | None = None, tags: set[str] | None = None, annotations: Annotations | None = None, meta: dict[str, Any] | None = None, task: bool | TaskConfig | None = None, auth: AuthCheck | list[AuthCheck] | None = None) -> FunctionResourceTemplate diff --git a/docs/python-sdk/fastmcp-server-context.mdx b/docs/python-sdk/fastmcp-server-context.mdx index 78371e393..396e16c50 100644 --- a/docs/python-sdk/fastmcp-server-context.mdx +++ b/docs/python-sdk/fastmcp-server-context.mdx @@ -145,7 +145,7 @@ fastmcp(self) -> FastMCP Get the FastMCP instance. -#### `request_context` +#### `request_context` ```python request_context(self) -> RequestContext[ServerSession, Any, Request] | None @@ -174,7 +174,7 @@ async def on_request(self, context, call_next): ``` -#### `lifespan_context` +#### `lifespan_context` ```python lifespan_context(self) -> dict[str, Any] @@ -201,7 +201,7 @@ def my_tool(ctx: Context) -> str: ``` -#### `report_progress` +#### `report_progress` ```python report_progress(self, progress: float, total: float | None = None, message: str | None = None) -> None @@ -218,7 +218,7 @@ Works in both foreground (MCP progress notifications) and background - `message`: Optional status message describing current progress -#### `list_resources` +#### `list_resources` ```python list_resources(self) -> list[SDKResource] @@ -230,7 +230,7 @@ List all available resources from the server. - List of Resource objects available on the server -#### `list_prompts` +#### `list_prompts` ```python list_prompts(self) -> list[SDKPrompt] @@ -242,7 +242,7 @@ List all available prompts from the server. - List of Prompt objects available on the server -#### `get_prompt` +#### `get_prompt` ```python get_prompt(self, name: str, arguments: dict[str, Any] | None = None) -> GetPromptResult @@ -258,7 +258,7 @@ Get a prompt by name with optional arguments. - The prompt result -#### `read_resource` +#### `read_resource` ```python read_resource(self, uri: str | AnyUrl) -> ResourceResult @@ -273,7 +273,7 @@ Read a resource by URI. - ResourceResult with contents -#### `log` +#### `log` ```python log(self, message: str, level: LoggingLevel | None = None, logger_name: str | None = None, extra: Mapping[str, Any] | None = None) -> None @@ -291,7 +291,7 @@ Messages sent to Clients are also logged to the `fastmcp.server.context.to_clien - `extra`: Optional mapping for additional arguments -#### `transport` +#### `transport` ```python transport(self) -> TransportType | None @@ -303,7 +303,7 @@ Returns the transport type used to run this server: "stdio", "sse", or "streamable-http". Returns None if called outside of a server context. -#### `client_supports_extension` +#### `client_supports_extension` ```python client_supports_extension(self, extension_id: str) -> bool @@ -328,7 +328,7 @@ Example:: return "text-only client" -#### `client_id` +#### `client_id` ```python client_id(self) -> str | None @@ -337,7 +337,7 @@ client_id(self) -> str | None Get the client ID if available. -#### `request_id` +#### `request_id` ```python request_id(self) -> str @@ -348,7 +348,7 @@ Get the unique ID for this request. Raises RuntimeError if MCP request context is not available. -#### `session_id` +#### `session_id` ```python session_id(self) -> str @@ -365,7 +365,7 @@ the same client session. - for other transports. -#### `session` +#### `session` ```python session(self) -> ServerSession @@ -379,7 +379,7 @@ In background task mode: Returns the session stored at Context creation. Raises RuntimeError if no session is available. -#### `debug` +#### `debug` ```python debug(self, message: str, logger_name: str | None = None, extra: Mapping[str, Any] | None = None) -> None @@ -390,7 +390,7 @@ Send a `DEBUG`-level message to the connected MCP Client. Messages sent to Clients are also logged to the `fastmcp.server.context.to_client` logger with a level of `DEBUG`. -#### `info` +#### `info` ```python info(self, message: str, logger_name: str | None = None, extra: Mapping[str, Any] | None = None) -> None @@ -401,7 +401,7 @@ Send a `INFO`-level message to the connected MCP Client. Messages sent to Clients are also logged to the `fastmcp.server.context.to_client` logger with a level of `DEBUG`. -#### `warning` +#### `warning` ```python warning(self, message: str, logger_name: str | None = None, extra: Mapping[str, Any] | None = None) -> None @@ -412,7 +412,7 @@ Send a `WARNING`-level message to the connected MCP Client. Messages sent to Clients are also logged to the `fastmcp.server.context.to_client` logger with a level of `DEBUG`. -#### `error` +#### `error` ```python error(self, message: str, logger_name: str | None = None, extra: Mapping[str, Any] | None = None) -> None @@ -423,7 +423,7 @@ Send a `ERROR`-level message to the connected MCP Client. Messages sent to Clients are also logged to the `fastmcp.server.context.to_client` logger with a level of `DEBUG`. -#### `list_roots` +#### `list_roots` ```python list_roots(self) -> list[Root] @@ -432,7 +432,7 @@ list_roots(self) -> list[Root] List the roots available to the server, as indicated by the client. -#### `send_notification` +#### `send_notification` ```python send_notification(self, notification: mcp.types.ServerNotificationType) -> None @@ -444,7 +444,7 @@ Send a notification to the client immediately. - `notification`: An MCP notification instance (e.g., ToolListChangedNotification()) -#### `close_sse_stream` +#### `close_sse_stream` ```python close_sse_stream(self) -> None @@ -462,7 +462,7 @@ Instead of holding a connection open for minutes, you can periodically close and let the client reconnect. -#### `sample_step` +#### `sample_step` ```python sample_step(self, messages: str | Sequence[str | SamplingMessage]) -> SampleStep @@ -505,7 +505,7 @@ regardless of this setting. - - .text: The text content (if any) -#### `sample` +#### `sample` ```python sample(self, messages: str | Sequence[str | SamplingMessage]) -> SamplingResult[ResultT] @@ -514,7 +514,7 @@ sample(self, messages: str | Sequence[str | SamplingMessage]) -> SamplingResult[ Overload: With result_type, returns SamplingResult[ResultT]. -#### `sample` +#### `sample` ```python sample(self, messages: str | Sequence[str | SamplingMessage]) -> SamplingResult[str] @@ -523,7 +523,7 @@ sample(self, messages: str | Sequence[str | SamplingMessage]) -> SamplingResult[ Overload: Without result_type, returns SamplingResult[str]. -#### `sample` +#### `sample` ```python sample(self, messages: str | Sequence[str | SamplingMessage]) -> SamplingResult[ResultT] | SamplingResult[str] @@ -571,43 +571,43 @@ regardless of this setting. - - .history: All messages exchanged during sampling -#### `elicit` +#### `elicit` ```python elicit(self, message: str, response_type: None) -> AcceptedElicitation[dict[str, Any]] | DeclinedElicitation | CancelledElicitation ``` -#### `elicit` +#### `elicit` ```python elicit(self, message: str, response_type: type[T]) -> AcceptedElicitation[T] | DeclinedElicitation | CancelledElicitation ``` -#### `elicit` +#### `elicit` ```python elicit(self, message: str, response_type: list[str]) -> AcceptedElicitation[str] | DeclinedElicitation | CancelledElicitation ``` -#### `elicit` +#### `elicit` ```python elicit(self, message: str, response_type: dict[str, dict[str, str]]) -> AcceptedElicitation[str] | DeclinedElicitation | CancelledElicitation ``` -#### `elicit` +#### `elicit` ```python elicit(self, message: str, response_type: list[list[str]]) -> AcceptedElicitation[list[str]] | DeclinedElicitation | CancelledElicitation ``` -#### `elicit` +#### `elicit` ```python elicit(self, message: str, response_type: list[dict[str, dict[str, str]]]) -> AcceptedElicitation[list[str]] | DeclinedElicitation | CancelledElicitation ``` -#### `elicit` +#### `elicit` ```python elicit(self, message: str, response_type: type[T] | list[str] | dict[str, dict[str, str]] | list[list[str]] | list[dict[str, dict[str, str]]] | None = None) -> AcceptedElicitation[T] | AcceptedElicitation[dict[str, Any]] | AcceptedElicitation[str] | AcceptedElicitation[list[str]] | DeclinedElicitation | CancelledElicitation @@ -636,7 +636,7 @@ type or dataclass or BaseModel. If it is a primitive type, an object schema with a single "value" field will be generated. -#### `set_state` +#### `set_state` ```python set_state(self, key: str, value: Any) -> None @@ -657,7 +657,7 @@ requests. The key is automatically prefixed with the session identifier. -#### `get_state` +#### `get_state` ```python get_state(self, key: str) -> Any @@ -671,7 +671,7 @@ then falls back to the session-scoped state store. Returns None if the key is not found. -#### `delete_state` +#### `delete_state` ```python delete_state(self, key: str) -> None @@ -682,7 +682,7 @@ Delete a value from the state store. Removes from both request-scoped and session-scoped stores. -#### `enable_components` +#### `enable_components` ```python enable_components(self) -> None @@ -706,7 +706,7 @@ ResourceListChangedNotification, and PromptListChangedNotification. - `match_all`: If True, matches all components regardless of other criteria. -#### `disable_components` +#### `disable_components` ```python disable_components(self) -> None @@ -730,7 +730,7 @@ ResourceListChangedNotification, and PromptListChangedNotification. - `match_all`: If True, matches all components regardless of other criteria. -#### `reset_visibility` +#### `reset_visibility` ```python reset_visibility(self) -> None diff --git a/docs/python-sdk/fastmcp-server-dependencies.mdx b/docs/python-sdk/fastmcp-server-dependencies.mdx index 80b9f8421..1085b23da 100644 --- a/docs/python-sdk/fastmcp-server-dependencies.mdx +++ b/docs/python-sdk/fastmcp-server-dependencies.mdx @@ -15,7 +15,7 @@ CurrentWorker) and background task execution require fastmcp[tasks]. ## Functions -### `get_task_context` +### `get_task_context` ```python get_task_context() -> TaskContextInfo | None @@ -31,7 +31,7 @@ Returns None if not running in a task context (e.g., foreground execution). - TaskContextInfo with task_id and session_id, or None if not in a task. -### `register_task_session` +### `register_task_session` ```python register_task_session(session_id: str, session: ServerSession) -> None @@ -49,7 +49,7 @@ client disconnects. - `session`: The ServerSession instance -### `get_task_session` +### `get_task_session` ```python get_task_session(session_id: str) -> ServerSession | None @@ -65,7 +65,7 @@ Get a registered session by ID if still alive. - The ServerSession if found and alive, None otherwise -### `register_task_server` +### `register_task_server` ```python register_task_server(task_id: str, server: FastMCP) -> None @@ -82,7 +82,7 @@ The map is bounded to avoid unbounded growth in long-lived servers. Evicted entries fall back to the ContextVar (parent server). -### `is_docket_available` +### `is_docket_available` ```python is_docket_available() -> bool @@ -92,7 +92,7 @@ is_docket_available() -> bool Check if pydocket is installed. -### `require_docket` +### `require_docket` ```python require_docket(feature: str) -> None @@ -106,7 +106,7 @@ Raise ImportError with install instructions if docket not available. "CurrentDocket()"). Will be included in the error message. -### `transform_context_annotations` +### `transform_context_annotations` ```python transform_context_annotations(fn: Callable[..., Any]) -> Callable[..., Any] @@ -132,7 +132,7 @@ allows them to have defaults in any order. - Function with modified signature (same function object, updated __signature__) -### `get_context` +### `get_context` ```python get_context() -> Context @@ -142,7 +142,7 @@ get_context() -> Context Get the current FastMCP Context instance directly. -### `get_server` +### `get_server` ```python get_server() -> FastMCP @@ -162,7 +162,7 @@ started the worker). - `RuntimeError`: If no server in context -### `get_http_request` +### `get_http_request` ```python get_http_request() -> Request @@ -176,7 +176,7 @@ In background tasks, returns a synthetic request populated with the snapshotted headers from the originating HTTP request. -### `get_http_headers` +### `get_http_headers` ```python get_http_headers(include_all: bool = False, include: set[str] | None = None) -> dict[str, str] @@ -197,7 +197,7 @@ normally be excluded. This is useful for proxy transports that need to forward authorization headers to upstream MCP servers. -### `get_access_token` +### `get_access_token` ```python get_access_token() -> AccessToken | None @@ -216,7 +216,7 @@ token snapshot stored in Redis at task submission time. - The access token if an authenticated user is available, None otherwise. -### `without_injected_parameters` +### `without_injected_parameters` ```python without_injected_parameters(fn: Callable[..., Any]) -> Callable[..., Any] @@ -241,7 +241,7 @@ Handles: - Async wrapper function without injected parameters -### `resolve_dependencies` +### `resolve_dependencies` ```python resolve_dependencies(fn: Callable[..., Any], arguments: dict[str, Any]) -> AsyncGenerator[dict[str, Any], None] @@ -267,7 +267,7 @@ time, so all injection goes through the unified DI system. which will be filtered out) -### `CurrentContext` +### `CurrentContext` ```python CurrentContext() -> Context @@ -286,7 +286,7 @@ current MCP operation (tool/resource/prompt call). - `RuntimeError`: If no active context found (during resolution) -### `OptionalCurrentContext` +### `OptionalCurrentContext` ```python OptionalCurrentContext() -> Context | None @@ -296,7 +296,7 @@ OptionalCurrentContext() -> Context | None Get the current FastMCP Context, or None when no context is active. -### `CurrentDocket` +### `CurrentDocket` ```python CurrentDocket() -> Docket @@ -316,7 +316,7 @@ automatically creates for background task scheduling. - `ImportError`: If fastmcp[tasks] not installed -### `CurrentWorker` +### `CurrentWorker` ```python CurrentWorker() -> Worker @@ -336,7 +336,7 @@ automatically creates for background task processing. - `ImportError`: If fastmcp[tasks] not installed -### `CurrentFastMCP` +### `CurrentFastMCP` ```python CurrentFastMCP() -> FastMCP @@ -354,7 +354,7 @@ This dependency provides access to the active FastMCP server. - `RuntimeError`: If no server in context (during resolution) -### `CurrentRequest` +### `CurrentRequest` ```python CurrentRequest() -> Request @@ -374,7 +374,7 @@ current HTTP request. Only available when running over HTTP transports - `RuntimeError`: If no HTTP request in context (e.g., STDIO transport) -### `CurrentHeaders` +### `CurrentHeaders` ```python CurrentHeaders() -> dict[str, str] @@ -392,7 +392,7 @@ transport. - A dependency that resolves to a dictionary of header name -> value -### `CurrentAccessToken` +### `CurrentAccessToken` ```python CurrentAccessToken() -> AccessToken @@ -411,7 +411,7 @@ authenticated request. Raises an error if no authentication is present. - `RuntimeError`: If no authenticated user (use get_access_token() for optional) -### `TokenClaim` +### `TokenClaim` ```python TokenClaim(name: str) -> str @@ -436,7 +436,7 @@ without needing the full token object. ## Classes -### `TaskContextInfo` +### `TaskContextInfo` Information about the current background task context. @@ -445,7 +445,53 @@ Returned by ``get_task_context()`` when running inside a Docket worker. Contains identifiers needed to communicate with the MCP session. -### `ProgressLike` +### `TaskContextSnapshot` + + +All context data snapshotted at task-submission time. + +Stored as a single Redis key per task, restored once in the worker. + + +**Methods:** + +#### `capture` + +```python +capture(cls) -> TaskContextSnapshot +``` + +Capture current context for background task execution. + + +#### `from_json` + +```python +from_json(cls, raw: str | bytes) -> TaskContextSnapshot +``` + +Deserialize from JSON stored in Redis. + + +#### `to_json` + +```python +to_json(self) -> str +``` + +Serialize to JSON for Redis storage. + + +#### `save` + +```python +save(self, docket: Docket, session_id: str, task_id: str, ttl_seconds: int) -> None +``` + +Store this snapshot as a single Redis key. + + +### `ProgressLike` Protocol for progress tracking interface. @@ -456,7 +502,7 @@ and Docket's Progress (worker context). **Methods:** -#### `current` +#### `current` ```python current(self) -> int | None @@ -465,7 +511,7 @@ current(self) -> int | None Current progress value. -#### `total` +#### `total` ```python total(self) -> int @@ -474,7 +520,7 @@ total(self) -> int Total/target progress value. -#### `message` +#### `message` ```python message(self) -> str | None @@ -483,7 +529,7 @@ message(self) -> str | None Current progress message. -#### `set_total` +#### `set_total` ```python set_total(self, total: int) -> None @@ -492,7 +538,7 @@ set_total(self, total: int) -> None Set the total/target value for progress tracking. -#### `increment` +#### `increment` ```python increment(self, amount: int = 1) -> None @@ -501,7 +547,7 @@ increment(self, amount: int = 1) -> None Atomically increment the current progress value. -#### `set_message` +#### `set_message` ```python set_message(self, message: str | None) -> None @@ -510,7 +556,7 @@ set_message(self, message: str | None) -> None Update the progress status message. -### `InMemoryProgress` +### `InMemoryProgress` In-memory progress tracker for immediate tool execution. @@ -522,25 +568,25 @@ progress doesn't need to be observable across processes. **Methods:** -#### `current` +#### `current` ```python current(self) -> int | None ``` -#### `total` +#### `total` ```python total(self) -> int ``` -#### `message` +#### `message` ```python message(self) -> str | None ``` -#### `set_total` +#### `set_total` ```python set_total(self, total: int) -> None @@ -549,7 +595,7 @@ set_total(self, total: int) -> None Set the total/target value for progress tracking. -#### `increment` +#### `increment` ```python increment(self, amount: int = 1) -> None @@ -558,7 +604,7 @@ increment(self, amount: int = 1) -> None Atomically increment the current progress value. -#### `set_message` +#### `set_message` ```python set_message(self, message: str | None) -> None @@ -567,24 +613,22 @@ set_message(self, message: str | None) -> None Update the progress status message. -### `Progress` +### `Progress` -FastMCP Progress dependency that works in both server and worker contexts. +Progress dependency that works in both server and worker contexts. -Handles three execution modes: -- In Docket worker: Uses the execution's progress (observable via Redis) -- In FastMCP server with Docket: Falls back to in-memory progress -- In FastMCP server without Docket: Uses in-memory progress +In a Docket worker, delegates to the execution's Redis-backed progress +(observable across processes). Otherwise, uses in-memory tracking. -This allows tools to use Progress() regardless of whether they're called -immediately or as background tasks, and regardless of whether pydocket -is installed. +The shared default instance acts as a stateless factory — ``__aenter__`` +creates a fresh ``Progress`` per invocation so concurrent tasks never +share mutable state. **Methods:** -#### `current` +#### `current` ```python current(self) -> int | None @@ -593,7 +637,7 @@ current(self) -> int | None Current progress value. -#### `total` +#### `total` ```python total(self) -> int @@ -602,7 +646,7 @@ total(self) -> int Total/target progress value. -#### `message` +#### `message` ```python message(self) -> str | None @@ -611,7 +655,7 @@ message(self) -> str | None Current progress message. -#### `set_total` +#### `set_total` ```python set_total(self, total: int) -> None @@ -620,7 +664,7 @@ set_total(self, total: int) -> None Set the total/target value for progress tracking. -#### `increment` +#### `increment` ```python increment(self, amount: int = 1) -> None @@ -629,7 +673,7 @@ increment(self, amount: int = 1) -> None Atomically increment the current progress value. -#### `set_message` +#### `set_message` ```python set_message(self, message: str | None) -> None diff --git a/docs/python-sdk/fastmcp-server-middleware-response_limiting.mdx b/docs/python-sdk/fastmcp-server-middleware-response_limiting.mdx index 0f344100b..b897f16c3 100644 --- a/docs/python-sdk/fastmcp-server-middleware-response_limiting.mdx +++ b/docs/python-sdk/fastmcp-server-middleware-response_limiting.mdx @@ -10,7 +10,7 @@ Response limiting middleware for controlling tool response sizes. ## Classes -### `ResponseLimitingMiddleware` +### `ResponseLimitingMiddleware` Middleware that limits the response size of tool calls. @@ -22,7 +22,7 @@ a single TextContent block. **Methods:** -#### `on_call_tool` +#### `on_call_tool` ```python on_call_tool(self, context: MiddlewareContext[mt.CallToolRequestParams], call_next: CallNext[mt.CallToolRequestParams, ToolResult]) -> ToolResult diff --git a/docs/python-sdk/fastmcp-server-providers-proxy.mdx b/docs/python-sdk/fastmcp-server-providers-proxy.mdx index d612a9f37..2df6ad1e3 100644 --- a/docs/python-sdk/fastmcp-server-providers-proxy.mdx +++ b/docs/python-sdk/fastmcp-server-providers-proxy.mdx @@ -15,7 +15,7 @@ classes that forward execution to remote servers. ## Functions -### `default_proxy_roots_handler` +### `default_proxy_roots_handler` ```python default_proxy_roots_handler(context: RequestContext[ClientSession, LifespanContextT]) -> RootsList @@ -25,7 +25,7 @@ default_proxy_roots_handler(context: RequestContext[ClientSession, LifespanConte Forward list roots request from remote server to proxy's connected clients. -### `default_proxy_sampling_handler` +### `default_proxy_sampling_handler` ```python default_proxy_sampling_handler(messages: list[mcp.types.SamplingMessage], params: mcp.types.CreateMessageRequestParams, context: RequestContext[ClientSession, LifespanContextT]) -> mcp.types.CreateMessageResult @@ -35,7 +35,7 @@ default_proxy_sampling_handler(messages: list[mcp.types.SamplingMessage], params Forward sampling request from remote server to proxy's connected clients. -### `default_proxy_elicitation_handler` +### `default_proxy_elicitation_handler` ```python default_proxy_elicitation_handler(message: str, response_type: type, params: mcp.types.ElicitRequestParams, context: RequestContext[ClientSession, LifespanContextT]) -> ElicitResult @@ -45,7 +45,7 @@ default_proxy_elicitation_handler(message: str, response_type: type, params: mcp Forward elicitation request from remote server to proxy's connected clients. -### `default_proxy_log_handler` +### `default_proxy_log_handler` ```python default_proxy_log_handler(message: LogMessage) -> None @@ -55,7 +55,7 @@ default_proxy_log_handler(message: LogMessage) -> None Forward log notification from remote server to proxy's connected clients. -### `default_proxy_progress_handler` +### `default_proxy_progress_handler` ```python default_proxy_progress_handler(progress: float, total: float | None, message: str | None) -> None @@ -93,7 +93,7 @@ from_mcp_tool(cls, client_factory: ClientFactoryT, mcp_tool: mcp.types.Tool) -> Factory method to create a ProxyTool from a raw MCP tool schema. -#### `run` +#### `run` ```python run(self, arguments: dict[str, Any], context: Context | None = None) -> ToolResult @@ -102,13 +102,13 @@ run(self, arguments: dict[str, Any], context: Context | None = None) -> ToolResu Executes the tool by making a call through the client. -#### `get_span_attributes` +#### `get_span_attributes` ```python get_span_attributes(self) -> dict[str, Any] ``` -### `ProxyResource` +### `ProxyResource` A Resource that represents and reads a resource from a remote server. @@ -116,7 +116,7 @@ A Resource that represents and reads a resource from a remote server. **Methods:** -#### `model_copy` +#### `model_copy` ```python model_copy(self, **kwargs: Any) -> ProxyResource @@ -125,7 +125,7 @@ model_copy(self, **kwargs: Any) -> ProxyResource Override to preserve _backend_uri when uri changes. -#### `from_mcp_resource` +#### `from_mcp_resource` ```python from_mcp_resource(cls, client_factory: ClientFactoryT, mcp_resource: mcp.types.Resource) -> ProxyResource @@ -134,7 +134,7 @@ from_mcp_resource(cls, client_factory: ClientFactoryT, mcp_resource: mcp.types.R Factory method to create a ProxyResource from a raw MCP resource schema. -#### `read` +#### `read` ```python read(self) -> ResourceResult @@ -143,13 +143,13 @@ read(self) -> ResourceResult Read the resource content from the remote server. -#### `get_span_attributes` +#### `get_span_attributes` ```python get_span_attributes(self) -> dict[str, Any] ``` -### `ProxyTemplate` +### `ProxyTemplate` A ResourceTemplate that represents and creates resources from a remote server template. @@ -157,7 +157,7 @@ A ResourceTemplate that represents and creates resources from a remote server te **Methods:** -#### `model_copy` +#### `model_copy` ```python model_copy(self, **kwargs: Any) -> ProxyTemplate @@ -166,7 +166,7 @@ model_copy(self, **kwargs: Any) -> ProxyTemplate Override to preserve _backend_uri_template when uri_template changes. -#### `from_mcp_template` +#### `from_mcp_template` ```python from_mcp_template(cls, client_factory: ClientFactoryT, mcp_template: mcp.types.ResourceTemplate) -> ProxyTemplate @@ -175,7 +175,7 @@ from_mcp_template(cls, client_factory: ClientFactoryT, mcp_template: mcp.types.R Factory method to create a ProxyTemplate from a raw MCP template schema. -#### `create_resource` +#### `create_resource` ```python create_resource(self, uri: str, params: dict[str, Any], context: Context | None = None) -> ProxyResource @@ -184,13 +184,13 @@ create_resource(self, uri: str, params: dict[str, Any], context: Context | None Create a resource from the template by calling the remote server. -#### `get_span_attributes` +#### `get_span_attributes` ```python get_span_attributes(self) -> dict[str, Any] ``` -### `ProxyPrompt` +### `ProxyPrompt` A Prompt that represents and renders a prompt from a remote server. @@ -198,7 +198,7 @@ A Prompt that represents and renders a prompt from a remote server. **Methods:** -#### `model_copy` +#### `model_copy` ```python model_copy(self, **kwargs: Any) -> ProxyPrompt @@ -207,7 +207,7 @@ model_copy(self, **kwargs: Any) -> ProxyPrompt Override to preserve _backend_name when name changes. -#### `from_mcp_prompt` +#### `from_mcp_prompt` ```python from_mcp_prompt(cls, client_factory: ClientFactoryT, mcp_prompt: mcp.types.Prompt) -> ProxyPrompt @@ -216,7 +216,7 @@ from_mcp_prompt(cls, client_factory: ClientFactoryT, mcp_prompt: mcp.types.Promp Factory method to create a ProxyPrompt from a raw MCP prompt schema. -#### `render` +#### `render` ```python render(self, arguments: dict[str, Any]) -> PromptResult @@ -225,13 +225,13 @@ render(self, arguments: dict[str, Any]) -> PromptResult Render the prompt by making a call through the client. -#### `get_span_attributes` +#### `get_span_attributes` ```python get_span_attributes(self) -> dict[str, Any] ``` -### `ProxyProvider` +### `ProxyProvider` Provider that proxies to a remote MCP server via a client factory. @@ -255,7 +255,7 @@ backends whose component lists change dynamically. **Methods:** -#### `get_tasks` +#### `get_tasks` ```python get_tasks(self) -> Sequence[FastMCPComponent] @@ -268,7 +268,7 @@ server lifespan initialization, which would open the client before any context is set. All Proxy* components have task_config.mode="forbidden". -### `FastMCPProxy` +### `FastMCPProxy` A FastMCP server that acts as a proxy to a remote MCP-compliant server. @@ -277,7 +277,7 @@ This is a convenience wrapper that creates a FastMCP server with a ProxyProvider. For more control, use FastMCP with add_provider(ProxyProvider(...)). -### `ProxyClient` +### `ProxyClient` A proxy client that forwards advanced interactions between a remote MCP server and the proxy's connected clients. @@ -285,7 +285,7 @@ A proxy client that forwards advanced interactions between a remote MCP server a Supports forwarding roots, sampling, elicitation, logging, and progress. -### `StatefulProxyClient` +### `StatefulProxyClient` A proxy client that provides a stateful client factory for the proxy server. @@ -306,7 +306,7 @@ it to detect (and correct) staleness. **Methods:** -#### `clear` +#### `clear` ```python clear(self) @@ -315,7 +315,7 @@ clear(self) Clear all cached clients and force disconnect them. -#### `new_stateful` +#### `new_stateful` ```python new_stateful(self) -> Client[ClientTransportT] diff --git a/docs/python-sdk/fastmcp-server-tasks-handlers.mdx b/docs/python-sdk/fastmcp-server-tasks-handlers.mdx index e7b1ed35e..3493b752e 100644 --- a/docs/python-sdk/fastmcp-server-tasks-handlers.mdx +++ b/docs/python-sdk/fastmcp-server-tasks-handlers.mdx @@ -13,7 +13,7 @@ Handles queuing tool/prompt/resource executions to Docket as background tasks. ## Functions -### `submit_to_docket` +### `submit_to_docket` ```python submit_to_docket(task_type: Literal['tool', 'resource', 'template', 'prompt'], key: str, component: Tool | Resource | ResourceTemplate | Prompt, arguments: dict[str, Any] | None = None, task_meta: TaskMeta | None = None) -> mcp.types.CreateTaskResult diff --git a/docs/python-sdk/fastmcp-tools-function_tool.mdx b/docs/python-sdk/fastmcp-tools-function_tool.mdx index d18d659f8..b2b7a73cc 100644 --- a/docs/python-sdk/fastmcp-tools-function_tool.mdx +++ b/docs/python-sdk/fastmcp-tools-function_tool.mdx @@ -10,7 +10,7 @@ Standalone @tool decorator for FastMCP. ## Functions -### `tool` +### `tool` ```python tool(name_or_fn: str | Callable[..., Any] | None = None) -> Any @@ -25,23 +25,23 @@ using mcp.add_tool(). ## Classes -### `DecoratedTool` +### `DecoratedTool` Protocol for functions decorated with @tool. -### `ToolMeta` +### `ToolMeta` Metadata attached to functions by the @tool decorator. -### `FunctionTool` +### `FunctionTool` **Methods:** -#### `from_function` +#### `from_function` ```python from_function(cls, fn: Callable[..., Any]) -> FunctionTool @@ -57,7 +57,7 @@ individual parameters must not be passed. Cannot be used together with metadata parameter. -#### `run` +#### `run` ```python run(self, arguments: dict[str, Any]) -> ToolResult @@ -66,7 +66,7 @@ run(self, arguments: dict[str, Any]) -> ToolResult Run the tool with arguments. -#### `register_with_docket` +#### `register_with_docket` ```python register_with_docket(self, docket: Docket) -> None @@ -74,13 +74,12 @@ register_with_docket(self, docket: Docket) -> None Register this tool with docket for background execution. -FunctionTool registers the underlying function, which has the user's -Depends parameters for docket to resolve. The function is wrapped to -eagerly restore HTTP headers from Redis so that get_http_request() -works even without explicit dependency injection. +Registers the raw function so Docket sees and resolves ALL +dependencies — both FastMCP's (CurrentContext, Progress) and +Docket-native ones (Retry, Timeout, ConcurrencyLimit). -#### `add_to_docket` +#### `add_to_docket` ```python add_to_docket(self, docket: Docket, arguments: dict[str, Any], **kwargs: Any) -> Execution diff --git a/justfile b/justfile index 28f56c2e0..8c601a16c 100644 --- a/justfile +++ b/justfile @@ -20,10 +20,10 @@ docs-broken-links: # Generate API reference documentation for all modules api-ref-all: - uvx --with-editable . --refresh-package mdxify mdxify@latest --all --root-module fastmcp --anchor-name "Python SDK" --exclude fastmcp.contrib + uvx --with-editable . --refresh-package mdxify mdxify@latest --all --root-module fastmcp --nav-output docs/python-sdk-pages.json --exclude fastmcp.contrib # 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 --anchor-name "Python SDK" + uvx --with-editable . --refresh-package mdxify mdxify@latest {{MODULES}} --root-module fastmcp --nav-output docs/python-sdk-pages.json # Clean up API reference documentation api-ref-clean: