fastmcp 2.3.1__tar.gz → 2.3.3__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.
Files changed (177) hide show
  1. {fastmcp-2.3.1 → fastmcp-2.3.3}/PKG-INFO +2 -2
  2. {fastmcp-2.3.1 → fastmcp-2.3.3}/README.md +1 -1
  3. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/deployment/asgi.mdx +54 -14
  4. fastmcp-2.3.3/docs/deployment/cli.mdx +174 -0
  5. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/deployment/running-server.mdx +67 -7
  6. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/docs.json +14 -3
  7. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/getting-started/installation.mdx +4 -3
  8. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/getting-started/welcome.mdx +1 -1
  9. fastmcp-2.3.3/docs/servers/composition.mdx +212 -0
  10. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/servers/fastmcp.mdx +7 -2
  11. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/complex_inputs.py +1 -1
  12. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/desktop.py +1 -1
  13. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/cli/cli.py +7 -8
  14. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/server/http.py +48 -30
  15. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/server/server.py +151 -48
  16. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/utilities/tests.py +5 -3
  17. fastmcp-2.3.3/tests/cli/test_cli.py +478 -0
  18. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/client/test_sse.py +10 -3
  19. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/client/test_streamable_http.py +2 -2
  20. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_http_dependencies.py +1 -1
  21. fastmcp-2.3.3/tests/server/test_http_middleware.py +219 -0
  22. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_mount.py +15 -0
  23. fastmcp-2.3.3/tests/test_deprecated.py +82 -0
  24. fastmcp-2.3.1/docs/patterns/composition.mdx +0 -340
  25. fastmcp-2.3.1/test.py +0 -12
  26. {fastmcp-2.3.1 → fastmcp-2.3.3}/.cursor/rules/core-mcp-objects.mdc +0 -0
  27. {fastmcp-2.3.1 → fastmcp-2.3.3}/.github/ISSUE_TEMPLATE/bug.yml +0 -0
  28. {fastmcp-2.3.1 → fastmcp-2.3.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  29. {fastmcp-2.3.1 → fastmcp-2.3.3}/.github/ISSUE_TEMPLATE/enhancement.yml +0 -0
  30. {fastmcp-2.3.1 → fastmcp-2.3.3}/.github/release.yml +0 -0
  31. {fastmcp-2.3.1 → fastmcp-2.3.3}/.github/workflows/publish.yml +0 -0
  32. {fastmcp-2.3.1 → fastmcp-2.3.3}/.github/workflows/run-static.yml +0 -0
  33. {fastmcp-2.3.1 → fastmcp-2.3.3}/.github/workflows/run-tests.yml +0 -0
  34. {fastmcp-2.3.1 → fastmcp-2.3.3}/.gitignore +0 -0
  35. {fastmcp-2.3.1 → fastmcp-2.3.3}/.pre-commit-config.yaml +0 -0
  36. {fastmcp-2.3.1 → fastmcp-2.3.3}/LICENSE +0 -0
  37. {fastmcp-2.3.1 → fastmcp-2.3.3}/Windows_Notes.md +0 -0
  38. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/assets/demo-inspector.png +0 -0
  39. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/clients/client.mdx +0 -0
  40. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/clients/transports.mdx +0 -0
  41. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/deployment/authentication.mdx +0 -0
  42. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/getting-started/quickstart.mdx +0 -0
  43. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/patterns/contrib.mdx +0 -0
  44. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/patterns/decorating-methods.mdx +0 -0
  45. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/patterns/fastapi.mdx +0 -0
  46. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/patterns/http-requests.mdx +0 -0
  47. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/patterns/openapi.mdx +0 -0
  48. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/patterns/testing.mdx +0 -0
  49. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/servers/context.mdx +0 -0
  50. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/servers/prompts.mdx +0 -0
  51. {fastmcp-2.3.1/docs/patterns → fastmcp-2.3.3/docs/servers}/proxy.mdx +0 -0
  52. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/servers/resources.mdx +0 -0
  53. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/servers/tools.mdx +0 -0
  54. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/snippets/version-badge.mdx +0 -0
  55. {fastmcp-2.3.1 → fastmcp-2.3.3}/docs/style.css +0 -0
  56. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/echo.py +0 -0
  57. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/memory.py +0 -0
  58. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/mount_example.py +0 -0
  59. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/sampling.py +0 -0
  60. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/screenshot.py +0 -0
  61. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/serializer.py +0 -0
  62. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/simple_echo.py +0 -0
  63. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/smart_home/README.md +0 -0
  64. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/smart_home/pyproject.toml +0 -0
  65. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/smart_home/src/smart_home/__init__.py +0 -0
  66. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/smart_home/src/smart_home/__main__.py +0 -0
  67. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/smart_home/src/smart_home/hub.py +0 -0
  68. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/smart_home/src/smart_home/lights/__init__.py +0 -0
  69. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/smart_home/src/smart_home/lights/hue_utils.py +0 -0
  70. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/smart_home/src/smart_home/lights/server.py +0 -0
  71. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/smart_home/src/smart_home/py.typed +0 -0
  72. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/smart_home/src/smart_home/settings.py +0 -0
  73. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/smart_home/uv.lock +0 -0
  74. {fastmcp-2.3.1 → fastmcp-2.3.3}/examples/text_me.py +0 -0
  75. {fastmcp-2.3.1 → fastmcp-2.3.3}/justfile +0 -0
  76. {fastmcp-2.3.1 → fastmcp-2.3.3}/pyproject.toml +0 -0
  77. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/__init__.py +0 -0
  78. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/cli/__init__.py +0 -0
  79. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/cli/claude.py +0 -0
  80. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/client/__init__.py +0 -0
  81. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/client/base.py +0 -0
  82. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/client/client.py +0 -0
  83. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/client/logging.py +0 -0
  84. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/client/roots.py +0 -0
  85. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/client/sampling.py +0 -0
  86. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/client/transports.py +0 -0
  87. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/contrib/README.md +0 -0
  88. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/contrib/bulk_tool_caller/README.md +0 -0
  89. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/contrib/bulk_tool_caller/__init__.py +0 -0
  90. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/contrib/bulk_tool_caller/bulk_tool_caller.py +0 -0
  91. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/contrib/bulk_tool_caller/example.py +0 -0
  92. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/contrib/mcp_mixin/README.md +0 -0
  93. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/contrib/mcp_mixin/__init__.py +0 -0
  94. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/contrib/mcp_mixin/example.py +0 -0
  95. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/contrib/mcp_mixin/mcp_mixin.py +0 -0
  96. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/exceptions.py +0 -0
  97. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/low_level/README.md +0 -0
  98. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/low_level/__init__.py +0 -0
  99. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/low_level/sse_server_transport.py +0 -0
  100. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/prompts/__init__.py +0 -0
  101. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/prompts/prompt.py +0 -0
  102. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/prompts/prompt_manager.py +0 -0
  103. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/py.typed +0 -0
  104. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/resources/__init__.py +0 -0
  105. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/resources/resource.py +0 -0
  106. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/resources/resource_manager.py +0 -0
  107. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/resources/template.py +0 -0
  108. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/resources/types.py +0 -0
  109. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/server/__init__.py +0 -0
  110. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/server/context.py +0 -0
  111. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/server/dependencies.py +0 -0
  112. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/server/openapi.py +0 -0
  113. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/server/proxy.py +0 -0
  114. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/settings.py +0 -0
  115. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/tools/__init__.py +0 -0
  116. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/tools/tool.py +0 -0
  117. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/tools/tool_manager.py +0 -0
  118. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/utilities/__init__.py +0 -0
  119. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/utilities/cache.py +0 -0
  120. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/utilities/decorators.py +0 -0
  121. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/utilities/json_schema.py +0 -0
  122. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/utilities/logging.py +0 -0
  123. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/utilities/openapi.py +0 -0
  124. {fastmcp-2.3.1 → fastmcp-2.3.3}/src/fastmcp/utilities/types.py +0 -0
  125. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/__init__.py +0 -0
  126. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/cli/test_run.py +0 -0
  127. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/client/__init__.py +0 -0
  128. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/client/test_client.py +0 -0
  129. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/client/test_logs.py +0 -0
  130. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/client/test_roots.py +0 -0
  131. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/client/test_sampling.py +0 -0
  132. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/conftest.py +0 -0
  133. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/contrib/__init__.py +0 -0
  134. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/contrib/test_bulk_tool_caller.py +0 -0
  135. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/contrib/test_mcp_mixin.py +0 -0
  136. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/prompts/__init__.py +0 -0
  137. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/prompts/test_prompt.py +0 -0
  138. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/prompts/test_prompt_manager.py +0 -0
  139. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/resources/__init__.py +0 -0
  140. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/resources/test_file_resources.py +0 -0
  141. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/resources/test_function_resources.py +0 -0
  142. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/resources/test_resource_manager.py +0 -0
  143. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/resources/test_resource_template.py +0 -0
  144. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/resources/test_resources.py +0 -0
  145. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/__init__.py +0 -0
  146. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_auth_integration.py +0 -0
  147. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_context.py +0 -0
  148. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_file_server.py +0 -0
  149. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_import_server.py +0 -0
  150. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_lifespan.py +0 -0
  151. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_openapi.py +0 -0
  152. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_proxy.py +0 -0
  153. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_run_server.py +0 -0
  154. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_server.py +0 -0
  155. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_server_interactions.py +0 -0
  156. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/server/test_tool_annotations.py +0 -0
  157. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/test_examples.py +0 -0
  158. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/test_servers/fastmcp_server.py +0 -0
  159. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/test_servers/sse.py +0 -0
  160. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/test_servers/stdio.py +0 -0
  161. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/tools/__init__.py +0 -0
  162. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/tools/test_tool.py +0 -0
  163. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/tools/test_tool_manager.py +0 -0
  164. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/__init__.py +0 -0
  165. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/openapi/__init__.py +0 -0
  166. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/openapi/conftest.py +0 -0
  167. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/openapi/test_openapi.py +0 -0
  168. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/openapi/test_openapi_advanced.py +0 -0
  169. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/openapi/test_openapi_fastapi.py +0 -0
  170. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/test_cache.py +0 -0
  171. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/test_decorated_function.py +0 -0
  172. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/test_json_schema.py +0 -0
  173. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/test_logging.py +0 -0
  174. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/test_tests.py +0 -0
  175. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/test_typeadapter.py +0 -0
  176. {fastmcp-2.3.1 → fastmcp-2.3.3}/tests/utilities/test_types.py +0 -0
  177. {fastmcp-2.3.1 → fastmcp-2.3.3}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastmcp
3
- Version: 2.3.1
3
+ Version: 2.3.3
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
@@ -44,7 +44,7 @@ Description-Content-Type: text/markdown
44
44
  > [!NOTE]
45
45
  > #### FastMCP 2.0 & The Official MCP SDK
46
46
  >
47
- > Recognize the `FastMCP` name? You might have used the version integrated into the [official MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk), which was based on **FastMCP 1.0**.
47
+ > Recognize the `FastMCP` name? You might have seen the version that was contributed to the [official MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk), which was based on **FastMCP 1.0**.
48
48
  >
49
49
  > **Welcome to FastMCP 2.0!** This is the actively developed successor, and it significantly expands on 1.0 by introducing powerful client capabilities, server proxying & composition, OpenAPI/FastAPI integration, and more advanced features.
50
50
  >
@@ -15,7 +15,7 @@
15
15
  > [!NOTE]
16
16
  > #### FastMCP 2.0 & The Official MCP SDK
17
17
  >
18
- > Recognize the `FastMCP` name? You might have used the version integrated into the [official MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk), which was based on **FastMCP 1.0**.
18
+ > Recognize the `FastMCP` name? You might have seen the version that was contributed to the [official MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk), which was based on **FastMCP 1.0**.
19
19
  >
20
20
  > **Welcome to FastMCP 2.0!** This is the actively developed successor, and it significantly expands on 1.0 by introducing powerful client capabilities, server proxying & composition, OpenAPI/FastAPI integration, and more advanced features.
21
21
  >
@@ -5,6 +5,9 @@ description: Integrate FastMCP servers into existing Starlette, FastAPI, or othe
5
5
  icon: plug
6
6
  ---
7
7
 
8
+ import { VersionBadge } from '/snippets/version-badge.mdx'
9
+
10
+
8
11
  While FastMCP provides standalone server capabilities, you can also integrate your FastMCP server into existing web applications. This approach is useful for:
9
12
 
10
13
  - Adding MCP functionality to an existing website or API
@@ -16,10 +19,13 @@ Please note that all FastMCP servers have a `run()` method that can be used to s
16
19
 
17
20
  ## ASGI Server
18
21
 
19
-
20
22
  FastMCP servers can be created as [Starlette](https://www.starlette.io/) ASGI apps for straightforward hosting or integration into existing applications.
21
23
 
22
- The first step is to obtain a Starlette application instance from your FastMCP server using either the `streamable_http_app()` (preferred) or `sse_app()` (legacy) methods:
24
+ The first step is to obtain a Starlette application instance from your FastMCP server using the `http_app()` method:
25
+
26
+ <Tip>
27
+ The `http_app()` method is new in FastMCP 2.3.2. In older versions, use `sse_app()` for SSE transport or `streamable_http_app()` for Streamable HTTP transport.
28
+ </Tip>
23
29
 
24
30
  ```python
25
31
  from fastmcp import FastMCP
@@ -30,18 +36,23 @@ mcp = FastMCP("MyServer")
30
36
  def hello(name: str) -> str:
31
37
  return f"Hello, {name}!"
32
38
 
33
- # Get a Starlette app instance for the preferred transport
34
- http_app = mcp.streamable_http_app() # For Streamable HTTP transport
35
- sse_app = mcp.sse_app() # For SSE transport
39
+ # Get a Starlette app instance for Streamable HTTP transport (recommended)
40
+ http_app = mcp.http_app()
41
+
42
+ # For legacy SSE transport (deprecated)
43
+ sse_app = mcp.http_app(transport="sse")
36
44
  ```
37
45
 
38
- Both methods return a Starlette application that can be integrated with other ASGI-compatible web frameworks.
46
+ Both approaches return a Starlette application that can be integrated with other ASGI-compatible web frameworks.
39
47
 
40
- The MCP server's endpoint is mounted at the root path `/mcp` for Streamable HTTP transport, and `/sse` for SSE transport, though you can change these paths by passing a `path` argument to the `streamable_http_app()` or `sse_app()` methods:
48
+ The MCP server's endpoint is mounted at the root path `/mcp` for Streamable HTTP transport, and `/sse` for SSE transport, though you can change these paths by passing a `path` argument to the `http_app()` method:
41
49
 
42
50
  ```python
43
- http_app = mcp.streamable_http_app(path="/custom-mcp-path")
44
- sse_app = mcp.sse_app(path="/custom-sse-path")
51
+ # For Streamable HTTP transport
52
+ http_app = mcp.http_app(path="/custom-mcp-path")
53
+
54
+ # For SSE transport (deprecated)
55
+ sse_app = mcp.http_app(path="/custom-sse-path", transport="sse")
45
56
  ```
46
57
 
47
58
  ### Running the Server
@@ -49,9 +60,12 @@ sse_app = mcp.sse_app(path="/custom-sse-path")
49
60
  To run the FastMCP server, you can use the `uvicorn` ASGI server:
50
61
 
51
62
  ```python
63
+ from fastmcp import FastMCP
52
64
  import uvicorn
53
65
 
54
- # (define the app here)
66
+ mcp = FastMCP("MyServer")
67
+
68
+ http_app = mcp.http_app()
55
69
 
56
70
  if __name__ == "__main__":
57
71
  uvicorn.run(http_app, host="0.0.0.0", port=8000)
@@ -63,11 +77,35 @@ Or, from the command line:
63
77
  uvicorn path.to.your.app:http_app --host 0.0.0.0 --port 8000
64
78
  ```
65
79
 
80
+ ### Custom Middleware
81
+
82
+ <VersionBadge version="2.3.2" />
83
+
84
+ You can add custom Starlette middleware to your FastMCP ASGI apps by passing a list of middleware instances to the app creation methods:
85
+
86
+ ```python
87
+ from fastmcp import FastMCP
88
+ from starlette.middleware import Middleware
89
+ from starlette.middleware.cors import CORSMiddleware
90
+
91
+ # Create your FastMCP server
92
+ mcp = FastMCP("MyServer")
93
+
94
+ # Define custom middleware
95
+ custom_middleware = [
96
+ Middleware(CORSMiddleware, allow_origins=["*"]),
97
+ ]
98
+
99
+ # Create ASGI app with custom middleware
100
+ http_app = mcp.http_app(middleware=custom_middleware)
101
+ ```
66
102
 
67
103
 
68
104
  ## Starlette Integration
69
105
 
70
- You can mount your FastMCP server in another Starlette application using the `Mount` class.
106
+ <VersionBadge version="2.3.1" />
107
+
108
+ You can mount your FastMCP server in another Starlette application:
71
109
 
72
110
  ```python
73
111
  from fastmcp import FastMCP
@@ -78,7 +116,7 @@ from starlette.routing import Mount
78
116
  mcp = FastMCP("MyServer")
79
117
 
80
118
  # Create the ASGI app
81
- mcp_app = mcp.streamable_http_app(path='/mcp')
119
+ mcp_app = mcp.http_app(path='/mcp')
82
120
 
83
121
  # Create a Starlette app and mount the MCP server
84
122
  app = Starlette(
@@ -110,7 +148,7 @@ from starlette.routing import Mount
110
148
  mcp = FastMCP("MyServer")
111
149
 
112
150
  # Create the ASGI app
113
- mcp_app = mcp.streamable_http_app(path='/mcp')
151
+ mcp_app = mcp.http_app(path='/mcp')
114
152
 
115
153
  # Create nested application structure
116
154
  inner_app = Starlette(routes=[Mount("/inner", app=mcp_app)])
@@ -127,6 +165,8 @@ For Streamable HTTP transport, you **must** pass the lifespan context from the F
127
165
  </Warning>
128
166
  ## FastAPI Integration
129
167
 
168
+ <VersionBadge version="2.3.1" />
169
+
130
170
  FastAPI is built on Starlette, so you can mount your FastMCP server in a similar way:
131
171
 
132
172
  ```python
@@ -138,7 +178,7 @@ from starlette.routing import Mount
138
178
  mcp = FastMCP("MyServer")
139
179
 
140
180
  # Create the ASGI app
141
- mcp_app = mcp.streamable_http_app(path='/mcp')
181
+ mcp_app = mcp.http_app(path='/mcp')
142
182
 
143
183
  # Create a FastAPI app and mount the MCP server
144
184
  app = FastAPI(lifespan=mcp_app.router.lifespan_context)
@@ -0,0 +1,174 @@
1
+ ---
2
+ title: FastMCP CLI
3
+ sidebarTitle: CLI
4
+ description: Learn how to use the FastMCP command-line interface
5
+ icon: terminal
6
+ ---
7
+
8
+ import { VersionBadge } from "/snippets/version-badge.mdx"
9
+
10
+
11
+ FastMCP provides a command-line interface (CLI) that makes it easy to run, develop, and install your MCP servers. The CLI is automatically installed when you install FastMCP.
12
+
13
+ ```bash
14
+ fastmcp --help
15
+ ```
16
+
17
+ ## Commands Overview
18
+
19
+ | Command | Purpose | Dependency Management |
20
+ | ------- | ------- | --------------------- |
21
+ | `run` | Run a FastMCP server directly | Uses your current environment; you are responsible for ensuring all dependencies are available |
22
+ | `dev` | Run a server with the MCP Inspector for testing | Creates an isolated environment; dependencies must be explicitly specified with `--with` and/or `--with-editable` |
23
+ | `install` | Install a server in the Claude desktop app | Creates an isolated environment; dependencies must be explicitly specified with `--with` and/or `--with-editable` |
24
+ | `version` | Display version information | N/A |
25
+
26
+ ## Command Details
27
+
28
+ ### `run`
29
+
30
+ Run a FastMCP server directly.
31
+
32
+ ```bash
33
+ fastmcp run server.py
34
+ ```
35
+
36
+ <Tip>
37
+ This command runs the server directly in your current Python environment. You are responsible for ensuring all dependencies are available.
38
+ </Tip>
39
+
40
+ #### Options
41
+
42
+ | Option | Flag | Description |
43
+ | ------ | ---- | ----------- |
44
+ | Transport | `--transport`, `-t` | Transport protocol to use (`stdio`, `streamable-http`, or `sse`) |
45
+ | Host | `--host` | Host to bind to when using http transport (default: 127.0.0.1) |
46
+ | Port | `--port`, `-p` | Port to bind to when using http transport (default: 8000) |
47
+ | Log Level | `--log-level`, `-l` | Log level (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
48
+
49
+ #### Server Specification
50
+
51
+ The server can be specified in two ways:
52
+ 1. `server.py` - imports the module and looks for a FastMCP object named `mcp`, `server`, or `app`. Errors if no such object is found.
53
+ 2. `server.py:custom_name` - imports and uses the specified server object
54
+
55
+ <Tip>
56
+ When using `fastmcp run`, it **ignores** the `if __name__ == "__main__"` block entirely. Instead, it finds your server object and calls its `run()` method directly with the transport options you specify. This means you can use `fastmcp run` to override the transport specified in your code.
57
+ </Tip>
58
+
59
+ For example, if your code contains:
60
+
61
+ ```python
62
+ # server.py
63
+ from fastmcp import FastMCP
64
+
65
+ mcp = FastMCP("MyServer")
66
+
67
+ @mcp.tool()
68
+ def hello(name: str) -> str:
69
+ return f"Hello, {name}!"
70
+
71
+ if __name__ == "__main__":
72
+ # This is ignored when using `fastmcp run`!
73
+ mcp.run(transport="stdio")
74
+ ```
75
+
76
+ You can run it with Streamable HTTP transport regardless of what's in the `__main__` block:
77
+
78
+ ```bash
79
+ fastmcp run server.py --transport streamable-http --port 8000
80
+ ```
81
+
82
+ **Example**
83
+
84
+ ```bash
85
+ # Run a server with Streamable HTTP transport on a custom port
86
+ fastmcp run server.py --transport streamable-http --port 8000
87
+ ```
88
+
89
+ ### `dev`
90
+
91
+ Run a MCP server with the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) for testing.
92
+
93
+ ```bash
94
+ fastmcp dev server.py
95
+ ```
96
+
97
+ <Tip>
98
+ This command runs your server in an isolated environment. All dependencies must be explicitly specified using the `--with` and/or `--with-editable` options.
99
+ </Tip>
100
+
101
+ <Warning>
102
+ The `dev` command is a shortcut for testing a server over STDIO only. When the Inspector launches, you may need to:
103
+ 1. Select "STDIO" from the transport dropdown
104
+ 2. Connect manually
105
+
106
+ This command does not support HTTP testing. To test a server over HTTP:
107
+ 1. Start your server manually with HTTP transport using either:
108
+ ```bash
109
+ fastmcp run server.py --transport streamable-http
110
+ ```
111
+ or
112
+ ```bash
113
+ python server.py # Assuming your __main__ block sets HTTP transport
114
+ ```
115
+ 2. Open the MCP Inspector separately and connect to your running server
116
+ </Warning>
117
+
118
+ #### Options
119
+
120
+ | Option | Flag | Description |
121
+ | ------ | ---- | ----------- |
122
+ | Editable Package | `--with-editable`, `-e` | Directory containing pyproject.toml to install in editable mode |
123
+ | Additional Packages | `--with` | Additional packages to install (can be used multiple times) |
124
+ | Inspector Version | `--inspector-version` | Version of the MCP Inspector to use |
125
+ | UI Port | `--ui-port` | Port for the MCP Inspector UI |
126
+ | Server Port | `--server-port` | Port for the MCP Inspector Proxy server |
127
+
128
+ **Example**
129
+
130
+ ```bash
131
+ # Run dev server with editable mode and additional packages
132
+ fastmcp dev server.py -e . --with pandas --with matplotlib
133
+ ```
134
+
135
+ ### `install`
136
+
137
+ Install a MCP server in the Claude desktop app.
138
+
139
+ ```bash
140
+ fastmcp install server.py
141
+ ```
142
+
143
+ <Tip>
144
+ This command installs your server in an isolated environment. All dependencies must be explicitly specified using the `--with` and/or `--with-editable` options.
145
+ </Tip>
146
+
147
+ <Warning>
148
+ The `install` command currently only sets up servers for STDIO transport. When installed in the Claude desktop app, your server will be run using STDIO regardless of any transport configuration in your code.
149
+ </Warning>
150
+
151
+ #### Options
152
+
153
+ | Option | Flag | Description |
154
+ | ------ | ---- | ----------- |
155
+ | Server Name | `--name`, `-n` | Custom name for the server |
156
+ | Editable Package | `--with-editable`, `-e` | Directory containing pyproject.toml to install in editable mode |
157
+ | Additional Packages | `--with` | Additional packages to install (can be used multiple times) |
158
+ | Environment Variables | `--env-var`, `-v` | Environment variables in KEY=VALUE format (can be used multiple times) |
159
+ | Environment File | `--env-file`, `-f` | Load environment variables from a .env file |
160
+
161
+ **Example**
162
+
163
+ ```bash
164
+ # Install server with custom name, dependencies, and environment variables
165
+ fastmcp install server.py -n "My Analysis Server" -e . --with pandas --env-var API_KEY=12345
166
+ ```
167
+
168
+ ### `version`
169
+
170
+ Display version information about FastMCP and related components.
171
+
172
+ ```bash
173
+ fastmcp version
174
+ ```
@@ -11,7 +11,7 @@ FastMCP servers can be run in different ways depending on your application's nee
11
11
 
12
12
  ## The `run()` Method
13
13
 
14
- The main way to run a FastMCP server from a Python script is by calling the `run()` method on a `FastMCP` instance.
14
+ FastMCP servers can be run directly from Python by calling the `run()` method on a `FastMCP` instance.
15
15
 
16
16
  <Tip>
17
17
  For maximum compatibility, it's best practice to place the `run()` call within an `if __name__ == "__main__":` block. This ensures the server starts only when the script is executed directly, not when imported as a module.
@@ -33,6 +33,34 @@ You can now run this MCP server by executing `python my_server.py`.
33
33
 
34
34
  MCP servers can be run with a variety of different transport options, depending on your application's requirements. The `run()` method can take a `transport` argument and other transport-specific keyword arguments to configure how the server operates.
35
35
 
36
+ ## The FastMCP CLI
37
+
38
+ FastMCP also provides a command-line interface for running servers without modifying the source code. After installing FastMCP, you can run your server directly from the command line:
39
+
40
+ ```bash
41
+ fastmcp run server.py
42
+ ```
43
+
44
+ <Tip>
45
+ **Important**: When using `fastmcp run`, it **ignores** the `if __name__ == "__main__"` block entirely. Instead, it looks for a FastMCP object named `mcp`, `server`, or `app` and calls its `run()` method directly with the transport options you specify.
46
+
47
+ This means you can use `fastmcp run` to override the transport specified in your code, which is particularly useful for testing or changing deployment methods without modifying the code.
48
+ </Tip>
49
+
50
+ You can specify transport options and other configuration:
51
+
52
+ ```bash
53
+ fastmcp run server.py --transport sse --port 9000
54
+ ```
55
+
56
+ For development and testing, you can use the `dev` command to run your server with the MCP Inspector:
57
+
58
+ ```bash
59
+ fastmcp dev server.py
60
+ ```
61
+
62
+ See the [CLI documentation](/deployment/cli) for detailed information about all available commands and options.
63
+
36
64
  ## Transport Options
37
65
 
38
66
  Below is a comparison of available transport options to help you choose the right one for your needs:
@@ -40,8 +68,8 @@ Below is a comparison of available transport options to help you choose the righ
40
68
  | Transport | Use Cases | Recommendation |
41
69
  | --------- | --------- | -------------- |
42
70
  | **STDIO** | Local tools, command-line scripts, and integrations with clients like Claude Desktop | Best for local tools and when clients manage server processes |
43
- | **Streamable HTTP** | Web-based deployments, microservices, exposing MCP over a network | Recommended choice for new web-based deployments |
44
- | **SSE** | Existing web-based deployments that rely on SSE | Suitable for compatibility with SSE clients; prefer Streamable HTTP for new projects |
71
+ | **Streamable HTTP** | Web-based deployments, microservices, exposing MCP over a network | Recommended choice for web-based deployments |
72
+ | **SSE** | Existing web-based deployments that rely on SSE | Deprecated - prefer Streamable HTTP for new projects |
45
73
 
46
74
  ### STDIO
47
75
 
@@ -64,7 +92,7 @@ When using Stdio transport, you will typically *not* run the server yourself as
64
92
 
65
93
  <VersionBadge version="2.3.0" />
66
94
 
67
- Streamable HTTP is a modern, efficient transport for exposing your MCP server via HTTP. It is generally recommended over SSE for new web-based deployments.
95
+ Streamable HTTP is a modern, efficient transport for exposing your MCP server via HTTP. It is the recommended transport for web-based deployments.
68
96
 
69
97
  To run a server using Streamable HTTP, you can use the `run()` method with the `transport` argument set to `"streamable-http"`. This will start a Uvicorn server on the default host (`127.0.0.1`), port (`8000`), and path (`/mcp`).
70
98
  <CodeGroup>
@@ -122,7 +150,12 @@ if __name__ == "__main__":
122
150
 
123
151
  ### SSE
124
152
 
125
- Server-Sent Events (SSE) is an HTTP-based protocol for server-to-client streaming. While FastMCP supports SSE, Streamable HTTP is preferred for new projects.
153
+ <Warning>
154
+ The SSE transport is deprecated and may be removed in a future version.
155
+ New applications should use Streamable HTTP transport instead.
156
+ </Warning>
157
+
158
+ Server-Sent Events (SSE) is an HTTP-based protocol for server-to-client streaming. While FastMCP still supports SSE, it is deprecated and Streamable HTTP is preferred for new projects.
126
159
 
127
160
  To run a server using SSE, you can use the `run()` method with the `transport` argument set to `"sse"`. This will start a Uvicorn server on the default host (`127.0.0.1`), port (`8000`), and with default SSE path (`/sse`) and message path (`/messages/`).
128
161
 
@@ -170,7 +203,6 @@ if __name__ == "__main__":
170
203
  port=4200,
171
204
  log_level="debug",
172
205
  path="/my-custom-sse-path",
173
- message_path="/my-custom-message-path/",
174
206
  )
175
207
  ```
176
208
  ```python {7} client.py
@@ -189,9 +221,37 @@ if __name__ == "__main__":
189
221
  ```
190
222
  </CodeGroup>
191
223
 
192
- Your client only needs to know the host, port, and "main" path; the message path will be transmitted to it as part of the connection handshake.
193
224
 
194
225
 
226
+ ## Async Usage
227
+
228
+ FastMCP provides both synchronous and asynchronous APIs for running your server. The `run()` method seen in previous examples is a synchronous method that internally uses `anyio.run()` to run the asynchronous server. For applications that are already running in an async context, FastMCP provides the `run_async()` method.
229
+
230
+ ```python {10-12}
231
+ from fastmcp import FastMCP
232
+ import asyncio
233
+
234
+ mcp = FastMCP(name="MyServer")
235
+
236
+ @mcp.tool()
237
+ def hello(name: str) -> str:
238
+ return f"Hello, {name}!"
239
+
240
+ async def main():
241
+ # Use run_async() in async contexts
242
+ await mcp.run_async(transport="streamable-http")
243
+
244
+ if __name__ == "__main__":
245
+ asyncio.run(main())
246
+ ```
247
+
248
+ <Warning>
249
+ The `run()` method cannot be called from inside an async function because it already creates its own async event loop internally. If you attempt to call `run()` from inside an async function, you'll get an error about the event loop already running.
250
+
251
+ Always use `run_async()` inside async functions and `run()` in synchronous contexts.
252
+ </Warning>
253
+
254
+ Both `run()` and `run_async()` accept the same transport arguments, so all the examples above apply to both methods.
195
255
 
196
256
  ## Custom Routes
197
257
 
@@ -50,8 +50,8 @@
50
50
  "servers/resources",
51
51
  "servers/prompts",
52
52
  "servers/context",
53
- "patterns/proxy",
54
- "patterns/composition"
53
+ "servers/proxy",
54
+ "servers/composition"
55
55
  ]
56
56
  },
57
57
  {
@@ -59,7 +59,8 @@
59
59
  "pages": [
60
60
  "deployment/running-server",
61
61
  "deployment/asgi",
62
- "deployment/authentication"
62
+ "deployment/authentication",
63
+ "deployment/cli"
63
64
  ]
64
65
  },
65
66
  {
@@ -86,5 +87,15 @@
86
87
  }
87
88
  ]
88
89
  },
90
+ "redirects": [
91
+ {
92
+ "destination": "/servers/proxy",
93
+ "source": "/patterns/proxy"
94
+ },
95
+ {
96
+ "destination": "/servers/composition",
97
+ "source": "/patterns/composition"
98
+ }
99
+ ],
89
100
  "theme": "mint"
90
101
  }
@@ -44,7 +44,7 @@ FastMCP root path: ~/Developer/fastmcp
44
44
  ```
45
45
  ## Upgrading from the Official MCP SDK
46
46
 
47
- Upgrading from the official MCP SDK's FastMCP 1.0 to FastMCP 2.0 is easy! The core server API is highly compatible, so after you install the `fastmcp` package, just change your import statement from `from mcp.server.fastmcp import FastMCP` to `from fastmcp import FastMCP`.
47
+ Upgrading from the official MCP SDK's FastMCP 1.0 to FastMCP 2.0 is generally straightforward. The core server API is highly compatible, and in many cases, changing your import statement from `from mcp.server.fastmcp import FastMCP` to `from fastmcp import FastMCP` will be sufficient.
48
48
 
49
49
 
50
50
  ```python {1-5}
@@ -56,8 +56,9 @@ from fastmcp import FastMCP
56
56
 
57
57
  mcp = FastMCP("My MCP Server")
58
58
  ```
59
-
60
- While the 1.0 server API is very stable for common use cases, FastMCP 2.0 introduces many new features (like the Client, proxying, composition) documented throughout this site. Review the documentation for details on new capabilities.
59
+ <Warning>
60
+ Prior to `fastmcp==2.3.0` and `mcp==1.8.0`, the 2.x API always mirrored the 1.0 API. However, as the projects diverge, this can not be guaranteed. You may see deprecation warnings if you attempt to use 1.0 APIs in FastMCP 2.x. Please refer to this documentation for details on new capabilities.
61
+ </Warning>
61
62
 
62
63
  ## Installing for Development
63
64
 
@@ -27,7 +27,7 @@ if __name__ == "__main__":
27
27
  ## FastMCP 2.0 and the Official MCP SDK
28
28
 
29
29
  <Tip>
30
- Recognize the `FastMCP` name? You might have used the version integrated into the [official MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk), which was based on **FastMCP 1.0**.
30
+ Recognize the `FastMCP` name? You might have seen the version that was contributed to the [official MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk), which was based on **FastMCP 1.0**.
31
31
 
32
32
 
33
33
  **Welcome to FastMCP 2.0!** This is the [actively developed successor](https://github.com/jlowin/fastmcp), and it significantly expands on 1.0 by introducing powerful client capabilities, server proxying & composition, OpenAPI/FastAPI integration, and more advanced features.