fastmcp 2.1.0__tar.gz → 2.1.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 (129) hide show
  1. {fastmcp-2.1.0 → fastmcp-2.1.2}/.github/workflows/run-static.yml +12 -0
  2. {fastmcp-2.1.0 → fastmcp-2.1.2}/.github/workflows/run-tests.yml +1 -1
  3. fastmcp-2.1.0/README.md → fastmcp-2.1.2/PKG-INFO +100 -51
  4. fastmcp-2.1.0/PKG-INFO → fastmcp-2.1.2/README.md +72 -68
  5. fastmcp-2.1.2/docs/clients/overview.mdx +252 -0
  6. fastmcp-2.1.2/docs/clients/transports.mdx +241 -0
  7. fastmcp-2.1.2/docs/docs.json +74 -0
  8. fastmcp-2.1.2/docs/getting-started/installation.mdx +62 -0
  9. fastmcp-2.1.2/docs/getting-started/quickstart.mdx +127 -0
  10. fastmcp-2.1.2/docs/getting-started/welcome.mdx +59 -0
  11. fastmcp-2.1.2/docs/patterns/composition.mdx +186 -0
  12. fastmcp-2.1.2/docs/patterns/decorating-methods.mdx +201 -0
  13. fastmcp-2.1.2/docs/patterns/fastapi.mdx +114 -0
  14. fastmcp-2.1.2/docs/patterns/openapi.mdx +174 -0
  15. fastmcp-2.1.2/docs/patterns/proxying.mdx +109 -0
  16. fastmcp-2.1.2/docs/servers/context.mdx +281 -0
  17. fastmcp-2.1.2/docs/servers/fastmcp.mdx +298 -0
  18. fastmcp-2.1.2/docs/servers/prompts.mdx +229 -0
  19. fastmcp-2.1.2/docs/servers/resources.mdx +252 -0
  20. fastmcp-2.1.2/docs/servers/resources_backup.mdx +270 -0
  21. fastmcp-2.1.2/docs/servers/tools.mdx +335 -0
  22. fastmcp-2.1.2/docs/style.css +13 -0
  23. {fastmcp-2.1.0 → fastmcp-2.1.2}/examples/mount_example.py +4 -2
  24. fastmcp-2.1.2/examples/smart_home/pyproject.toml +19 -0
  25. fastmcp-2.1.2/examples/smart_home/src/smart_home/__init__.py +3 -0
  26. fastmcp-2.1.2/examples/smart_home/src/smart_home/__main__.py +9 -0
  27. fastmcp-2.1.2/examples/smart_home/src/smart_home/hub.py +35 -0
  28. fastmcp-2.1.2/examples/smart_home/src/smart_home/lights/hue_utils.py +34 -0
  29. fastmcp-2.1.2/examples/smart_home/src/smart_home/lights/server.py +292 -0
  30. fastmcp-2.1.2/examples/smart_home/src/smart_home/settings.py +12 -0
  31. fastmcp-2.1.2/examples/smart_home/uv.lock +657 -0
  32. fastmcp-2.1.2/justfile +9 -0
  33. {fastmcp-2.1.0 → fastmcp-2.1.2}/pyproject.toml +27 -2
  34. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/cli/cli.py +2 -0
  35. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/client/transports.py +22 -0
  36. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/exceptions.py +4 -0
  37. fastmcp-2.1.2/src/fastmcp/prompts/__init__.py +4 -0
  38. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/prompts/prompt.py +6 -24
  39. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/prompts/prompt_manager.py +5 -2
  40. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/resources/resource.py +1 -9
  41. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/resources/resource_manager.py +94 -9
  42. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/resources/template.py +0 -8
  43. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/server/context.py +1 -1
  44. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/server/proxy.py +4 -4
  45. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/server/server.py +156 -73
  46. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/tools/tool.py +4 -9
  47. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/tools/tool_manager.py +4 -1
  48. fastmcp-2.1.2/src/fastmcp/utilities/decorators.py +101 -0
  49. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/utilities/func_metadata.py +4 -1
  50. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/utilities/logging.py +14 -6
  51. fastmcp-2.1.2/src/fastmcp/utilities/openapi.py +1089 -0
  52. fastmcp-2.1.2/tests/prompts/__init__.py +0 -0
  53. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/prompts/test_base.py +3 -3
  54. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/prompts/test_prompt_manager.py +2 -1
  55. fastmcp-2.1.2/tests/resources/__init__.py +0 -0
  56. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/resources/test_resource_manager.py +2 -1
  57. fastmcp-2.1.2/tests/server/__init__.py +0 -0
  58. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/server/test_file_server.py +4 -4
  59. fastmcp-2.1.2/tests/server/test_openapi.py +719 -0
  60. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/server/test_proxy.py +22 -14
  61. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/server/test_server.py +535 -18
  62. fastmcp-2.1.2/tests/tools/__init__.py +0 -0
  63. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/utilities/openapi/test_openapi.py +329 -0
  64. fastmcp-2.1.2/tests/utilities/test_decorated_function.py +222 -0
  65. fastmcp-2.1.2/tests/utilities/test_logging.py +30 -0
  66. {fastmcp-2.1.0 → fastmcp-2.1.2}/uv.lock +42 -42
  67. fastmcp-2.1.0/src/fastmcp/prompts/__init__.py +0 -4
  68. fastmcp-2.1.0/src/fastmcp/utilities/openapi.py +0 -797
  69. fastmcp-2.1.0/tests/server/test_openapi.py +0 -355
  70. {fastmcp-2.1.0 → fastmcp-2.1.2}/.cursor/rules/core-mcp-objects.mdc +0 -0
  71. {fastmcp-2.1.0 → fastmcp-2.1.2}/.github/release.yml +0 -0
  72. {fastmcp-2.1.0 → fastmcp-2.1.2}/.github/workflows/publish.yml +0 -0
  73. {fastmcp-2.1.0 → fastmcp-2.1.2}/.gitignore +0 -0
  74. {fastmcp-2.1.0 → fastmcp-2.1.2}/.pre-commit-config.yaml +0 -0
  75. {fastmcp-2.1.0 → fastmcp-2.1.2}/LICENSE +0 -0
  76. {fastmcp-2.1.0 → fastmcp-2.1.2}/Windows_Notes.md +0 -0
  77. {fastmcp-2.1.0 → fastmcp-2.1.2}/docs/assets/demo-inspector.png +0 -0
  78. {fastmcp-2.1.0 → fastmcp-2.1.2}/examples/complex_inputs.py +0 -0
  79. {fastmcp-2.1.0 → fastmcp-2.1.2}/examples/desktop.py +0 -0
  80. {fastmcp-2.1.0 → fastmcp-2.1.2}/examples/echo.py +0 -0
  81. {fastmcp-2.1.0 → fastmcp-2.1.2}/examples/memory.py +0 -0
  82. {fastmcp-2.1.0 → fastmcp-2.1.2}/examples/readme-quickstart.py +0 -0
  83. {fastmcp-2.1.0 → fastmcp-2.1.2}/examples/sampling.py +0 -0
  84. {fastmcp-2.1.0 → fastmcp-2.1.2}/examples/screenshot.py +0 -0
  85. {fastmcp-2.1.0 → fastmcp-2.1.2}/examples/simple_echo.py +0 -0
  86. fastmcp-2.1.0/src/fastmcp/py.typed → fastmcp-2.1.2/examples/smart_home/README.md +0 -0
  87. {fastmcp-2.1.0/tests → fastmcp-2.1.2/examples/smart_home/src/smart_home/lights}/__init__.py +0 -0
  88. fastmcp-2.1.0/tests/prompts/__init__.py → fastmcp-2.1.2/examples/smart_home/src/smart_home/py.typed +0 -0
  89. {fastmcp-2.1.0 → fastmcp-2.1.2}/examples/text_me.py +0 -0
  90. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/__init__.py +0 -0
  91. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/cli/__init__.py +0 -0
  92. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/cli/claude.py +0 -0
  93. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/client/__init__.py +0 -0
  94. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/client/base.py +0 -0
  95. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/client/client.py +0 -0
  96. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/client/roots.py +0 -0
  97. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/client/sampling.py +0 -0
  98. fastmcp-2.1.0/tests/resources/__init__.py → fastmcp-2.1.2/src/fastmcp/py.typed +0 -0
  99. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/resources/__init__.py +1 -1
  100. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/resources/types.py +0 -0
  101. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/server/__init__.py +0 -0
  102. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/server/openapi.py +0 -0
  103. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/settings.py +0 -0
  104. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/tools/__init__.py +0 -0
  105. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/utilities/__init__.py +0 -0
  106. {fastmcp-2.1.0 → fastmcp-2.1.2}/src/fastmcp/utilities/types.py +0 -0
  107. {fastmcp-2.1.0/tests/server → fastmcp-2.1.2/tests}/__init__.py +0 -0
  108. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/client/__init__.py +0 -0
  109. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/client/test_client.py +0 -0
  110. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/client/test_roots.py +0 -0
  111. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/client/test_sampling.py +0 -0
  112. /fastmcp-2.1.0/tests/tools/__init__.py → /fastmcp-2.1.2/tests/conftest.py +0 -0
  113. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/resources/test_file_resources.py +0 -0
  114. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/resources/test_function_resources.py +0 -0
  115. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/resources/test_resource_template.py +0 -0
  116. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/resources/test_resources.py +0 -0
  117. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/server/test_lifespan.py +0 -0
  118. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/server/test_mount.py +0 -0
  119. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/server/test_run_server.py +0 -0
  120. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/server/test_servers/fastmcp_server.py +0 -0
  121. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/server/test_servers/sse.py +0 -0
  122. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/server/test_servers/stdio.py +0 -0
  123. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/tools/test_tool_manager.py +0 -0
  124. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/utilities/__init__.py +0 -0
  125. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/utilities/openapi/__init__.py +0 -0
  126. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/utilities/openapi/conftest.py +0 -0
  127. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/utilities/openapi/test_openapi_advanced.py +0 -0
  128. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/utilities/openapi/test_openapi_fastapi.py +0 -0
  129. {fastmcp-2.1.0 → fastmcp-2.1.2}/tests/utilities/test_func_metadata.py +0 -0
@@ -8,7 +8,19 @@ env:
8
8
  on:
9
9
  push:
10
10
  branches: ["main"]
11
+ paths:
12
+ - "src/**"
13
+ - "tests/**"
14
+ - "uv.lock"
15
+ - "pyproject.toml"
16
+ - ".github/workflows/**"
11
17
  pull_request:
18
+ paths:
19
+ - "src/**"
20
+ - "tests/**"
21
+ - "uv.lock"
22
+ - "pyproject.toml"
23
+ - ".github/workflows/**"
12
24
  workflow_dispatch:
13
25
 
14
26
  permissions:
@@ -32,7 +32,7 @@ jobs:
32
32
  runs-on: ${{ matrix.os }}
33
33
  strategy:
34
34
  matrix:
35
- os: [ubuntu-latest, windows-latest, macos-latest]
35
+ os: [ubuntu-latest, windows-latest]
36
36
  python-version: ["3.10"]
37
37
  fail-fast: false
38
38
  timeout-minutes: 5
@@ -1,16 +1,46 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastmcp
3
+ Version: 2.1.2
4
+ Summary: The fast, Pythonic way to build MCP servers.
5
+ Project-URL: Homepage, https://gofastmcp.com
6
+ Project-URL: Repository, https://github.com/jlowin/fastmcp
7
+ Project-URL: Documentation, https://gofastmcp.com
8
+ Author: Jeremiah Lowin
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: agent,fastmcp,llm,mcp,mcp client,mcp server,model context protocol
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: dotenv>=0.9.9
21
+ Requires-Dist: fastapi>=0.115.12
22
+ Requires-Dist: mcp<2.0.0,>=1.6.0
23
+ Requires-Dist: openapi-pydantic>=0.5.1
24
+ Requires-Dist: rich>=13.9.4
25
+ Requires-Dist: typer>=0.15.2
26
+ Requires-Dist: websockets>=15.0.1
27
+ Description-Content-Type: text/markdown
28
+
1
29
  <div align="center">
2
30
 
3
31
  <!-- omit in toc -->
4
32
  # FastMCP v2 🚀
5
- <strong>The fast, Pythonic way to build MCP servers.</strong>
33
+ <strong>The fast, Pythonic way to build MCP servers and clients.</strong>
6
34
 
35
+ [![Docs](https://img.shields.io/badge/docs-gofastmcp.com-blue)](https://gofastmcp.com)
7
36
  [![PyPI - Version](https://img.shields.io/pypi/v/fastmcp.svg)](https://pypi.org/project/fastmcp)
8
37
  [![Tests](https://github.com/jlowin/fastmcp/actions/workflows/run-tests.yml/badge.svg)](https://github.com/jlowin/fastmcp/actions/workflows/run-tests.yml)
9
38
  [![License](https://img.shields.io/github/license/jlowin/fastmcp.svg)](https://github.com/jlowin/fastmcp/blob/main/LICENSE)
10
39
 
40
+ <a href="https://trendshift.io/repositories/13266" target="_blank"><img src="https://trendshift.io/api/badge/repositories/13266" alt="jlowin%2Ffastmcp | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
11
41
  </div>
12
42
 
13
- [Model Context Protocol (MCP)](https://modelcontextprotocol.io) servers are a standardized way to provide context and tools to your LLMs, and FastMCP makes building *and interacting with* them simple and intuitive. Create tools, expose resources, define prompts, and connect components with clean, Pythonic code.
43
+ The [Model Context Protocol (MCP)](https://modelcontextprotocol.io) is a new, standardized way to provide context and tools to your LLMs, and FastMCP makes building MCP servers and clients simple and intuitive. Create tools, expose resources, define prompts, and connect components with clean, Pythonic code.
14
44
 
15
45
  ```python
16
46
  # server.py
@@ -27,48 +57,27 @@ if __name__ == "__main__":
27
57
  mcp.run()
28
58
  ```
29
59
 
30
- Run it locally for testing:
31
- ```bash
32
- fastmcp dev server.py
33
- ```
34
60
 
35
- Install it for use with Claude Desktop:
61
+ Run the server locally:
36
62
  ```bash
37
- fastmcp install server.py
63
+ fastmcp run server.py
38
64
  ```
39
65
 
40
66
  FastMCP handles the complex protocol details and server management, letting you focus on building great tools and applications. It's designed to feel natural to Python developers.
41
67
 
42
- ## Key Features:
43
-
44
- * **Simple Server Creation:** Build MCP servers with minimal boilerplate using intuitive decorators (`@tool`, `@resource`, `@prompt`).
45
- * **Proxy MCP Servers:** Create proxy servers to expose existing MCP servers or clients with modifications, or convert between transport protocols (e.g., expose a Stdio server via SSE for web access).
46
- * **Compose MCP Servers:** Compose complex applications by mounting multiple FastMCP servers together.
47
- * **API Generation:** Automatically create MCP servers from existing **OpenAPI specifications** or **FastAPI applications**.
48
- * **Powerful Clients:** Programmatically interact with *any* MCP server, regardless of how it was built.
49
- * **LLM Sampling:** Request completions from client LLMs directly within your MCP tools.
50
- * **Pythonic Interface:** Designed with familiar Python patterns like decorators and type hints.
51
- * **Context Injection:** Easily access core MCP capabilities like sampling, logging, and progress reporting within your functions.
52
-
53
- ---
54
-
55
- ### What's New in v2?
56
-
57
- FastMCP 1.0 made it so easy to build MCP servers that it's now part of the [official Model Context Protocol Python SDK](https://github.com/modelcontextprotocol/python-sdk)! For basic use cases, you can use the upstream version by importing `mcp.server.fastmcp.FastMCP` (or installing `fastmcp=1.0`).
58
-
59
- Based on how the MCP ecosystem is evolving, FastMCP 2.0 builds on that foundation to introduce a variety of new features (and more experimental ideas). It adds advanced features like proxying and composing MCP servers, as well as automatically generating them from OpenAPI specs or FastAPI objects. FastMCP 2.0 also introduces new client-side functionality like LLM sampling.
60
-
61
-
62
- ---
63
68
 
64
69
  <!-- omit in toc -->
65
70
  ## Table of Contents
66
71
 
67
- - [Key Features:](#key-features)
68
- - [What's New in v2?](#whats-new-in-v2)
69
- - [Installation](#installation)
70
- - [Quickstart](#quickstart)
71
72
  - [What is MCP?](#what-is-mcp)
73
+ - [Why FastMCP?](#why-fastmcp)
74
+ - [Key Features](#key-features)
75
+ - [Servers](#servers)
76
+ - [Clients](#clients)
77
+ - [What's New in v2?](#whats-new-in-v2)
78
+ - [Documentation](#documentation)
79
+ - [Installation](#installation)
80
+ - [Quickstart](#quickstart)
72
81
  - [Core Concepts](#core-concepts)
73
82
  - [The `FastMCP` Server](#the-fastmcp-server)
74
83
  - [Tools](#tools)
@@ -98,7 +107,62 @@ Based on how the MCP ecosystem is evolving, FastMCP 2.0 builds on that foundatio
98
107
  - [Formatting \& Linting](#formatting--linting)
99
108
  - [Pull Requests](#pull-requests)
100
109
 
101
- ## Installation
110
+
111
+ ## What is MCP?
112
+
113
+ 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. Think of it like a web API, but specifically designed for LLM interactions. MCP servers can:
114
+
115
+ - Expose data through **Resources** (think GET endpoints; load info into context)
116
+ - Provide functionality through **Tools** (think POST/PUT endpoints; execute actions)
117
+ - Define interaction patterns through **Prompts** (reusable templates)
118
+ - And more!
119
+
120
+ FastMCP provides a high-level, Pythonic interface for building and interacting with these servers.
121
+
122
+ ## Why FastMCP?
123
+
124
+ 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.
125
+
126
+ FastMCP aims to be:
127
+
128
+
129
+ 🚀 **Fast:** High-level interface means less code and faster development
130
+
131
+ 🍀 **Simple:** Build MCP servers with minimal boilerplate
132
+
133
+ 🐍 **Pythonic:** Feels natural to Python developers
134
+
135
+ 🔍 **Complete:** FastMCP aims to provide a full implementation of the core MCP specification for both servers and clients
136
+
137
+ ## Key Features
138
+
139
+ ### Servers
140
+ - **Create** servers with minimal boilerplate using intuitive decorators
141
+ - **Proxy** existing servers to modify configuration or transport
142
+ - **Compose** servers by into complex applications
143
+ - **Generate** servers from OpenAPI specs or FastAPI objects
144
+
145
+ ### Clients
146
+ - **Interact** with MCP servers programmatically
147
+ - **Connect** to any MCP server using any transport
148
+ - **Test** your servers without manual intervention
149
+ - **Innovate** with core MCP capabilities like LLM sampling
150
+
151
+
152
+ ## What's New in v2?
153
+
154
+ FastMCP 1.0 made it so easy to build MCP servers that it's now part of the [official Model Context Protocol Python SDK](https://github.com/modelcontextprotocol/python-sdk)! For basic use cases, you can use the upstream version by importing `mcp.server.fastmcp.FastMCP` (or installing `fastmcp=1.0`).
155
+
156
+ Based on how the MCP ecosystem is evolving, FastMCP 2.0 builds on that foundation to introduce a variety of new features (and more experimental ideas). It adds advanced features like proxying and composing MCP servers, as well as automatically generating them from OpenAPI specs or FastAPI objects. FastMCP 2.0 also introduces new client-side functionality like LLM sampling.
157
+
158
+
159
+ ## Documentation
160
+
161
+ 📚 FastMCP's documentation is available at [gofastmcp.com](https://gofastmcp.com).
162
+
163
+ ---
164
+
165
+ ### Installation
102
166
 
103
167
  We strongly recommend installing FastMCP with [uv](https://docs.astral.sh/uv/), as it is required for deploying servers via the CLI:
104
168
 
@@ -117,7 +181,7 @@ cd fastmcp
117
181
  uv sync
118
182
  ```
119
183
 
120
- ## Quickstart
184
+ ### Quickstart
121
185
 
122
186
  Let's create a simple MCP server that exposes a calculator tool and some data:
123
187
 
@@ -146,23 +210,8 @@ You can install this server in [Claude Desktop](https://claude.ai/download) and
146
210
  fastmcp install server.py
147
211
  ```
148
212
 
149
- Alternatively, you can test it with the MCP Inspector:
150
- ```bash
151
- fastmcp dev server.py
152
- ```
153
-
154
213
  ![MCP Inspector](/docs/assets/demo-inspector.png)
155
214
 
156
- ## What is MCP?
157
-
158
- 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. Think of it like a web API, but specifically designed for LLM interactions. MCP servers can:
159
-
160
- - Expose data through **Resources** (think GET endpoints; load info into context)
161
- - Provide functionality through **Tools** (think POST/PUT endpoints; execute actions)
162
- - Define interaction patterns through **Prompts** (reusable templates)
163
- - And more!
164
-
165
- FastMCP provides a high-level, Pythonic interface for building and interacting with these servers.
166
215
 
167
216
  ## Core Concepts
168
217
 
@@ -750,4 +799,4 @@ We use `ruff` via `pre-commit`.
750
799
 
751
800
  Please open an issue or discussion for questions or suggestions!
752
801
 
753
- </details>
802
+ </details>
@@ -1,33 +1,18 @@
1
- Metadata-Version: 2.4
2
- Name: fastmcp
3
- Version: 2.1.0
4
- Summary: An ergonomic MCP interface
5
- Author: Jeremiah Lowin
6
- License: Apache-2.0
7
- License-File: LICENSE
8
- Requires-Python: >=3.10
9
- Requires-Dist: dotenv>=0.9.9
10
- Requires-Dist: fastapi>=0.115.12
11
- Requires-Dist: mcp<2.0.0,>=1.6.0
12
- Requires-Dist: openapi-pydantic>=0.5.1
13
- Requires-Dist: rich>=13.9.4
14
- Requires-Dist: typer>=0.15.2
15
- Requires-Dist: websockets>=15.0.1
16
- Description-Content-Type: text/markdown
17
-
18
1
  <div align="center">
19
2
 
20
3
  <!-- omit in toc -->
21
4
  # FastMCP v2 🚀
22
- <strong>The fast, Pythonic way to build MCP servers.</strong>
5
+ <strong>The fast, Pythonic way to build MCP servers and clients.</strong>
23
6
 
7
+ [![Docs](https://img.shields.io/badge/docs-gofastmcp.com-blue)](https://gofastmcp.com)
24
8
  [![PyPI - Version](https://img.shields.io/pypi/v/fastmcp.svg)](https://pypi.org/project/fastmcp)
25
9
  [![Tests](https://github.com/jlowin/fastmcp/actions/workflows/run-tests.yml/badge.svg)](https://github.com/jlowin/fastmcp/actions/workflows/run-tests.yml)
26
10
  [![License](https://img.shields.io/github/license/jlowin/fastmcp.svg)](https://github.com/jlowin/fastmcp/blob/main/LICENSE)
27
11
 
12
+ <a href="https://trendshift.io/repositories/13266" target="_blank"><img src="https://trendshift.io/api/badge/repositories/13266" alt="jlowin%2Ffastmcp | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
28
13
  </div>
29
14
 
30
- [Model Context Protocol (MCP)](https://modelcontextprotocol.io) servers are a standardized way to provide context and tools to your LLMs, and FastMCP makes building *and interacting with* them simple and intuitive. Create tools, expose resources, define prompts, and connect components with clean, Pythonic code.
15
+ The [Model Context Protocol (MCP)](https://modelcontextprotocol.io) is a new, standardized way to provide context and tools to your LLMs, and FastMCP makes building MCP servers and clients simple and intuitive. Create tools, expose resources, define prompts, and connect components with clean, Pythonic code.
31
16
 
32
17
  ```python
33
18
  # server.py
@@ -44,48 +29,27 @@ if __name__ == "__main__":
44
29
  mcp.run()
45
30
  ```
46
31
 
47
- Run it locally for testing:
48
- ```bash
49
- fastmcp dev server.py
50
- ```
51
32
 
52
- Install it for use with Claude Desktop:
33
+ Run the server locally:
53
34
  ```bash
54
- fastmcp install server.py
35
+ fastmcp run server.py
55
36
  ```
56
37
 
57
38
  FastMCP handles the complex protocol details and server management, letting you focus on building great tools and applications. It's designed to feel natural to Python developers.
58
39
 
59
- ## Key Features:
60
-
61
- * **Simple Server Creation:** Build MCP servers with minimal boilerplate using intuitive decorators (`@tool`, `@resource`, `@prompt`).
62
- * **Proxy MCP Servers:** Create proxy servers to expose existing MCP servers or clients with modifications, or convert between transport protocols (e.g., expose a Stdio server via SSE for web access).
63
- * **Compose MCP Servers:** Compose complex applications by mounting multiple FastMCP servers together.
64
- * **API Generation:** Automatically create MCP servers from existing **OpenAPI specifications** or **FastAPI applications**.
65
- * **Powerful Clients:** Programmatically interact with *any* MCP server, regardless of how it was built.
66
- * **LLM Sampling:** Request completions from client LLMs directly within your MCP tools.
67
- * **Pythonic Interface:** Designed with familiar Python patterns like decorators and type hints.
68
- * **Context Injection:** Easily access core MCP capabilities like sampling, logging, and progress reporting within your functions.
69
-
70
- ---
71
-
72
- ### What's New in v2?
73
-
74
- FastMCP 1.0 made it so easy to build MCP servers that it's now part of the [official Model Context Protocol Python SDK](https://github.com/modelcontextprotocol/python-sdk)! For basic use cases, you can use the upstream version by importing `mcp.server.fastmcp.FastMCP` (or installing `fastmcp=1.0`).
75
-
76
- Based on how the MCP ecosystem is evolving, FastMCP 2.0 builds on that foundation to introduce a variety of new features (and more experimental ideas). It adds advanced features like proxying and composing MCP servers, as well as automatically generating them from OpenAPI specs or FastAPI objects. FastMCP 2.0 also introduces new client-side functionality like LLM sampling.
77
-
78
-
79
- ---
80
40
 
81
41
  <!-- omit in toc -->
82
42
  ## Table of Contents
83
43
 
84
- - [Key Features:](#key-features)
85
- - [What's New in v2?](#whats-new-in-v2)
86
- - [Installation](#installation)
87
- - [Quickstart](#quickstart)
88
44
  - [What is MCP?](#what-is-mcp)
45
+ - [Why FastMCP?](#why-fastmcp)
46
+ - [Key Features](#key-features)
47
+ - [Servers](#servers)
48
+ - [Clients](#clients)
49
+ - [What's New in v2?](#whats-new-in-v2)
50
+ - [Documentation](#documentation)
51
+ - [Installation](#installation)
52
+ - [Quickstart](#quickstart)
89
53
  - [Core Concepts](#core-concepts)
90
54
  - [The `FastMCP` Server](#the-fastmcp-server)
91
55
  - [Tools](#tools)
@@ -115,7 +79,62 @@ Based on how the MCP ecosystem is evolving, FastMCP 2.0 builds on that foundatio
115
79
  - [Formatting \& Linting](#formatting--linting)
116
80
  - [Pull Requests](#pull-requests)
117
81
 
118
- ## Installation
82
+
83
+ ## What is MCP?
84
+
85
+ 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. Think of it like a web API, but specifically designed for LLM interactions. MCP servers can:
86
+
87
+ - Expose data through **Resources** (think GET endpoints; load info into context)
88
+ - Provide functionality through **Tools** (think POST/PUT endpoints; execute actions)
89
+ - Define interaction patterns through **Prompts** (reusable templates)
90
+ - And more!
91
+
92
+ FastMCP provides a high-level, Pythonic interface for building and interacting with these servers.
93
+
94
+ ## Why FastMCP?
95
+
96
+ 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.
97
+
98
+ FastMCP aims to be:
99
+
100
+
101
+ 🚀 **Fast:** High-level interface means less code and faster development
102
+
103
+ 🍀 **Simple:** Build MCP servers with minimal boilerplate
104
+
105
+ 🐍 **Pythonic:** Feels natural to Python developers
106
+
107
+ 🔍 **Complete:** FastMCP aims to provide a full implementation of the core MCP specification for both servers and clients
108
+
109
+ ## Key Features
110
+
111
+ ### Servers
112
+ - **Create** servers with minimal boilerplate using intuitive decorators
113
+ - **Proxy** existing servers to modify configuration or transport
114
+ - **Compose** servers by into complex applications
115
+ - **Generate** servers from OpenAPI specs or FastAPI objects
116
+
117
+ ### Clients
118
+ - **Interact** with MCP servers programmatically
119
+ - **Connect** to any MCP server using any transport
120
+ - **Test** your servers without manual intervention
121
+ - **Innovate** with core MCP capabilities like LLM sampling
122
+
123
+
124
+ ## What's New in v2?
125
+
126
+ FastMCP 1.0 made it so easy to build MCP servers that it's now part of the [official Model Context Protocol Python SDK](https://github.com/modelcontextprotocol/python-sdk)! For basic use cases, you can use the upstream version by importing `mcp.server.fastmcp.FastMCP` (or installing `fastmcp=1.0`).
127
+
128
+ Based on how the MCP ecosystem is evolving, FastMCP 2.0 builds on that foundation to introduce a variety of new features (and more experimental ideas). It adds advanced features like proxying and composing MCP servers, as well as automatically generating them from OpenAPI specs or FastAPI objects. FastMCP 2.0 also introduces new client-side functionality like LLM sampling.
129
+
130
+
131
+ ## Documentation
132
+
133
+ 📚 FastMCP's documentation is available at [gofastmcp.com](https://gofastmcp.com).
134
+
135
+ ---
136
+
137
+ ### Installation
119
138
 
120
139
  We strongly recommend installing FastMCP with [uv](https://docs.astral.sh/uv/), as it is required for deploying servers via the CLI:
121
140
 
@@ -134,7 +153,7 @@ cd fastmcp
134
153
  uv sync
135
154
  ```
136
155
 
137
- ## Quickstart
156
+ ### Quickstart
138
157
 
139
158
  Let's create a simple MCP server that exposes a calculator tool and some data:
140
159
 
@@ -163,23 +182,8 @@ You can install this server in [Claude Desktop](https://claude.ai/download) and
163
182
  fastmcp install server.py
164
183
  ```
165
184
 
166
- Alternatively, you can test it with the MCP Inspector:
167
- ```bash
168
- fastmcp dev server.py
169
- ```
170
-
171
185
  ![MCP Inspector](/docs/assets/demo-inspector.png)
172
186
 
173
- ## What is MCP?
174
-
175
- 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. Think of it like a web API, but specifically designed for LLM interactions. MCP servers can:
176
-
177
- - Expose data through **Resources** (think GET endpoints; load info into context)
178
- - Provide functionality through **Tools** (think POST/PUT endpoints; execute actions)
179
- - Define interaction patterns through **Prompts** (reusable templates)
180
- - And more!
181
-
182
- FastMCP provides a high-level, Pythonic interface for building and interacting with these servers.
183
187
 
184
188
  ## Core Concepts
185
189
 
@@ -767,4 +771,4 @@ We use `ruff` via `pre-commit`.
767
771
 
768
772
  Please open an issue or discussion for questions or suggestions!
769
773
 
770
- </details>
774
+ </details>