fastmcp 2.6.0__tar.gz → 2.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.github/workflows/labeler.yml +1 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/PKG-INFO +29 -17
- {fastmcp-2.6.0 → fastmcp-2.7.0}/README.md +26 -15
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/clients/auth/bearer.mdx +2 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/clients/auth/oauth.mdx +4 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/clients/transports.mdx +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/deployment/asgi.mdx +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/deployment/running-server.mdx +14 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/docs.json +16 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/getting-started/quickstart.mdx +3 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/getting-started/welcome.mdx +2 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/integrations/anthropic.mdx +10 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/integrations/claude-desktop.mdx +2 -2
- fastmcp-2.7.0/docs/integrations/gemini.mdx +109 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/integrations/openai.mdx +11 -4
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/patterns/cli.mdx +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/patterns/decorating-methods.mdx +73 -49
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/patterns/http-requests.mdx +2 -2
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/patterns/testing.mdx +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/servers/auth/bearer.mdx +8 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/servers/composition.mdx +4 -4
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/servers/context.mdx +11 -11
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/servers/fastmcp.mdx +8 -34
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/servers/prompts.mdx +10 -10
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/servers/proxy.mdx +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/servers/tools.mdx +29 -29
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/snippets/version-badge.mdx +3 -4
- fastmcp-2.7.0/docs/style.css +119 -0
- fastmcp-2.7.0/docs/updates.mdx +21 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/complex_inputs.py +1 -1
- fastmcp-2.7.0/examples/config_server.py +46 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/desktop.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/echo.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/memory.py +2 -2
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/mount_example.py +3 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/sampling.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/screenshot.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/serializer.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/simple_echo.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/smart_home/src/smart_home/hub.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/smart_home/src/smart_home/lights/server.py +9 -9
- {fastmcp-2.6.0 → fastmcp-2.7.0}/pyproject.toml +4 -2
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/cli/cli.py +9 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/cli/run.py +32 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/client/auth/oauth.py +0 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/client/transports.py +13 -4
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/contrib/bulk_tool_caller/example.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/contrib/mcp_mixin/mcp_mixin.py +10 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/prompts/prompt.py +65 -27
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/prompts/prompt_manager.py +13 -6
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/resources/__init__.py +1 -2
- fastmcp-2.7.0/src/fastmcp/resources/resource.py +169 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/resources/resource_manager.py +17 -6
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/resources/template.py +90 -56
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/resources/types.py +0 -44
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/auth/providers/in_memory.py +1 -6
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/context.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/openapi.py +17 -32
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/proxy.py +5 -8
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/server.py +274 -100
- fastmcp-2.7.0/src/fastmcp/tools/__init__.py +4 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/tools/tool.py +59 -19
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/tools/tool_manager.py +9 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/utilities/mcp_config.py +6 -4
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/utilities/openapi.py +56 -32
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/utilities/types.py +7 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/auth/providers/test_bearer.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/auth/test_oauth_client.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/cli/test_cli.py +25 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/cli/test_run.py +36 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/client/test_client.py +8 -8
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/client/test_logs.py +2 -2
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/client/test_progress.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/client/test_roots.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/client/test_sampling.py +3 -3
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/client/test_sse.py +4 -4
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/client/test_stdio.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/client/test_streamable_http.py +4 -4
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/contrib/test_bulk_tool_caller.py +4 -3
- fastmcp-2.7.0/tests/deprecated/__init__.py +4 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/deprecated/test_deprecated.py +4 -14
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/deprecated/test_mount_separators.py +5 -2
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/deprecated/test_resource_prefixes.py +5 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/deprecated/test_route_type_ignore.py +3 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/prompts/test_prompt_manager.py +4 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/resources/test_function_resources.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/resources/test_resource_manager.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/resources/test_resource_template.py +8 -7
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/resources/test_resources.py +2 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/http/test_http_dependencies.py +2 -2
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/openapi/test_openapi_path_parameters.py +7 -7
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_auth_integration.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_file_server.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_import_server.py +19 -15
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_mount.py +19 -19
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_proxy.py +15 -8
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_run_server.py +4 -4
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_server.py +254 -41
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_server_interactions.py +68 -110
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_tool_annotations.py +6 -2
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_tool_exclude_args.py +13 -2
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/test_servers/fastmcp_server.py +4 -4
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/tools/test_tool.py +236 -8
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/tools/test_tool_manager.py +123 -69
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/openapi/test_openapi.py +111 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/test_mcp_config.py +1 -1
- {fastmcp-2.6.0 → fastmcp-2.7.0}/uv.lock +6 -1
- fastmcp-2.6.0/docs/style.css +0 -50
- fastmcp-2.6.0/server.py +0 -26
- fastmcp-2.6.0/src/fastmcp/resources/resource.py +0 -83
- fastmcp-2.6.0/src/fastmcp/tools/__init__.py +0 -4
- fastmcp-2.6.0/src/fastmcp/utilities/decorators.py +0 -101
- fastmcp-2.6.0/tests/utilities/test_decorated_function.py +0 -222
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.cursor/rules/core-mcp-objects.mdc +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.github/ISSUE_TEMPLATE/bug.yml +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.github/ISSUE_TEMPLATE/enhancement.yml +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.github/labeler.yml +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.github/release.yml +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.github/workflows/publish.yml +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.github/workflows/run-static.yml +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.github/workflows/run-tests.yml +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.gitignore +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/.pre-commit-config.yaml +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/AGENTS.md +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/LICENSE +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/Windows_Notes.md +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/assets/demo-inspector.png +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/assets/favicon.ico +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/assets/logo.png +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/clients/advanced-features.mdx +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/clients/client.mdx +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/getting-started/installation.mdx +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/integrations/contrib.mdx +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/servers/openapi.mdx +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/docs/servers/resources.mdx +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/in_memory_proxy_example.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/smart_home/README.md +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/smart_home/pyproject.toml +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/smart_home/src/smart_home/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/smart_home/src/smart_home/__main__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/smart_home/src/smart_home/lights/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/smart_home/src/smart_home/lights/hue_utils.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/smart_home/src/smart_home/py.typed +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/smart_home/src/smart_home/settings.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/smart_home/uv.lock +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/tags_example.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/examples/text_me.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/justfile +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/cli/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/cli/claude.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/client/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/client/auth/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/client/auth/bearer.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/client/client.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/client/logging.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/client/oauth_callback.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/client/progress.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/client/roots.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/client/sampling.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/contrib/README.md +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/contrib/bulk_tool_caller/README.md +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/contrib/bulk_tool_caller/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/contrib/bulk_tool_caller/bulk_tool_caller.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/contrib/mcp_mixin/README.md +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/contrib/mcp_mixin/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/contrib/mcp_mixin/example.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/exceptions.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/prompts/__init__.py +0 -0
- /fastmcp-2.6.0/src/fastmcp/server/auth/providers/__init__.py → /fastmcp-2.7.0/src/fastmcp/py.typed +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/auth/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/auth/auth.py +0 -0
- {fastmcp-2.6.0/tests → fastmcp-2.7.0/src/fastmcp/server/auth/providers}/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/auth/providers/bearer.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/auth/providers/bearer_env.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/dependencies.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/server/http.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/settings.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/utilities/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/utilities/cache.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/utilities/exceptions.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/utilities/http.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/utilities/json_schema.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/utilities/logging.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/src/fastmcp/utilities/tests.py +0 -0
- {fastmcp-2.6.0/tests/auth → fastmcp-2.7.0/tests}/__init__.py +0 -0
- {fastmcp-2.6.0/tests/cli → fastmcp-2.7.0/tests/auth}/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/auth/providers/test_bearer_env.py +0 -0
- {fastmcp-2.6.0/tests/client → fastmcp-2.7.0/tests/cli}/__init__.py +0 -0
- {fastmcp-2.6.0/tests/deprecated → fastmcp-2.7.0/tests/client}/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/client/test_openapi.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/conftest.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/contrib/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/contrib/test_mcp_mixin.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/prompts/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/prompts/test_prompt.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/resources/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/resources/test_file_resources.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/http/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/http/test_custom_routes.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/http/test_http_middleware.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/openapi/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/openapi/test_openapi.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/openapi/test_route_map_fn.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_app_state.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_context.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_logging.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/server/test_resource_prefix_formats.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/test_examples.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/test_servers/sse.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/test_servers/stdio.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/tools/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/openapi/__init__.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/openapi/conftest.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/openapi/test_openapi_advanced.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/openapi/test_openapi_fastapi.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/test_cache.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/test_json_schema.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/test_logging.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/test_tests.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/test_typeadapter.py +0 -0
- {fastmcp-2.6.0 → fastmcp-2.7.0}/tests/utilities/test_types.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastmcp
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.7.0
|
|
4
4
|
Summary: The fast, Pythonic way to build MCP servers.
|
|
5
5
|
Project-URL: Homepage, https://gofastmcp.com
|
|
6
6
|
Project-URL: Repository, https://github.com/jlowin/fastmcp
|
|
@@ -25,7 +25,8 @@ Requires-Dist: openapi-pydantic>=0.5.1
|
|
|
25
25
|
Requires-Dist: python-dotenv>=1.1.0
|
|
26
26
|
Requires-Dist: rich>=13.9.4
|
|
27
27
|
Requires-Dist: typer>=0.15.2
|
|
28
|
-
|
|
28
|
+
Provides-Extra: websockets
|
|
29
|
+
Requires-Dist: websockets>=15.0.1; extra == 'websockets'
|
|
29
30
|
Description-Content-Type: text/markdown
|
|
30
31
|
|
|
31
32
|
<div align="center">
|
|
@@ -61,7 +62,7 @@ from fastmcp import FastMCP
|
|
|
61
62
|
|
|
62
63
|
mcp = FastMCP("Demo 🚀")
|
|
63
64
|
|
|
64
|
-
@mcp.tool
|
|
65
|
+
@mcp.tool
|
|
65
66
|
def add(a: int, b: int) -> int:
|
|
66
67
|
"""Add two numbers"""
|
|
67
68
|
return a + b
|
|
@@ -104,6 +105,7 @@ There are two ways to access the LLM-friendly documentation:
|
|
|
104
105
|
- [Proxy Servers](#proxy-servers)
|
|
105
106
|
- [Composing MCP Servers](#composing-mcp-servers)
|
|
106
107
|
- [OpenAPI \& FastAPI Generation](#openapi--fastapi-generation)
|
|
108
|
+
- [Authentication \& Security](#authentication--security)
|
|
107
109
|
- [Running Your Server](#running-your-server)
|
|
108
110
|
- [Contributing](#contributing)
|
|
109
111
|
- [Prerequisites](#prerequisites)
|
|
@@ -116,20 +118,20 @@ There are two ways to access the LLM-friendly documentation:
|
|
|
116
118
|
|
|
117
119
|
## What is MCP?
|
|
118
120
|
|
|
119
|
-
The [Model Context Protocol (MCP)](https://modelcontextprotocol.io) lets you build servers that expose data and functionality to LLM applications in a secure, standardized way.
|
|
121
|
+
The [Model Context Protocol (MCP)](https://modelcontextprotocol.io) lets you build servers that expose data and functionality to LLM applications in a secure, standardized way. It is often described as "the USB-C port for AI", providing a uniform way to connect LLMs to resources they can use. It may be easier to think of it as an API, but specifically designed for LLM interactions. MCP servers can:
|
|
120
122
|
|
|
121
|
-
- Expose data through **Resources** (
|
|
122
|
-
- Provide functionality through **Tools** (
|
|
123
|
-
- Define interaction patterns through **Prompts** (reusable templates)
|
|
123
|
+
- Expose data through **Resources** (think of these sort of like GET endpoints; they are used to load information into the LLM's context)
|
|
124
|
+
- Provide functionality through **Tools** (sort of like POST endpoints; they are used to execute code or otherwise produce a side effect)
|
|
125
|
+
- Define interaction patterns through **Prompts** (reusable templates for LLM interactions)
|
|
124
126
|
- And more!
|
|
125
127
|
|
|
126
|
-
FastMCP provides a high-level, Pythonic interface for building and interacting with these servers.
|
|
128
|
+
FastMCP provides a high-level, Pythonic interface for building, managing, and interacting with these servers.
|
|
127
129
|
|
|
128
130
|
## Why FastMCP?
|
|
129
131
|
|
|
130
132
|
The MCP protocol is powerful but implementing it involves a lot of boilerplate - server setup, protocol handlers, content types, error management. FastMCP handles all the complex protocol details and server management, so you can focus on building great tools. It's designed to be high-level and Pythonic; in most cases, decorating a function is all you need.
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
FastMCP 2.0 has evolved into a comprehensive platform that goes far beyond basic protocol implementation. While 1.0 provided server-building capabilities (and is now part of the official MCP SDK), 2.0 offers a complete ecosystem including client libraries, authentication systems, deployment tools, integrations with major AI platforms, testing frameworks, and production-ready infrastructure patterns.
|
|
133
135
|
|
|
134
136
|
FastMCP aims to be:
|
|
135
137
|
|
|
@@ -139,7 +141,7 @@ FastMCP aims to be:
|
|
|
139
141
|
|
|
140
142
|
🐍 **Pythonic:** Feels natural to Python developers
|
|
141
143
|
|
|
142
|
-
🔍 **Complete:**
|
|
144
|
+
🔍 **Complete:** A comprehensive platform for all MCP use cases, from dev to prod
|
|
143
145
|
|
|
144
146
|
## Installation
|
|
145
147
|
|
|
@@ -157,7 +159,7 @@ These are the building blocks for creating MCP servers and clients with FastMCP.
|
|
|
157
159
|
|
|
158
160
|
### The `FastMCP` Server
|
|
159
161
|
|
|
160
|
-
The central object representing your MCP application. It holds your tools, resources, and prompts, manages connections, and can be configured with settings like
|
|
162
|
+
The central object representing your MCP application. It holds your tools, resources, and prompts, manages connections, and can be configured with settings like authentication.
|
|
161
163
|
|
|
162
164
|
```python
|
|
163
165
|
from fastmcp import FastMCP
|
|
@@ -173,7 +175,7 @@ Learn more in the [**FastMCP Server Documentation**](https://gofastmcp.com/serve
|
|
|
173
175
|
Tools allow LLMs to perform actions by executing your Python functions (sync or async). Ideal for computations, API calls, or side effects (like `POST`/`PUT`). FastMCP handles schema generation from type hints and docstrings. Tools can return various types, including text, JSON-serializable objects, and even images using the [`fastmcp.Image`](https://gofastmcp.com/servers/tools#return-values) helper.
|
|
174
176
|
|
|
175
177
|
```python
|
|
176
|
-
@mcp.tool
|
|
178
|
+
@mcp.tool
|
|
177
179
|
def multiply(a: float, b: float) -> float:
|
|
178
180
|
"""Multiplies two numbers."""
|
|
179
181
|
return a * b
|
|
@@ -202,10 +204,10 @@ Learn more in the [**Resources & Templates Documentation**](https://gofastmcp.co
|
|
|
202
204
|
|
|
203
205
|
### Prompts
|
|
204
206
|
|
|
205
|
-
Prompts define reusable message templates to guide LLM interactions. Decorate functions with `@mcp.prompt
|
|
207
|
+
Prompts define reusable message templates to guide LLM interactions. Decorate functions with `@mcp.prompt`. Return strings or `Message` objects.
|
|
206
208
|
|
|
207
209
|
```python
|
|
208
|
-
@mcp.prompt
|
|
210
|
+
@mcp.prompt
|
|
209
211
|
def summarize_request(text: str) -> str:
|
|
210
212
|
"""Generate a prompt asking for a summary."""
|
|
211
213
|
return f"Please summarize the following text:\n\n{text}"
|
|
@@ -230,7 +232,7 @@ from fastmcp import FastMCP, Context
|
|
|
230
232
|
|
|
231
233
|
mcp = FastMCP("My MCP Server")
|
|
232
234
|
|
|
233
|
-
@mcp.tool
|
|
235
|
+
@mcp.tool
|
|
234
236
|
async def process_data(uri: str, ctx: Context):
|
|
235
237
|
# Log a message to the client
|
|
236
238
|
await ctx.info(f"Processing {uri}...")
|
|
@@ -328,7 +330,17 @@ Learn more in the [**Composition Documentation**](https://gofastmcp.com/patterns
|
|
|
328
330
|
|
|
329
331
|
Automatically generate FastMCP servers from existing OpenAPI specifications (`FastMCP.from_openapi()`) or FastAPI applications (`FastMCP.from_fastapi()`), instantly bringing your web APIs to the MCP ecosystem.
|
|
330
332
|
|
|
331
|
-
Learn more: [**OpenAPI Integration**](https://gofastmcp.com/
|
|
333
|
+
Learn more: [**OpenAPI Integration**](https://gofastmcp.com/servers/openapi#openapi-integration) | [**FastAPI Integration**](https://gofastmcp.com/deployment/asgi#fastapi-integration).
|
|
334
|
+
|
|
335
|
+
### Authentication & Security
|
|
336
|
+
|
|
337
|
+
FastMCP provides built-in authentication support to secure both your MCP servers and clients in production environments. Protect your server endpoints from unauthorized access and authenticate your clients against secured MCP servers using industry-standard protocols.
|
|
338
|
+
|
|
339
|
+
- **Server Protection**: Secure your FastMCP server endpoints with configurable authentication providers
|
|
340
|
+
- **Client Authentication**: Connect to authenticated MCP servers with automatic credential management
|
|
341
|
+
- **Production Ready**: Support for common authentication patterns used in enterprise environments
|
|
342
|
+
|
|
343
|
+
Learn more in the **Authentication Documentation** for [servers](https://gofastmcp.com/servers/auth) and [clients](https://gofastmcp.com/clients/auth).
|
|
332
344
|
|
|
333
345
|
## Running Your Server
|
|
334
346
|
|
|
@@ -340,7 +352,7 @@ from fastmcp import FastMCP
|
|
|
340
352
|
|
|
341
353
|
mcp = FastMCP("Demo 🚀")
|
|
342
354
|
|
|
343
|
-
@mcp.tool
|
|
355
|
+
@mcp.tool
|
|
344
356
|
def hello(name: str) -> str:
|
|
345
357
|
return f"Hello, {name}!"
|
|
346
358
|
|
|
@@ -31,7 +31,7 @@ from fastmcp import FastMCP
|
|
|
31
31
|
|
|
32
32
|
mcp = FastMCP("Demo 🚀")
|
|
33
33
|
|
|
34
|
-
@mcp.tool
|
|
34
|
+
@mcp.tool
|
|
35
35
|
def add(a: int, b: int) -> int:
|
|
36
36
|
"""Add two numbers"""
|
|
37
37
|
return a + b
|
|
@@ -74,6 +74,7 @@ There are two ways to access the LLM-friendly documentation:
|
|
|
74
74
|
- [Proxy Servers](#proxy-servers)
|
|
75
75
|
- [Composing MCP Servers](#composing-mcp-servers)
|
|
76
76
|
- [OpenAPI \& FastAPI Generation](#openapi--fastapi-generation)
|
|
77
|
+
- [Authentication \& Security](#authentication--security)
|
|
77
78
|
- [Running Your Server](#running-your-server)
|
|
78
79
|
- [Contributing](#contributing)
|
|
79
80
|
- [Prerequisites](#prerequisites)
|
|
@@ -86,20 +87,20 @@ There are two ways to access the LLM-friendly documentation:
|
|
|
86
87
|
|
|
87
88
|
## What is MCP?
|
|
88
89
|
|
|
89
|
-
The [Model Context Protocol (MCP)](https://modelcontextprotocol.io) lets you build servers that expose data and functionality to LLM applications in a secure, standardized way.
|
|
90
|
+
The [Model Context Protocol (MCP)](https://modelcontextprotocol.io) lets you build servers that expose data and functionality to LLM applications in a secure, standardized way. It is often described as "the USB-C port for AI", providing a uniform way to connect LLMs to resources they can use. It may be easier to think of it as an API, but specifically designed for LLM interactions. MCP servers can:
|
|
90
91
|
|
|
91
|
-
- Expose data through **Resources** (
|
|
92
|
-
- Provide functionality through **Tools** (
|
|
93
|
-
- Define interaction patterns through **Prompts** (reusable templates)
|
|
92
|
+
- Expose data through **Resources** (think of these sort of like GET endpoints; they are used to load information into the LLM's context)
|
|
93
|
+
- Provide functionality through **Tools** (sort of like POST endpoints; they are used to execute code or otherwise produce a side effect)
|
|
94
|
+
- Define interaction patterns through **Prompts** (reusable templates for LLM interactions)
|
|
94
95
|
- And more!
|
|
95
96
|
|
|
96
|
-
FastMCP provides a high-level, Pythonic interface for building and interacting with these servers.
|
|
97
|
+
FastMCP provides a high-level, Pythonic interface for building, managing, and interacting with these servers.
|
|
97
98
|
|
|
98
99
|
## Why FastMCP?
|
|
99
100
|
|
|
100
101
|
The MCP protocol is powerful but implementing it involves a lot of boilerplate - server setup, protocol handlers, content types, error management. FastMCP handles all the complex protocol details and server management, so you can focus on building great tools. It's designed to be high-level and Pythonic; in most cases, decorating a function is all you need.
|
|
101
102
|
|
|
102
|
-
|
|
103
|
+
FastMCP 2.0 has evolved into a comprehensive platform that goes far beyond basic protocol implementation. While 1.0 provided server-building capabilities (and is now part of the official MCP SDK), 2.0 offers a complete ecosystem including client libraries, authentication systems, deployment tools, integrations with major AI platforms, testing frameworks, and production-ready infrastructure patterns.
|
|
103
104
|
|
|
104
105
|
FastMCP aims to be:
|
|
105
106
|
|
|
@@ -109,7 +110,7 @@ FastMCP aims to be:
|
|
|
109
110
|
|
|
110
111
|
🐍 **Pythonic:** Feels natural to Python developers
|
|
111
112
|
|
|
112
|
-
🔍 **Complete:**
|
|
113
|
+
🔍 **Complete:** A comprehensive platform for all MCP use cases, from dev to prod
|
|
113
114
|
|
|
114
115
|
## Installation
|
|
115
116
|
|
|
@@ -127,7 +128,7 @@ These are the building blocks for creating MCP servers and clients with FastMCP.
|
|
|
127
128
|
|
|
128
129
|
### The `FastMCP` Server
|
|
129
130
|
|
|
130
|
-
The central object representing your MCP application. It holds your tools, resources, and prompts, manages connections, and can be configured with settings like
|
|
131
|
+
The central object representing your MCP application. It holds your tools, resources, and prompts, manages connections, and can be configured with settings like authentication.
|
|
131
132
|
|
|
132
133
|
```python
|
|
133
134
|
from fastmcp import FastMCP
|
|
@@ -143,7 +144,7 @@ Learn more in the [**FastMCP Server Documentation**](https://gofastmcp.com/serve
|
|
|
143
144
|
Tools allow LLMs to perform actions by executing your Python functions (sync or async). Ideal for computations, API calls, or side effects (like `POST`/`PUT`). FastMCP handles schema generation from type hints and docstrings. Tools can return various types, including text, JSON-serializable objects, and even images using the [`fastmcp.Image`](https://gofastmcp.com/servers/tools#return-values) helper.
|
|
144
145
|
|
|
145
146
|
```python
|
|
146
|
-
@mcp.tool
|
|
147
|
+
@mcp.tool
|
|
147
148
|
def multiply(a: float, b: float) -> float:
|
|
148
149
|
"""Multiplies two numbers."""
|
|
149
150
|
return a * b
|
|
@@ -172,10 +173,10 @@ Learn more in the [**Resources & Templates Documentation**](https://gofastmcp.co
|
|
|
172
173
|
|
|
173
174
|
### Prompts
|
|
174
175
|
|
|
175
|
-
Prompts define reusable message templates to guide LLM interactions. Decorate functions with `@mcp.prompt
|
|
176
|
+
Prompts define reusable message templates to guide LLM interactions. Decorate functions with `@mcp.prompt`. Return strings or `Message` objects.
|
|
176
177
|
|
|
177
178
|
```python
|
|
178
|
-
@mcp.prompt
|
|
179
|
+
@mcp.prompt
|
|
179
180
|
def summarize_request(text: str) -> str:
|
|
180
181
|
"""Generate a prompt asking for a summary."""
|
|
181
182
|
return f"Please summarize the following text:\n\n{text}"
|
|
@@ -200,7 +201,7 @@ from fastmcp import FastMCP, Context
|
|
|
200
201
|
|
|
201
202
|
mcp = FastMCP("My MCP Server")
|
|
202
203
|
|
|
203
|
-
@mcp.tool
|
|
204
|
+
@mcp.tool
|
|
204
205
|
async def process_data(uri: str, ctx: Context):
|
|
205
206
|
# Log a message to the client
|
|
206
207
|
await ctx.info(f"Processing {uri}...")
|
|
@@ -298,7 +299,17 @@ Learn more in the [**Composition Documentation**](https://gofastmcp.com/patterns
|
|
|
298
299
|
|
|
299
300
|
Automatically generate FastMCP servers from existing OpenAPI specifications (`FastMCP.from_openapi()`) or FastAPI applications (`FastMCP.from_fastapi()`), instantly bringing your web APIs to the MCP ecosystem.
|
|
300
301
|
|
|
301
|
-
Learn more: [**OpenAPI Integration**](https://gofastmcp.com/
|
|
302
|
+
Learn more: [**OpenAPI Integration**](https://gofastmcp.com/servers/openapi#openapi-integration) | [**FastAPI Integration**](https://gofastmcp.com/deployment/asgi#fastapi-integration).
|
|
303
|
+
|
|
304
|
+
### Authentication & Security
|
|
305
|
+
|
|
306
|
+
FastMCP provides built-in authentication support to secure both your MCP servers and clients in production environments. Protect your server endpoints from unauthorized access and authenticate your clients against secured MCP servers using industry-standard protocols.
|
|
307
|
+
|
|
308
|
+
- **Server Protection**: Secure your FastMCP server endpoints with configurable authentication providers
|
|
309
|
+
- **Client Authentication**: Connect to authenticated MCP servers with automatic credential management
|
|
310
|
+
- **Production Ready**: Support for common authentication patterns used in enterprise environments
|
|
311
|
+
|
|
312
|
+
Learn more in the **Authentication Documentation** for [servers](https://gofastmcp.com/servers/auth) and [clients](https://gofastmcp.com/clients/auth).
|
|
302
313
|
|
|
303
314
|
## Running Your Server
|
|
304
315
|
|
|
@@ -310,7 +321,7 @@ from fastmcp import FastMCP
|
|
|
310
321
|
|
|
311
322
|
mcp = FastMCP("Demo 🚀")
|
|
312
323
|
|
|
313
|
-
@mcp.tool
|
|
324
|
+
@mcp.tool
|
|
314
325
|
def hello(name: str) -> str:
|
|
315
326
|
return f"Hello, {name}!"
|
|
316
327
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Bearer Token Authentication
|
|
3
3
|
sidebarTitle: Bearer Auth
|
|
4
|
-
description: Authenticate your FastMCP client
|
|
4
|
+
description: Authenticate your FastMCP client with a Bearer token.
|
|
5
5
|
icon: key
|
|
6
|
+
tag: "New!"
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
import { VersionBadge } from "/snippets/version-badge.mdx"
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: OAuth Authentication
|
|
3
3
|
sidebarTitle: OAuth
|
|
4
|
-
description: Authenticate your FastMCP client
|
|
4
|
+
description: Authenticate your FastMCP client via OAuth 2.1.
|
|
5
5
|
icon: window
|
|
6
|
+
tag: "New!"
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
import { VersionBadge } from "/snippets/version-badge.mdx"
|
|
@@ -13,7 +14,7 @@ import { VersionBadge } from "/snippets/version-badge.mdx"
|
|
|
13
14
|
OAuth authentication is only relevant for HTTP-based transports and requires user interaction via a web browser.
|
|
14
15
|
</Tip>
|
|
15
16
|
|
|
16
|
-
When your FastMCP client needs to access an MCP server protected by OAuth 2.
|
|
17
|
+
When your FastMCP client needs to access an MCP server protected by OAuth 2.1, and the process requires user interaction (like logging in and granting consent), you should use the Authorization Code Flow. FastMCP provides the `fastmcp.client.auth.OAuth` helper to simplify this entire process.
|
|
17
18
|
|
|
18
19
|
This flow is common for user-facing applications where the application acts on behalf of the user.
|
|
19
20
|
|
|
@@ -35,7 +36,7 @@ async with Client("https://fastmcp.cloud/mcp", auth="oauth") as client:
|
|
|
35
36
|
|
|
36
37
|
### `OAuth` Helper
|
|
37
38
|
|
|
38
|
-
To fully configure the OAuth flow, use the `OAuth` helper and pass it to the `auth` parameter of the `Client` or transport instance. `OAuth` manages the complexities of the OAuth 2.
|
|
39
|
+
To fully configure the OAuth flow, use the `OAuth` helper and pass it to the `auth` parameter of the `Client` or transport instance. `OAuth` manages the complexities of the OAuth 2.1 Authorization Code Grant with PKCE (Proof Key for Code Exchange) for enhanced security, and implements the full `httpx.Auth` interface.
|
|
39
40
|
|
|
40
41
|
```python {2, 4, 6}
|
|
41
42
|
from fastmcp import Client
|
|
@@ -22,7 +22,7 @@ from fastmcp import FastMCP
|
|
|
22
22
|
|
|
23
23
|
mcp = FastMCP(name="MyServer")
|
|
24
24
|
|
|
25
|
-
@mcp.tool
|
|
25
|
+
@mcp.tool
|
|
26
26
|
def hello(name: str) -> str:
|
|
27
27
|
return f"Hello, {name}!"
|
|
28
28
|
|
|
@@ -59,7 +59,18 @@ For development and testing, you can use the `dev` command to run your server wi
|
|
|
59
59
|
fastmcp dev server.py
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
-
See the [CLI documentation](/
|
|
62
|
+
See the [CLI documentation](/patterns/cli) for detailed information about all available commands and options.
|
|
63
|
+
|
|
64
|
+
### Passing Arguments to Servers
|
|
65
|
+
|
|
66
|
+
When servers accept command line arguments (using argparse, click, or other libraries), you can pass them after `--`:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
fastmcp run config_server.py -- --config config.json
|
|
70
|
+
fastmcp run database_server.py -- --database-path /tmp/db.sqlite --debug
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This is useful for servers that need configuration files, database paths, API keys, or other runtime options.
|
|
63
74
|
|
|
64
75
|
## Transport Options
|
|
65
76
|
|
|
@@ -233,7 +244,7 @@ import asyncio
|
|
|
233
244
|
|
|
234
245
|
mcp = FastMCP(name="MyServer")
|
|
235
246
|
|
|
236
|
-
@mcp.tool
|
|
247
|
+
@mcp.tool
|
|
237
248
|
def hello(name: str) -> str:
|
|
238
249
|
return f"Hello, {name}!"
|
|
239
250
|
|
|
@@ -11,11 +11,22 @@
|
|
|
11
11
|
},
|
|
12
12
|
"decoration": "windows"
|
|
13
13
|
},
|
|
14
|
+
"banner": {
|
|
15
|
+
"content": "[FastMCP Cloud](https://fastmcp.link/x0Kyhy2) is coming!"
|
|
16
|
+
},
|
|
14
17
|
"colors": {
|
|
15
18
|
"dark": "#f72585",
|
|
16
19
|
"light": "#4cc9f0",
|
|
17
20
|
"primary": "#2d00f7"
|
|
18
21
|
},
|
|
22
|
+
"contextual": {
|
|
23
|
+
"options": [
|
|
24
|
+
"copy",
|
|
25
|
+
"view",
|
|
26
|
+
"chatgpt",
|
|
27
|
+
"claude"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
19
30
|
"description": "The fast, Pythonic way to build MCP servers and clients.",
|
|
20
31
|
"favicon": {
|
|
21
32
|
"dark": "/assets/favicon.ico",
|
|
@@ -47,7 +58,8 @@
|
|
|
47
58
|
"pages": [
|
|
48
59
|
"getting-started/welcome",
|
|
49
60
|
"getting-started/installation",
|
|
50
|
-
"getting-started/quickstart"
|
|
61
|
+
"getting-started/quickstart",
|
|
62
|
+
"updates"
|
|
51
63
|
]
|
|
52
64
|
},
|
|
53
65
|
{
|
|
@@ -93,8 +105,8 @@
|
|
|
93
105
|
"group": "Authentication",
|
|
94
106
|
"icon": "user-shield",
|
|
95
107
|
"pages": [
|
|
96
|
-
"clients/auth/
|
|
97
|
-
"clients/auth/
|
|
108
|
+
"clients/auth/oauth",
|
|
109
|
+
"clients/auth/bearer"
|
|
98
110
|
]
|
|
99
111
|
},
|
|
100
112
|
"clients/advanced-features"
|
|
@@ -106,6 +118,7 @@
|
|
|
106
118
|
"integrations/anthropic",
|
|
107
119
|
"integrations/claude-desktop",
|
|
108
120
|
"integrations/openai",
|
|
121
|
+
"integrations/gemini",
|
|
109
122
|
"integrations/contrib"
|
|
110
123
|
]
|
|
111
124
|
},
|
|
@@ -32,7 +32,7 @@ from fastmcp import FastMCP
|
|
|
32
32
|
|
|
33
33
|
mcp = FastMCP("My MCP Server")
|
|
34
34
|
|
|
35
|
-
@mcp.tool
|
|
35
|
+
@mcp.tool
|
|
36
36
|
def greet(name: str) -> str:
|
|
37
37
|
return f"Hello, {name}!"
|
|
38
38
|
```
|
|
@@ -49,7 +49,7 @@ from fastmcp import FastMCP, Client
|
|
|
49
49
|
|
|
50
50
|
mcp = FastMCP("My MCP Server")
|
|
51
51
|
|
|
52
|
-
@mcp.tool
|
|
52
|
+
@mcp.tool
|
|
53
53
|
def greet(name: str) -> str:
|
|
54
54
|
return f"Hello, {name}!"
|
|
55
55
|
|
|
@@ -76,7 +76,7 @@ from fastmcp import FastMCP
|
|
|
76
76
|
|
|
77
77
|
mcp = FastMCP("My MCP Server")
|
|
78
78
|
|
|
79
|
-
@mcp.tool
|
|
79
|
+
@mcp.tool
|
|
80
80
|
def greet(name: str) -> str:
|
|
81
81
|
return f"Hello, {name}!"
|
|
82
82
|
|
|
@@ -14,7 +14,7 @@ from fastmcp import FastMCP
|
|
|
14
14
|
|
|
15
15
|
mcp = FastMCP("Demo 🚀")
|
|
16
16
|
|
|
17
|
-
@mcp.tool
|
|
17
|
+
@mcp.tool
|
|
18
18
|
def add(a: int, b: int) -> int:
|
|
19
19
|
"""Add two numbers"""
|
|
20
20
|
return a + b
|
|
@@ -42,8 +42,7 @@ The Model Context Protocol lets you build servers that expose data and functiona
|
|
|
42
42
|
- Define interaction patterns through `Prompts` (reusable templates for LLM interactions)
|
|
43
43
|
- And more!
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
FastMCP provides a high-level, Pythonic interface for building, managing, and interacting with these servers.
|
|
47
46
|
|
|
48
47
|
## Why FastMCP?
|
|
49
48
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Anthropic
|
|
3
3
|
sidebarTitle: Anthropic
|
|
4
|
-
description:
|
|
4
|
+
description: Call FastMCP servers from the Anthropic API
|
|
5
5
|
icon: message-smile
|
|
6
|
+
tag: "New!"
|
|
6
7
|
---
|
|
7
8
|
|
|
8
9
|
import { VersionBadge } from "/snippets/version-badge.mdx"
|
|
@@ -27,7 +28,7 @@ from fastmcp import FastMCP
|
|
|
27
28
|
|
|
28
29
|
mcp = FastMCP(name="Dice Roller")
|
|
29
30
|
|
|
30
|
-
@mcp.tool
|
|
31
|
+
@mcp.tool
|
|
31
32
|
def roll_dice(n_dice: int) -> list[int]:
|
|
32
33
|
"""Roll `n_dice` 6-sided dice and return the results."""
|
|
33
34
|
return [random.randint(1, 6) for _ in range(n_dice)]
|
|
@@ -66,6 +67,12 @@ To use the Messages API with MCP servers, you'll need to install the Anthropic P
|
|
|
66
67
|
pip install anthropic
|
|
67
68
|
```
|
|
68
69
|
|
|
70
|
+
You'll also need to authenticate with Anthropic. You can do this by setting the `ANTHROPIC_API_KEY` environment variable. Consult the Anthropic SDK documentation for more information.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
export ANTHROPIC_API_KEY="your-api-key"
|
|
74
|
+
```
|
|
75
|
+
|
|
69
76
|
Here is an example of how to call your server from Python. Note that you'll need to replace `https://your-server-url.com` with the actual URL of your server. In addition, we use `/sse` as the endpoint because we deployed an SSE server with the default path; you may need to use a different endpoint if you customized your server's deployment. **At this time you must also include the `extra_headers` parameter with the `anthropic-beta` header.**
|
|
70
77
|
|
|
71
78
|
```python {5, 13-22}
|
|
@@ -164,7 +171,7 @@ auth = BearerAuthProvider(
|
|
|
164
171
|
|
|
165
172
|
mcp = FastMCP(name="Dice Roller", auth=auth)
|
|
166
173
|
|
|
167
|
-
@mcp.tool
|
|
174
|
+
@mcp.tool
|
|
168
175
|
def roll_dice(n_dice: int) -> list[int]:
|
|
169
176
|
"""Roll `n_dice` 6-sided dice and return the results."""
|
|
170
177
|
return [random.randint(1, 6) for _ in range(n_dice)]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Claude Desktop
|
|
3
3
|
sidebarTitle: Claude Desktop
|
|
4
|
-
description:
|
|
4
|
+
description: Call FastMCP servers from Claude Desktop
|
|
5
5
|
icon: desktop
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ from fastmcp import FastMCP
|
|
|
31
31
|
|
|
32
32
|
mcp = FastMCP(name="Dice Roller")
|
|
33
33
|
|
|
34
|
-
@mcp.tool
|
|
34
|
+
@mcp.tool
|
|
35
35
|
def roll_dice(n_dice: int) -> list[int]:
|
|
36
36
|
"""Roll `n_dice` 6-sided dice and return the results."""
|
|
37
37
|
return [random.randint(1, 6) for _ in range(n_dice)]
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Gemini SDK
|
|
3
|
+
sidebarTitle: Gemini SDK
|
|
4
|
+
description: Call FastMCP servers from the Google Gemini SDK
|
|
5
|
+
icon: message-smile
|
|
6
|
+
tag: "New!"
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
import { VersionBadge } from "/snippets/version-badge.mdx"
|
|
10
|
+
|
|
11
|
+
Google's Gemini API includes built-in support for MCP servers in their Python and JavaScript SDKs, allowing you to connect directly to MCP servers and use their tools seamlessly with Gemini models.
|
|
12
|
+
|
|
13
|
+
## Gemini Python SDK
|
|
14
|
+
|
|
15
|
+
Google's [Gemini Python SDK](https://ai.google.dev/gemini-api/docs) can use FastMCP clients directly.
|
|
16
|
+
|
|
17
|
+
<Note>
|
|
18
|
+
Google's MCP integration is currently experimental and available in the Python and JavaScript SDKs. The API automatically calls MCP tools when needed and can connect to both local and remote MCP servers.
|
|
19
|
+
</Note>
|
|
20
|
+
|
|
21
|
+
<Tip>
|
|
22
|
+
Currently, Gemini's MCP support only accesses **tools** from MCP servers—it queries the `list_tools` endpoint and exposes those functions to the AI. Other MCP features like resources and prompts are not currently supported.
|
|
23
|
+
</Tip>
|
|
24
|
+
|
|
25
|
+
### Create a Server
|
|
26
|
+
|
|
27
|
+
First, create a FastMCP server with the tools you want to expose. For this example, we'll create a server with a single tool that rolls dice.
|
|
28
|
+
|
|
29
|
+
```python server.py
|
|
30
|
+
import random
|
|
31
|
+
from fastmcp import FastMCP
|
|
32
|
+
|
|
33
|
+
mcp = FastMCP(name="Dice Roller")
|
|
34
|
+
|
|
35
|
+
@mcp.tool
|
|
36
|
+
def roll_dice(n_dice: int) -> list[int]:
|
|
37
|
+
"""Roll `n_dice` 6-sided dice and return the results."""
|
|
38
|
+
return [random.randint(1, 6) for _ in range(n_dice)]
|
|
39
|
+
|
|
40
|
+
if __name__ == "__main__":
|
|
41
|
+
mcp.run()
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Call the Server
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
To use the Gemini API with MCP, you'll need to install the Google Generative AI SDK:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install google-genai
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
You'll also need to authenticate with Google. You can do this by setting the `GEMINI_API_KEY` environment variable. Consult the Gemini SDK documentation for more information.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
export GEMINI_API_KEY="your-api-key"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Gemini's SDK interacts directly with the MCP client session. To call the server, you'll need to instantiate a FastMCP client, enter its connection context, and pass the client session to the Gemini SDK.
|
|
60
|
+
|
|
61
|
+
```python {5, 9, 15}
|
|
62
|
+
from fastmcp import Client
|
|
63
|
+
from google import genai
|
|
64
|
+
import asyncio
|
|
65
|
+
|
|
66
|
+
mcp_client = Client("server.py")
|
|
67
|
+
gemini_client = genai.Client()
|
|
68
|
+
|
|
69
|
+
async def main():
|
|
70
|
+
async with client:
|
|
71
|
+
response = await gemini_client.aio.models.generate_content(
|
|
72
|
+
model="gemini-2.0-flash",
|
|
73
|
+
contents="Roll 3 dice!",
|
|
74
|
+
config=genai.types.GenerateContentConfig(
|
|
75
|
+
temperature=0,
|
|
76
|
+
tools=[mcp_client.session], # Pass the FastMCP client session
|
|
77
|
+
),
|
|
78
|
+
)
|
|
79
|
+
print(response.text)
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
asyncio.run(main())
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
If you run this code, you'll see output like:
|
|
86
|
+
|
|
87
|
+
```text
|
|
88
|
+
Okay, I rolled 3 dice and got a 5, 4, and 1.
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Remote & Authenticated Servers
|
|
92
|
+
|
|
93
|
+
In the above example, we connected to our local server using `stdio` transport. Because we're using a FastMCP client, you can also connect to any local or remote MCP server, using any [transport](/clients/transports) or [auth](/clients/auth) method supported by FastMCP, simply by changing the client configuration.
|
|
94
|
+
|
|
95
|
+
For example, to connect to a remote, authenticated server, you can use the following client:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from fastmcp import Client
|
|
99
|
+
from fastmcp.client.auth import BearerAuth
|
|
100
|
+
|
|
101
|
+
client = Client(
|
|
102
|
+
"https://my-server.com/sse",
|
|
103
|
+
auth=BearerAuth("<your-token>"),
|
|
104
|
+
)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The rest of the code remains the same.
|
|
108
|
+
|
|
109
|
+
|