fastmcp 2.3.5__py3-none-any.whl → 2.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fastmcp/client/client.py +44 -6
- fastmcp/client/logging.py +14 -8
- fastmcp/client/transports.py +202 -57
- fastmcp/prompts/prompt.py +11 -4
- fastmcp/prompts/prompt_manager.py +25 -5
- fastmcp/resources/resource_manager.py +31 -5
- fastmcp/resources/template.py +10 -5
- fastmcp/server/context.py +46 -0
- fastmcp/server/http.py +25 -1
- fastmcp/server/openapi.py +436 -73
- fastmcp/server/server.py +412 -127
- fastmcp/settings.py +46 -1
- fastmcp/tools/tool.py +5 -1
- fastmcp/tools/tool_manager.py +9 -2
- fastmcp/utilities/logging.py +6 -1
- fastmcp/utilities/mcp_config.py +77 -0
- fastmcp/utilities/openapi.py +233 -602
- fastmcp/utilities/tests.py +8 -4
- {fastmcp-2.3.5.dist-info → fastmcp-2.5.0.dist-info}/METADATA +27 -4
- {fastmcp-2.3.5.dist-info → fastmcp-2.5.0.dist-info}/RECORD +23 -22
- {fastmcp-2.3.5.dist-info → fastmcp-2.5.0.dist-info}/WHEEL +0 -0
- {fastmcp-2.3.5.dist-info → fastmcp-2.5.0.dist-info}/entry_points.txt +0 -0
- {fastmcp-2.3.5.dist-info → fastmcp-2.5.0.dist-info}/licenses/LICENSE +0 -0
fastmcp/utilities/tests.py
CHANGED
|
@@ -71,7 +71,7 @@ def _run_server(mcp_server: FastMCP, transport: Literal["sse"], port: int) -> No
|
|
|
71
71
|
|
|
72
72
|
@contextmanager
|
|
73
73
|
def run_server_in_process(
|
|
74
|
-
server_fn: Callable[
|
|
74
|
+
server_fn: Callable[..., None], *args
|
|
75
75
|
) -> Generator[str, None, None]:
|
|
76
76
|
"""
|
|
77
77
|
Context manager that runs a Starlette app in a separate process and returns the
|
|
@@ -109,7 +109,11 @@ def run_server_in_process(
|
|
|
109
109
|
|
|
110
110
|
yield f"http://{host}:{port}"
|
|
111
111
|
|
|
112
|
-
proc.
|
|
113
|
-
proc.join(timeout=
|
|
112
|
+
proc.terminate()
|
|
113
|
+
proc.join(timeout=5)
|
|
114
114
|
if proc.is_alive():
|
|
115
|
-
|
|
115
|
+
# If it's still alive, then force kill it
|
|
116
|
+
proc.kill()
|
|
117
|
+
proc.join(timeout=2)
|
|
118
|
+
if proc.is_alive():
|
|
119
|
+
raise RuntimeError("Server process failed to terminate even after kill")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastmcp
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.5.0
|
|
4
4
|
Summary: The fast, Pythonic way to build MCP servers.
|
|
5
5
|
Project-URL: Homepage, https://gofastmcp.com
|
|
6
6
|
Project-URL: Repository, https://github.com/jlowin/fastmcp
|
|
@@ -44,11 +44,11 @@ Description-Content-Type: text/markdown
|
|
|
44
44
|
> [!NOTE]
|
|
45
45
|
> #### FastMCP 2.0 & The Official MCP SDK
|
|
46
46
|
>
|
|
47
|
-
>
|
|
47
|
+
> FastMCP is the standard framework for building MCP servers and clients. FastMCP 1.0 was incorporated into the [official MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk).
|
|
48
48
|
>
|
|
49
|
-
> **
|
|
49
|
+
> **This is FastMCP 2.0,** the actively maintained version that significantly expands on 1.0's basic server-building capabilities by introducing full client support, server composition, OpenAPI/FastAPI integration, remote server proxying, built-in testing tools, and more.
|
|
50
50
|
>
|
|
51
|
-
> FastMCP 2.0 is the
|
|
51
|
+
> FastMCP 2.0 is the complete toolkit for modern AI applications. Ready to upgrade or get started? Follow the [installation instructions](https://gofastmcp.com/getting-started/installation), which include specific steps for upgrading from the official MCP SDK.
|
|
52
52
|
|
|
53
53
|
---
|
|
54
54
|
|
|
@@ -282,6 +282,29 @@ async def main():
|
|
|
282
282
|
# ... use the client
|
|
283
283
|
```
|
|
284
284
|
|
|
285
|
+
FastMCP also supports connecting to multiple servers through a single unified client using the standard MCP configuration format:
|
|
286
|
+
|
|
287
|
+
```python
|
|
288
|
+
from fastmcp import Client
|
|
289
|
+
|
|
290
|
+
# Standard MCP configuration with multiple servers
|
|
291
|
+
config = {
|
|
292
|
+
"mcpServers": {
|
|
293
|
+
"weather": {"url": "https://weather-api.example.com/mcp"},
|
|
294
|
+
"assistant": {"command": "python", "args": ["./assistant_server.py"]}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
# Create a client that connects to all servers
|
|
299
|
+
client = Client(config)
|
|
300
|
+
|
|
301
|
+
async def main():
|
|
302
|
+
async with client:
|
|
303
|
+
# Access tools and resources with server prefixes
|
|
304
|
+
forecast = await client.call_tool("weather_get_forecast", {"city": "London"})
|
|
305
|
+
answer = await client.call_tool("assistant_answer_question", {"query": "What is MCP?"})
|
|
306
|
+
```
|
|
307
|
+
|
|
285
308
|
Learn more in the [**Client Documentation**](https://gofastmcp.com/clients/client) and [**Transports Documentation**](https://gofastmcp.com/clients/transports).
|
|
286
309
|
|
|
287
310
|
## Advanced Features
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
fastmcp/__init__.py,sha256=yTAqLZORsPqbr7AE0ayw6zIYBeMlxQlI-3HE2WqbvHk,435
|
|
2
2
|
fastmcp/exceptions.py,sha256=YvaKqOT3w0boXF9ylIoaSIzW9XiQ1qLFG1LZq6B60H8,680
|
|
3
3
|
fastmcp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
fastmcp/settings.py,sha256=
|
|
4
|
+
fastmcp/settings.py,sha256=ES59HUoZGLCtBiCKjf4ioVXjPSZtKLJrXhBN4OH_1N4,5356
|
|
5
5
|
fastmcp/cli/__init__.py,sha256=Ii284TNoG5lxTP40ETMGhHEq3lQZWxu9m9JuU57kUpQ,87
|
|
6
6
|
fastmcp/cli/claude.py,sha256=IAlcZ4qZKBBj09jZUMEx7EANZE_IR3vcu7zOBJmMOuU,4567
|
|
7
7
|
fastmcp/cli/cli.py,sha256=eRZ4tpne7dj_rhjREwiNRN5i9A1T8-ptxg1lYaHfS5o,12401
|
|
8
8
|
fastmcp/cli/run.py,sha256=o7Ge6JZKXYwlY2vYdMNoVX8agBchAaeU_73iPndojIM,5351
|
|
9
9
|
fastmcp/client/__init__.py,sha256=Ri8GFHolIKOZnXaMzIc3VpkLcEqAmOoYGCKgmSk6NnE,550
|
|
10
10
|
fastmcp/client/base.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
fastmcp/client/client.py,sha256=
|
|
12
|
-
fastmcp/client/logging.py,sha256=
|
|
11
|
+
fastmcp/client/client.py,sha256=QJsb8PHheUTn4UPG9kxzgn8M10g0cUkFttnGj-OgPdk,20847
|
|
12
|
+
fastmcp/client/logging.py,sha256=hOPRailZUp89RUck6V4HPaWVZinVrNY8HD4hD0dd-fE,822
|
|
13
13
|
fastmcp/client/progress.py,sha256=WjLLDbUKMsx8DK-fqO7AGsXb83ak-6BMrLvzzznGmcI,1043
|
|
14
14
|
fastmcp/client/roots.py,sha256=IxI_bHwHTmg6c2H-s1av1ZgrRnNDieHtYwdGFbzXT5c,2471
|
|
15
15
|
fastmcp/client/sampling.py,sha256=UlDHxnd6k_HoU8RA3ob0g8-e6haJBc9u27N_v291QoI,1698
|
|
16
|
-
fastmcp/client/transports.py,sha256=
|
|
16
|
+
fastmcp/client/transports.py,sha256=Bm6KeQffkmfbmRb6BKopxvKOpRPHqcSgt21NTjRpbFE,25358
|
|
17
17
|
fastmcp/contrib/README.md,sha256=rKknYSI1T192UvSszqwwDlQ2eYQpxywrNTLoj177SYU,878
|
|
18
18
|
fastmcp/contrib/bulk_tool_caller/README.md,sha256=5aUUY1TSFKtz1pvTLSDqkUCkGkuqMfMZNsLeaNqEgAc,1960
|
|
19
19
|
fastmcp/contrib/bulk_tool_caller/__init__.py,sha256=xvGSSaUXTQrc31erBoi1Gh7BikgOliETDiYVTP3rLxY,75
|
|
@@ -26,34 +26,35 @@ fastmcp/contrib/mcp_mixin/mcp_mixin.py,sha256=cfIRbnSxsVzglTD-auyTE0izVQeHP7Oz18
|
|
|
26
26
|
fastmcp/low_level/README.md,sha256=IRvElvOOc_RLLsqbUm7e6VOEwrKHPJeox0pV7JVKHWw,106
|
|
27
27
|
fastmcp/low_level/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
28
28
|
fastmcp/prompts/__init__.py,sha256=An8uMBUh9Hrb7qqcn_5_Hent7IOeSh7EA2IUVsIrtHc,179
|
|
29
|
-
fastmcp/prompts/prompt.py,sha256=
|
|
30
|
-
fastmcp/prompts/prompt_manager.py,sha256=
|
|
29
|
+
fastmcp/prompts/prompt.py,sha256=_bMuLMSnkH_vJpPcf_b8HOUnMOsQJXZdtjZBoebzNjI,8249
|
|
30
|
+
fastmcp/prompts/prompt_manager.py,sha256=qptEhZHMwc8XxQd5lTQg8iIb5MiTZVsNaux_XLvQ0mw,3871
|
|
31
31
|
fastmcp/resources/__init__.py,sha256=t0x1j8lc74rjUKtXe9H5Gs4fpQt82K4NgBK6Y7A0xTg,467
|
|
32
32
|
fastmcp/resources/resource.py,sha256=Rx1My_fi1f-oqnQ9R_v7ejopAk4BJDfbB75-s4d31dM,2492
|
|
33
|
-
fastmcp/resources/resource_manager.py,sha256=
|
|
34
|
-
fastmcp/resources/template.py,sha256=
|
|
33
|
+
fastmcp/resources/resource_manager.py,sha256=nsgCR3lo9t4Q0QR6txPfAas2upqIb8P8ZlqWAfV9Qc0,11344
|
|
34
|
+
fastmcp/resources/template.py,sha256=mdejT0ofACYrn32Jw3wdJ7bJcVbW_4VMQEwMZLDR3zM,7529
|
|
35
35
|
fastmcp/resources/types.py,sha256=5fUFvzRlekNjtfihtq8S-fT0alKoNfclzrugqeM5JRE,6366
|
|
36
36
|
fastmcp/server/__init__.py,sha256=bMD4aQD4yJqLz7-mudoNsyeV8UgQfRAg3PRwPvwTEds,119
|
|
37
|
-
fastmcp/server/context.py,sha256=
|
|
37
|
+
fastmcp/server/context.py,sha256=yN1e0LsnCl7cEpr9WlbvFhSf8oE56kKb-20m8h2SsBY,10171
|
|
38
38
|
fastmcp/server/dependencies.py,sha256=1utkxFsV37HZcWBwI69JyngVN2ppGO_PEgxUlUHHy_Q,742
|
|
39
|
-
fastmcp/server/http.py,sha256=
|
|
40
|
-
fastmcp/server/openapi.py,sha256=
|
|
39
|
+
fastmcp/server/http.py,sha256=wZWUrLvKITlvkxQoggJ9RyvynCUMEJqqMMsvX7Hmb9o,12807
|
|
40
|
+
fastmcp/server/openapi.py,sha256=zzFfVFlGtII_I3vz91SX-NCj6SIl4It8Q1ZlJ_hm7ZA,39807
|
|
41
41
|
fastmcp/server/proxy.py,sha256=mt3eM6TQWfnZD5XehmTXisskZ4CBbsWyjRPjprlTjBY,9653
|
|
42
|
-
fastmcp/server/server.py,sha256=
|
|
42
|
+
fastmcp/server/server.py,sha256=C0VEnHuSoYt-qef1jm4REPJkcM2stQ2Zp_rT_sELr2Y,57141
|
|
43
43
|
fastmcp/tools/__init__.py,sha256=ocw-SFTtN6vQ8fgnlF8iNAOflRmh79xS1xdO0Bc3QPE,96
|
|
44
|
-
fastmcp/tools/tool.py,sha256=
|
|
45
|
-
fastmcp/tools/tool_manager.py,sha256=
|
|
44
|
+
fastmcp/tools/tool.py,sha256=id2DCxPOtgFa-CRZvCBmCOz16nWyJXcq2ubIjmtOxPg,7803
|
|
45
|
+
fastmcp/tools/tool_manager.py,sha256=785vKYlJ9B2B5ThXFhuXYB4VNY4h0283-_AAdy1hEfk,4430
|
|
46
46
|
fastmcp/utilities/__init__.py,sha256=-imJ8S-rXmbXMWeDamldP-dHDqAPg_wwmPVz-LNX14E,31
|
|
47
47
|
fastmcp/utilities/cache.py,sha256=aV3oZ-ZhMgLSM9iAotlUlEy5jFvGXrVo0Y5Bj4PBtqY,707
|
|
48
48
|
fastmcp/utilities/decorators.py,sha256=AjhjsetQZF4YOPV5MTZmIxO21iFp_4fDIS3O2_KNCEg,2990
|
|
49
49
|
fastmcp/utilities/exceptions.py,sha256=Aax9K0larjzrrgJBS6o_PQwoIrvBvVwck2suZvgafXE,1359
|
|
50
50
|
fastmcp/utilities/json_schema.py,sha256=m65XU9lPq7pCxJ9vvCeGRl0HOFr6ArezvYpMBR6-gAg,3777
|
|
51
|
-
fastmcp/utilities/logging.py,sha256=
|
|
52
|
-
fastmcp/utilities/
|
|
53
|
-
fastmcp/utilities/
|
|
51
|
+
fastmcp/utilities/logging.py,sha256=B1WNO-ZWFjd9wiFSh13YtW1hAKaNmbpscDZleIAhr-g,1317
|
|
52
|
+
fastmcp/utilities/mcp_config.py,sha256=_wY3peaFDEgyOBkJ_Tb8sETk3mtdwtw1053q7ry0za0,2169
|
|
53
|
+
fastmcp/utilities/openapi.py,sha256=QQos4vP59HQ8vPDTKftWOIVv_zmW30mNxYSXVU7JUbY,38441
|
|
54
|
+
fastmcp/utilities/tests.py,sha256=teyHcl3j7WGfYJ6m42VuQYB_IVpGvPdFqIpC-UxsN78,3369
|
|
54
55
|
fastmcp/utilities/types.py,sha256=6CcqAQ1QqCO2HGSFlPS6FO5JRWnacjCcO2-EhyEnZV0,4400
|
|
55
|
-
fastmcp-2.
|
|
56
|
-
fastmcp-2.
|
|
57
|
-
fastmcp-2.
|
|
58
|
-
fastmcp-2.
|
|
59
|
-
fastmcp-2.
|
|
56
|
+
fastmcp-2.5.0.dist-info/METADATA,sha256=chPczyVwGPRVD83dZAlmL595OREQc_EsyrBe3rOz17Q,16510
|
|
57
|
+
fastmcp-2.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
58
|
+
fastmcp-2.5.0.dist-info/entry_points.txt,sha256=ff8bMtKX1JvXyurMibAacMSKbJEPmac9ffAKU9mLnM8,44
|
|
59
|
+
fastmcp-2.5.0.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
60
|
+
fastmcp-2.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|