fastmcp 2.3.0rc1__tar.gz → 2.3.2__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.0rc1 → fastmcp-2.3.2}/.github/workflows/run-tests.yml +1 -1
  2. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/PKG-INFO +43 -47
  3. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/README.md +41 -45
  4. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/clients/transports.mdx +64 -65
  5. fastmcp-2.3.2/docs/deployment/asgi.mdx +211 -0
  6. fastmcp-2.3.2/docs/deployment/cli.mdx +174 -0
  7. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/deployment/running-server.mdx +88 -7
  8. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/docs.json +15 -3
  9. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/getting-started/installation.mdx +5 -4
  10. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/getting-started/quickstart.mdx +2 -2
  11. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/getting-started/welcome.mdx +8 -1
  12. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/servers/fastmcp.mdx +7 -2
  13. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/pyproject.toml +3 -11
  14. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/cli/cli.py +7 -8
  15. fastmcp-2.3.2/src/fastmcp/low_level/README.md +1 -0
  16. fastmcp-2.3.2/src/fastmcp/low_level/sse_server_transport.py +104 -0
  17. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/server/http.py +64 -43
  18. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/server/proxy.py +1 -1
  19. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/server/server.py +148 -47
  20. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/tools/tool.py +1 -1
  21. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/utilities/tests.py +1 -1
  22. fastmcp-2.3.2/tests/cli/test_cli.py +478 -0
  23. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/client/test_sse.py +30 -1
  24. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/client/test_streamable_http.py +40 -1
  25. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_http_dependencies.py +1 -1
  26. fastmcp-2.3.2/tests/server/test_http_middleware.py +219 -0
  27. fastmcp-2.3.2/tests/test_deprecated.py +82 -0
  28. fastmcp-2.3.2/tests/tools/__init__.py +0 -0
  29. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/tools/test_tool_manager.py +28 -0
  30. fastmcp-2.3.2/tests/utilities/test_cache.py +233 -0
  31. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/test_types.py +51 -0
  32. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/uv.lock +21 -3
  33. fastmcp-2.3.0rc1/src/fastmcp/server/streamable_http_manager.py +0 -241
  34. fastmcp-2.3.0rc1/test.py +0 -12
  35. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/.cursor/rules/core-mcp-objects.mdc +0 -0
  36. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/.github/ISSUE_TEMPLATE/bug.yml +0 -0
  37. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  38. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/.github/ISSUE_TEMPLATE/enhancement.yml +0 -0
  39. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/.github/release.yml +0 -0
  40. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/.github/workflows/publish.yml +0 -0
  41. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/.github/workflows/run-static.yml +0 -0
  42. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/.gitignore +0 -0
  43. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/.pre-commit-config.yaml +0 -0
  44. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/LICENSE +0 -0
  45. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/Windows_Notes.md +0 -0
  46. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/assets/demo-inspector.png +0 -0
  47. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/clients/client.mdx +0 -0
  48. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/deployment/authentication.mdx +0 -0
  49. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/patterns/contrib.mdx +0 -0
  50. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/patterns/decorating-methods.mdx +0 -0
  51. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/patterns/fastapi.mdx +0 -0
  52. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/patterns/http-requests.mdx +0 -0
  53. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/patterns/openapi.mdx +0 -0
  54. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/patterns/testing.mdx +0 -0
  55. {fastmcp-2.3.0rc1/docs/patterns → fastmcp-2.3.2/docs/servers}/composition.mdx +0 -0
  56. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/servers/context.mdx +0 -0
  57. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/servers/prompts.mdx +0 -0
  58. {fastmcp-2.3.0rc1/docs/patterns → fastmcp-2.3.2/docs/servers}/proxy.mdx +0 -0
  59. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/servers/resources.mdx +0 -0
  60. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/servers/tools.mdx +0 -0
  61. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/snippets/version-badge.mdx +0 -0
  62. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/docs/style.css +0 -0
  63. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/complex_inputs.py +0 -0
  64. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/desktop.py +0 -0
  65. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/echo.py +0 -0
  66. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/memory.py +0 -0
  67. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/mount_example.py +0 -0
  68. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/sampling.py +0 -0
  69. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/screenshot.py +0 -0
  70. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/serializer.py +0 -0
  71. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/simple_echo.py +0 -0
  72. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/smart_home/README.md +0 -0
  73. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/smart_home/pyproject.toml +0 -0
  74. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/smart_home/src/smart_home/__init__.py +0 -0
  75. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/smart_home/src/smart_home/__main__.py +0 -0
  76. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/smart_home/src/smart_home/hub.py +0 -0
  77. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/smart_home/src/smart_home/lights/__init__.py +0 -0
  78. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/smart_home/src/smart_home/lights/hue_utils.py +0 -0
  79. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/smart_home/src/smart_home/lights/server.py +0 -0
  80. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/smart_home/src/smart_home/py.typed +0 -0
  81. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/smart_home/src/smart_home/settings.py +0 -0
  82. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/smart_home/uv.lock +0 -0
  83. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/examples/text_me.py +0 -0
  84. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/justfile +0 -0
  85. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/__init__.py +0 -0
  86. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/cli/__init__.py +0 -0
  87. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/cli/claude.py +0 -0
  88. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/client/__init__.py +0 -0
  89. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/client/base.py +0 -0
  90. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/client/client.py +0 -0
  91. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/client/logging.py +0 -0
  92. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/client/roots.py +0 -0
  93. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/client/sampling.py +0 -0
  94. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/client/transports.py +0 -0
  95. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/contrib/README.md +0 -0
  96. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/contrib/bulk_tool_caller/README.md +0 -0
  97. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/contrib/bulk_tool_caller/__init__.py +0 -0
  98. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/contrib/bulk_tool_caller/bulk_tool_caller.py +0 -0
  99. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/contrib/bulk_tool_caller/example.py +0 -0
  100. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/contrib/mcp_mixin/README.md +0 -0
  101. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/contrib/mcp_mixin/__init__.py +0 -0
  102. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/contrib/mcp_mixin/example.py +0 -0
  103. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/contrib/mcp_mixin/mcp_mixin.py +0 -0
  104. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/exceptions.py +0 -0
  105. {fastmcp-2.3.0rc1/tests → fastmcp-2.3.2/src/fastmcp/low_level}/__init__.py +0 -0
  106. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/prompts/__init__.py +0 -0
  107. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/prompts/prompt.py +0 -0
  108. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/prompts/prompt_manager.py +0 -0
  109. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/py.typed +0 -0
  110. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/resources/__init__.py +0 -0
  111. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/resources/resource.py +0 -0
  112. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/resources/resource_manager.py +0 -0
  113. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/resources/template.py +0 -0
  114. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/resources/types.py +0 -0
  115. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/server/__init__.py +0 -0
  116. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/server/context.py +0 -0
  117. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/server/dependencies.py +0 -0
  118. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/server/openapi.py +0 -0
  119. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/settings.py +0 -0
  120. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/tools/__init__.py +0 -0
  121. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/tools/tool_manager.py +0 -0
  122. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/utilities/__init__.py +0 -0
  123. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/utilities/cache.py +0 -0
  124. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/utilities/decorators.py +0 -0
  125. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/utilities/json_schema.py +0 -0
  126. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/utilities/logging.py +0 -0
  127. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/utilities/openapi.py +0 -0
  128. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/src/fastmcp/utilities/types.py +0 -0
  129. {fastmcp-2.3.0rc1/tests/prompts → fastmcp-2.3.2/tests}/__init__.py +0 -0
  130. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/cli/test_run.py +0 -0
  131. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/client/__init__.py +0 -0
  132. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/client/test_client.py +0 -0
  133. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/client/test_logs.py +0 -0
  134. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/client/test_roots.py +0 -0
  135. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/client/test_sampling.py +0 -0
  136. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/conftest.py +0 -0
  137. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/contrib/__init__.py +0 -0
  138. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/contrib/test_bulk_tool_caller.py +0 -0
  139. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/contrib/test_mcp_mixin.py +0 -0
  140. {fastmcp-2.3.0rc1/tests/resources → fastmcp-2.3.2/tests/prompts}/__init__.py +0 -0
  141. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/prompts/test_prompt.py +0 -0
  142. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/prompts/test_prompt_manager.py +0 -0
  143. {fastmcp-2.3.0rc1/tests/server → fastmcp-2.3.2/tests/resources}/__init__.py +0 -0
  144. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/resources/test_file_resources.py +0 -0
  145. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/resources/test_function_resources.py +0 -0
  146. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/resources/test_resource_manager.py +0 -0
  147. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/resources/test_resource_template.py +0 -0
  148. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/resources/test_resources.py +0 -0
  149. {fastmcp-2.3.0rc1/tests/tools → fastmcp-2.3.2/tests/server}/__init__.py +0 -0
  150. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_auth_integration.py +0 -0
  151. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_context.py +0 -0
  152. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_file_server.py +0 -0
  153. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_import_server.py +0 -0
  154. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_lifespan.py +0 -0
  155. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_mount.py +0 -0
  156. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_openapi.py +0 -0
  157. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_proxy.py +0 -0
  158. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_run_server.py +0 -0
  159. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_server.py +0 -0
  160. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_server_interactions.py +0 -0
  161. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/server/test_tool_annotations.py +0 -0
  162. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/test_examples.py +0 -0
  163. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/test_servers/fastmcp_server.py +0 -0
  164. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/test_servers/sse.py +0 -0
  165. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/test_servers/stdio.py +0 -0
  166. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/tools/test_tool.py +0 -0
  167. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/__init__.py +0 -0
  168. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/openapi/__init__.py +0 -0
  169. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/openapi/conftest.py +0 -0
  170. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/openapi/test_openapi.py +0 -0
  171. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/openapi/test_openapi_advanced.py +0 -0
  172. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/openapi/test_openapi_fastapi.py +0 -0
  173. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/test_decorated_function.py +0 -0
  174. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/test_json_schema.py +0 -0
  175. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/test_logging.py +0 -0
  176. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/test_tests.py +0 -0
  177. {fastmcp-2.3.0rc1 → fastmcp-2.3.2}/tests/utilities/test_typeadapter.py +0 -0
@@ -59,4 +59,4 @@ jobs:
59
59
  uv pip install pyreadline3
60
60
 
61
61
  - name: Run tests
62
- run: uv run --frozen pytest -vv
62
+ run: uv run --frozen pytest
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastmcp
3
- Version: 2.3.0rc1
3
+ Version: 2.3.2
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
@@ -19,7 +19,7 @@ Classifier: Typing :: Typed
19
19
  Requires-Python: >=3.10
20
20
  Requires-Dist: exceptiongroup>=1.2.2
21
21
  Requires-Dist: httpx>=0.28.1
22
- Requires-Dist: mcp
22
+ Requires-Dist: mcp<2.0.0,>=1.8.0
23
23
  Requires-Dist: openapi-pydantic>=0.5.1
24
24
  Requires-Dist: python-dotenv>=1.1.0
25
25
  Requires-Dist: rich>=13.9.4
@@ -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
  >
@@ -76,7 +76,13 @@ fastmcp run server.py
76
76
 
77
77
  ### 📚 Documentation
78
78
 
79
- This readme provides only a high-level overview. For detailed guides, API references, and advanced patterns, please refer to the complete FastMCP documentation at **[gofastmcp.com](https://gofastmcp.com)**.
79
+ FastMCP's complete documentation is available at **[gofastmcp.com](https://gofastmcp.com)**, including detailed guides, API references, and advanced patterns. This readme provides only a high-level overview.
80
+
81
+ Documentation is also available in [llms.txt format](https://llmstxt.org/), which is a simple markdown standard that LLMs can consume easily.
82
+
83
+ There are two ways to access the LLM-friendly documentation:
84
+ - [`llms.txt`](https://gofastmcp.com/llms.txt) is essentially a sitemap, listing all the pages in the documentation.
85
+ - [`llms-full.txt`](https://gofastmcp.com/llms-full.txt) contains the entire documentation. Note this may exceed the context window of your LLM.
80
86
 
81
87
  ---
82
88
 
@@ -302,50 +308,40 @@ Learn more: [**OpenAPI Integration**](https://gofastmcp.com/patterns/openapi) |
302
308
 
303
309
  ## Running Your Server
304
310
 
305
- You can run your FastMCP server in several ways:
306
-
307
- 1. **Development (`fastmcp dev`)**: Recommended for building and testing. Provides an interactive testing environment with the MCP Inspector.
308
- ```bash
309
- fastmcp dev server.py
310
- # Optionally add temporary dependencies
311
- fastmcp dev server.py --with pandas numpy
312
- ```
313
-
314
- 2. **FastMCP CLI**: Run your server with the FastMCP CLI. This can autodetect and load your server object and run it with any transport configuration you want.
315
- ```bash
316
- fastmcp run path/to/server.py:server_object
317
-
318
- # Run as SSE on port 4200
319
- fastmcp run path/to/server.py:server_object --transport sse --port 4200
320
- ```
321
- FastMCP will auto-detect the server object if it's named `mcp`, `app`, or `server`. In these cases, you can omit the `:server_object` part unless you need to select a specific object.
322
-
323
- 3. **Direct Execution**: For maximum compatibility with the MCP ecosystem, you can run your server directly as part of a Python script. You will typically do this within an `if __name__ == "__main__":` block in your script:
324
- ```python
325
- # Add this to server.py
326
- if __name__ == "__main__":
327
- # Default: runs stdio transport
328
- mcp.run()
329
-
330
- # Example: Run with SSE transport on a specific port
331
- mcp.run(transport="sse", host="127.0.0.1", port=9000)
332
- ```
333
- Run your script:
334
- ```bash
335
- python server.py
336
- # or using uv to manage the environment
337
- uv run python server.py
338
- ```
339
- 4. **Claude Desktop Integration (`fastmcp install`)**: The easiest way to make your server persistently available in the Claude Desktop app. It handles creating an isolated environment using `uv`.
340
- ```bash
341
- fastmcp install server.py --name "My Analysis Tool"
342
- # Optionally add dependencies and environment variables
343
- fastmcp install server.py --with requests -v API_KEY=123 -f .env
344
- ```
345
-
346
-
347
- See the [**Server Documentation**](https://gofastmcp.com/servers/fastmcp#running-the-server) for more details on transports and configuration.
311
+ The main way to run a FastMCP server is by calling the `run()` method on your server instance:
312
+
313
+ ```python
314
+ # server.py
315
+ from fastmcp import FastMCP
316
+
317
+ mcp = FastMCP("Demo 🚀")
318
+
319
+ @mcp.tool()
320
+ def hello(name: str) -> str:
321
+ return f"Hello, {name}!"
322
+
323
+ if __name__ == "__main__":
324
+ mcp.run() # Default: uses STDIO transport
325
+ ```
326
+
327
+ FastMCP supports three transport protocols:
328
+
329
+ **STDIO (Default)**: Best for local tools and command-line scripts.
330
+ ```python
331
+ mcp.run(transport="stdio") # Default, so transport argument is optional
332
+ ```
333
+
334
+ **Streamable HTTP**: Recommended for web deployments.
335
+ ```python
336
+ mcp.run(transport="streamable-http", host="127.0.0.1", port=8000, path="/mcp")
337
+ ```
338
+
339
+ **SSE**: For compatibility with existing SSE clients.
340
+ ```python
341
+ mcp.run(transport="sse", host="127.0.0.1", port=8000)
342
+ ```
348
343
 
344
+ See the [**Running Server Documentation**](https://gofastmcp.com/deployment/running-server) for more details.
349
345
 
350
346
  ## Contributing
351
347
 
@@ -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
  >
@@ -47,7 +47,13 @@ fastmcp run server.py
47
47
 
48
48
  ### 📚 Documentation
49
49
 
50
- This readme provides only a high-level overview. For detailed guides, API references, and advanced patterns, please refer to the complete FastMCP documentation at **[gofastmcp.com](https://gofastmcp.com)**.
50
+ FastMCP's complete documentation is available at **[gofastmcp.com](https://gofastmcp.com)**, including detailed guides, API references, and advanced patterns. This readme provides only a high-level overview.
51
+
52
+ Documentation is also available in [llms.txt format](https://llmstxt.org/), which is a simple markdown standard that LLMs can consume easily.
53
+
54
+ There are two ways to access the LLM-friendly documentation:
55
+ - [`llms.txt`](https://gofastmcp.com/llms.txt) is essentially a sitemap, listing all the pages in the documentation.
56
+ - [`llms-full.txt`](https://gofastmcp.com/llms-full.txt) contains the entire documentation. Note this may exceed the context window of your LLM.
51
57
 
52
58
  ---
53
59
 
@@ -273,50 +279,40 @@ Learn more: [**OpenAPI Integration**](https://gofastmcp.com/patterns/openapi) |
273
279
 
274
280
  ## Running Your Server
275
281
 
276
- You can run your FastMCP server in several ways:
277
-
278
- 1. **Development (`fastmcp dev`)**: Recommended for building and testing. Provides an interactive testing environment with the MCP Inspector.
279
- ```bash
280
- fastmcp dev server.py
281
- # Optionally add temporary dependencies
282
- fastmcp dev server.py --with pandas numpy
283
- ```
284
-
285
- 2. **FastMCP CLI**: Run your server with the FastMCP CLI. This can autodetect and load your server object and run it with any transport configuration you want.
286
- ```bash
287
- fastmcp run path/to/server.py:server_object
288
-
289
- # Run as SSE on port 4200
290
- fastmcp run path/to/server.py:server_object --transport sse --port 4200
291
- ```
292
- FastMCP will auto-detect the server object if it's named `mcp`, `app`, or `server`. In these cases, you can omit the `:server_object` part unless you need to select a specific object.
293
-
294
- 3. **Direct Execution**: For maximum compatibility with the MCP ecosystem, you can run your server directly as part of a Python script. You will typically do this within an `if __name__ == "__main__":` block in your script:
295
- ```python
296
- # Add this to server.py
297
- if __name__ == "__main__":
298
- # Default: runs stdio transport
299
- mcp.run()
300
-
301
- # Example: Run with SSE transport on a specific port
302
- mcp.run(transport="sse", host="127.0.0.1", port=9000)
303
- ```
304
- Run your script:
305
- ```bash
306
- python server.py
307
- # or using uv to manage the environment
308
- uv run python server.py
309
- ```
310
- 4. **Claude Desktop Integration (`fastmcp install`)**: The easiest way to make your server persistently available in the Claude Desktop app. It handles creating an isolated environment using `uv`.
311
- ```bash
312
- fastmcp install server.py --name "My Analysis Tool"
313
- # Optionally add dependencies and environment variables
314
- fastmcp install server.py --with requests -v API_KEY=123 -f .env
315
- ```
316
-
317
-
318
- See the [**Server Documentation**](https://gofastmcp.com/servers/fastmcp#running-the-server) for more details on transports and configuration.
282
+ The main way to run a FastMCP server is by calling the `run()` method on your server instance:
283
+
284
+ ```python
285
+ # server.py
286
+ from fastmcp import FastMCP
287
+
288
+ mcp = FastMCP("Demo 🚀")
289
+
290
+ @mcp.tool()
291
+ def hello(name: str) -> str:
292
+ return f"Hello, {name}!"
293
+
294
+ if __name__ == "__main__":
295
+ mcp.run() # Default: uses STDIO transport
296
+ ```
297
+
298
+ FastMCP supports three transport protocols:
299
+
300
+ **STDIO (Default)**: Best for local tools and command-line scripts.
301
+ ```python
302
+ mcp.run(transport="stdio") # Default, so transport argument is optional
303
+ ```
304
+
305
+ **Streamable HTTP**: Recommended for web deployments.
306
+ ```python
307
+ mcp.run(transport="streamable-http", host="127.0.0.1", port=8000, path="/mcp")
308
+ ```
309
+
310
+ **SSE**: For compatibility with existing SSE clients.
311
+ ```python
312
+ mcp.run(transport="sse", host="127.0.0.1", port=8000)
313
+ ```
319
314
 
315
+ See the [**Running Server Documentation**](https://gofastmcp.com/deployment/running-server) for more details.
320
316
 
321
317
  ## Contributing
322
318
 
@@ -14,6 +14,69 @@ The FastMCP `Client` relies on a `ClientTransport` object to handle the specific
14
14
  While the `Client` often infers the correct transport automatically (see [Client Overview](/clients/client#transport-inference)), you can also instantiate transports explicitly for more control.
15
15
 
16
16
 
17
+ ## Network Transports
18
+
19
+ These transports connect to servers running over a network, typically long-running services accessible via URLs.
20
+
21
+ ### Streamable HTTP
22
+
23
+ <VersionBadge version="2.3.0" />
24
+
25
+ * **Class:** `fastmcp.client.transports.StreamableHttpTransport`
26
+ * **Inferred From:** `http://` or `https://` URLs (default for HTTP URLs as of v2.3.0)
27
+ * **Use Case:** Connecting to persistent MCP servers exposed over HTTP/S using FastMCP's `mcp.run(transport="streamable-http")` mode.
28
+
29
+ Streamable HTTP is the recommended transport for web-based deployments, providing efficient bidirectional communication over HTTP.
30
+
31
+ ```python
32
+ from fastmcp import Client
33
+ from fastmcp.client.transports import StreamableHttpTransport
34
+
35
+ http_url = "http://localhost:8000/mcp"
36
+
37
+ # Option 1: Inferred transport (default for HTTP URLs)
38
+ client_inferred = Client(http_url)
39
+
40
+ # Option 2: Explicit transport (e.g., to add custom headers)
41
+ headers = {"Authorization": "Bearer mytoken"}
42
+ transport_explicit = StreamableHttpTransport(url=http_url, headers=headers)
43
+ client_explicit = Client(transport_explicit)
44
+
45
+ async def use_streamable_http_client(client):
46
+ async with client:
47
+ tools = await client.list_tools()
48
+ print(f"Connected via Streamable HTTP, found tools: {tools}")
49
+
50
+ # asyncio.run(use_streamable_http_client(client_inferred))
51
+ # asyncio.run(use_streamable_http_client(client_explicit))
52
+ ```
53
+
54
+ ### SSE (Server-Sent Events)
55
+
56
+ * **Class:** `fastmcp.client.transports.SSETransport`
57
+ * **Inferred From:** Not automatically inferred for most HTTP URLs (as of v2.3.0)
58
+ * **Use Case:** Connecting to MCP servers using Server-Sent Events, often using FastMCP's `mcp.run(transport="sse")` mode.
59
+
60
+ While SSE is still supported, Streamable HTTP is the recommended transport for new web-based deployments.
61
+
62
+ ```python
63
+ from fastmcp import Client
64
+ from fastmcp.client.transports import SSETransport
65
+
66
+ sse_url = "http://localhost:8000/sse"
67
+
68
+ # Since v2.3.0, HTTP URLs default to StreamableHttpTransport,
69
+ # so you must explicitly use SSETransport for SSE connections
70
+ transport_explicit = SSETransport(url=sse_url)
71
+ client_explicit = Client(transport_explicit)
72
+
73
+ async def use_sse_client(client):
74
+ async with client:
75
+ tools = await client.list_tools()
76
+ print(f"Connected via SSE, found tools: {tools}")
77
+
78
+ # asyncio.run(use_sse_client(client_explicit))
79
+ ```
17
80
  ## Stdio Transports
18
81
 
19
82
  These transports manage an MCP server running as a subprocess, communicating with it via standard input (stdin) and standard output (stdout). This is the standard mechanism used by clients like Claude Desktop.
@@ -133,70 +196,6 @@ client = Client(transport)
133
196
  # async with client:
134
197
  # response = await client.call_tool("get_npm_data", {})
135
198
  ```
136
- ## Network Transports
137
-
138
- These transports connect to servers running over a network, typically long-running services accessible via URLs.
139
-
140
- ### SSE (Server-Sent Events)
141
-
142
- * **Class:** `fastmcp.client.transports.SSETransport`
143
- * **Inferred From:** `http://` or `https://` URLs
144
- * **Use Case:** Connecting to persistent MCP servers exposed over HTTP/S, often using FastMCP's `mcp.run(transport="sse")` mode.
145
-
146
- SSE is a simple, unidirectional protocol where the server pushes messages to the client over a standard HTTP connection.
147
-
148
- ```python
149
- from fastmcp import Client
150
- from fastmcp.client.transports import SSETransport
151
-
152
- sse_url = "http://localhost:8000/sse"
153
-
154
- # Option 1: Inferred transport
155
- client_inferred = Client(sse_url)
156
-
157
- # Option 2: Explicit transport (e.g., to add custom headers)
158
- headers = {"Authorization": "Bearer mytoken"}
159
- transport_explicit = SSETransport(url=sse_url, headers=headers)
160
- client_explicit = Client(transport_explicit)
161
-
162
- async def use_sse_client(client):
163
- async with client:
164
- tools = await client.list_tools()
165
- print(f"Connected via SSE, found tools: {tools}")
166
-
167
- # asyncio.run(use_sse_client(client_inferred))
168
- # asyncio.run(use_sse_client(client_explicit))
169
- ```
170
-
171
- ### WebSocket
172
-
173
- * **Class:** `fastmcp.client.transports.WSTransport`
174
- * **Inferred From:** `ws://` or `wss://` URLs
175
- * **Use Case:** Connecting to MCP servers using the WebSocket protocol for bidirectional communication.
176
-
177
- WebSockets provide a persistent, full-duplex connection between client and server.
178
-
179
- ```python
180
- from fastmcp import Client
181
- from fastmcp.client.transports import WSTransport
182
-
183
- ws_url = "ws://localhost:9000"
184
-
185
- # Option 1: Inferred transport
186
- client_inferred = Client(ws_url)
187
-
188
- # Option 2: Explicit transport
189
- transport_explicit = WSTransport(url=ws_url)
190
- client_explicit = Client(transport_explicit)
191
-
192
- async def use_ws_client(client):
193
- async with client:
194
- tools = await client.list_tools()
195
- print(f"Connected via WebSocket, found tools: {tools}")
196
-
197
- # asyncio.run(use_ws_client(client_inferred))
198
- # asyncio.run(use_ws_client(client_explicit))
199
- ```
200
199
 
201
200
  ## In-Memory Transports
202
201
 
@@ -240,6 +239,6 @@ Communication happens through efficient in-memory queues, making it very fast.
240
239
  ## Choosing a Transport
241
240
 
242
241
  * **Local Development/Testing:** Use `PythonStdioTransport` (inferred from `.py` files) or `FastMCPTransport` (for same-process testing).
243
- * **Connecting to Remote/Persistent Servers:** Use `SSETransport` (for `http/s`) or `WSTransport` (for `ws/s`).
242
+ * **Connecting to Remote/Persistent Servers:** Use `StreamableHttpTransport` (recommended, default for HTTP URLs) or `SSETransport` (legacy option).
244
243
  * **Running Packaged Tools:** Use `UvxStdioTransport` (Python/uv) or `NpxStdioTransport` (Node/npm) if you need to run MCP servers without local installation.
245
244
  * **Integrating with Claude Desktop (or similar):** These tools typically expect to run a Python script, so your server should be runnable via `python your_server.py`, making `PythonStdioTransport` the relevant mechanism on the client side.
@@ -0,0 +1,211 @@
1
+ ---
2
+ title: Integrating FastMCP in ASGI Applications
3
+ sidebarTitle: ASGI Integration
4
+ description: Integrate FastMCP servers into existing Starlette, FastAPI, or other ASGI applications
5
+ icon: plug
6
+ ---
7
+
8
+ import { VersionBadge } from '/snippets/version-badge.mdx'
9
+
10
+
11
+ While FastMCP provides standalone server capabilities, you can also integrate your FastMCP server into existing web applications. This approach is useful for:
12
+
13
+ - Adding MCP functionality to an existing website or API
14
+ - Mounting MCP servers under specific URL paths
15
+ - Combining multiple services in a single application
16
+ - Leveraging existing authentication and middleware
17
+
18
+ Please note that all FastMCP servers have a `run()` method that can be used to start the server. This guide focuses on integration with broader ASGI frameworks.
19
+
20
+ ## ASGI Server
21
+
22
+ FastMCP servers can be created as [Starlette](https://www.starlette.io/) ASGI apps for straightforward hosting or integration into existing applications.
23
+
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>
29
+
30
+ ```python
31
+ from fastmcp import FastMCP
32
+
33
+ mcp = FastMCP("MyServer")
34
+
35
+ @mcp.tool()
36
+ def hello(name: str) -> str:
37
+ return f"Hello, {name}!"
38
+
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")
44
+ ```
45
+
46
+ Both approaches return a Starlette application that can be integrated with other ASGI-compatible web frameworks.
47
+
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:
49
+
50
+ ```python
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")
56
+ ```
57
+
58
+ ### Running the Server
59
+
60
+ To run the FastMCP server, you can use the `uvicorn` ASGI server:
61
+
62
+ ```python
63
+ from fastmcp import FastMCP
64
+ import uvicorn
65
+
66
+ mcp = FastMCP("MyServer")
67
+
68
+ http_app = mcp.http_app()
69
+
70
+ if __name__ == "__main__":
71
+ uvicorn.run(http_app, host="0.0.0.0", port=8000)
72
+ ```
73
+
74
+ Or, from the command line:
75
+
76
+ ```bash
77
+ uvicorn path.to.your.app:http_app --host 0.0.0.0 --port 8000
78
+ ```
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
+ ```
102
+
103
+
104
+ ## Starlette Integration
105
+
106
+ <VersionBadge version="2.3.1" />
107
+
108
+ You can mount your FastMCP server in another Starlette application:
109
+
110
+ ```python
111
+ from fastmcp import FastMCP
112
+ from starlette.applications import Starlette
113
+ from starlette.routing import Mount
114
+
115
+ # Create your FastMCP server as well as any tools, resources, etc.
116
+ mcp = FastMCP("MyServer")
117
+
118
+ # Create the ASGI app
119
+ mcp_app = mcp.http_app(path='/mcp')
120
+
121
+ # Create a Starlette app and mount the MCP server
122
+ app = Starlette(
123
+ routes=[
124
+ Mount("/mcp-server", app=mcp_app),
125
+ # Add other routes as needed
126
+ ],
127
+ lifespan=mcp_app.router.lifespan_context,
128
+ )
129
+ ```
130
+
131
+ The MCP endpoint will be available at `/mcp-server/mcp` of the resulting Starlette app.
132
+
133
+ <Warning>
134
+ For Streamable HTTP transport, you **must** pass the lifespan context from the FastMCP app to the resulting Starlette app, as nested lifespans are not recognized. Otherwise, the FastMCP server's session manager will not be properly initialized.
135
+ </Warning>
136
+
137
+ ### Nested Mounts
138
+
139
+
140
+ You can create complex routing structures by nesting mounts:
141
+
142
+ ```python
143
+ from fastmcp import FastMCP
144
+ from starlette.applications import Starlette
145
+ from starlette.routing import Mount
146
+
147
+ # Create your FastMCP server as well as any tools, resources, etc.
148
+ mcp = FastMCP("MyServer")
149
+
150
+ # Create the ASGI app
151
+ mcp_app = mcp.http_app(path='/mcp')
152
+
153
+ # Create nested application structure
154
+ inner_app = Starlette(routes=[Mount("/inner", app=mcp_app)])
155
+ app = Starlette(
156
+ routes=[Mount("/outer", app=inner_app)],
157
+ lifespan=mcp_app.router.lifespan_context,
158
+ )
159
+ ```
160
+
161
+ In this setup, the MCP server is accessible at the `/outer/inner/mcp` path of the resulting Starlette app.
162
+
163
+ <Warning>
164
+ For Streamable HTTP transport, you **must** pass the lifespan context from the FastMCP app to the *outer* Starlette app, as nested lifespans are not recognized. Otherwise, the FastMCP server's session manager will not be properly initialized.
165
+ </Warning>
166
+ ## FastAPI Integration
167
+
168
+ <VersionBadge version="2.3.1" />
169
+
170
+ FastAPI is built on Starlette, so you can mount your FastMCP server in a similar way:
171
+
172
+ ```python
173
+ from fastmcp import FastMCP
174
+ from fastapi import FastAPI
175
+ from starlette.routing import Mount
176
+
177
+ # Create your FastMCP server as well as any tools, resources, etc.
178
+ mcp = FastMCP("MyServer")
179
+
180
+ # Create the ASGI app
181
+ mcp_app = mcp.http_app(path='/mcp')
182
+
183
+ # Create a FastAPI app and mount the MCP server
184
+ app = FastAPI(lifespan=mcp_app.router.lifespan_context)
185
+ app.mount("/mcp-server", mcp_app)
186
+ ```
187
+
188
+ The MCP endpoint will be available at `/mcp-server/mcp` of the resulting FastAPI app.
189
+
190
+ <Warning>
191
+ For Streamable HTTP transport, you **must** pass the lifespan context from the FastMCP app to the resulting FastAPI app, as nested lifespans are not recognized. Otherwise, the FastMCP server's session manager will not be properly initialized.
192
+ </Warning>
193
+
194
+
195
+ ## Custom Routes
196
+
197
+ In addition to adding your FastMCP server to an existing ASGI app, you can also add custom web routes to your FastMCP server, which will be exposed alongside the MCP endpoint. To do so, use the `@custom_route` decorator. Note that this is less flexible than using a full ASGI framework, but can be useful for adding simple endpoints like health checks to your standalone server.
198
+
199
+ ```python
200
+ from fastmcp import FastMCP
201
+ from starlette.requests import Request
202
+ from starlette.responses import JSONResponse
203
+
204
+ mcp = FastMCP("MyServer")
205
+
206
+ @mcp.custom_route("/health", methods=["GET"])
207
+ async def health_check(request: Request) -> JSONResponse:
208
+ return JSONResponse({"status": "healthy"})
209
+ ```
210
+
211
+ These routes will be included in the FastMCP app when mounted in your web application.