fastmcp 2.1.0__py3-none-any.whl → 2.1.1__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/cli/cli.py +2 -0
- fastmcp/client/transports.py +22 -0
- fastmcp/exceptions.py +4 -0
- fastmcp/prompts/__init__.py +2 -2
- fastmcp/prompts/prompt.py +6 -16
- fastmcp/prompts/prompt_manager.py +2 -1
- fastmcp/resources/__init__.py +1 -1
- fastmcp/resources/resource_manager.py +89 -5
- fastmcp/server/context.py +1 -1
- fastmcp/server/proxy.py +4 -4
- fastmcp/server/server.py +156 -73
- fastmcp/tools/tool.py +4 -1
- fastmcp/utilities/decorators.py +101 -0
- fastmcp/utilities/func_metadata.py +4 -1
- fastmcp/utilities/openapi.py +671 -292
- {fastmcp-2.1.0.dist-info → fastmcp-2.1.1.dist-info}/METADATA +72 -52
- {fastmcp-2.1.0.dist-info → fastmcp-2.1.1.dist-info}/RECORD +20 -19
- {fastmcp-2.1.0.dist-info → fastmcp-2.1.1.dist-info}/WHEEL +0 -0
- {fastmcp-2.1.0.dist-info → fastmcp-2.1.1.dist-info}/entry_points.txt +0 -0
- {fastmcp-2.1.0.dist-info → fastmcp-2.1.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastmcp
|
|
3
|
-
Version: 2.1.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 2.1.1
|
|
4
|
+
Summary: The fast, Pythonic way to build MCP servers.
|
|
5
5
|
Author: Jeremiah Lowin
|
|
6
6
|
License: Apache-2.0
|
|
7
7
|
License-File: LICENSE
|
|
@@ -19,15 +19,16 @@ Description-Content-Type: text/markdown
|
|
|
19
19
|
|
|
20
20
|
<!-- omit in toc -->
|
|
21
21
|
# FastMCP v2 🚀
|
|
22
|
-
<strong>The fast, Pythonic way to build MCP servers.</strong>
|
|
22
|
+
<strong>The fast, Pythonic way to build MCP servers and clients.</strong>
|
|
23
23
|
|
|
24
|
+
[](https://gofastmcp.com)
|
|
24
25
|
[](https://pypi.org/project/fastmcp)
|
|
25
26
|
[](https://github.com/jlowin/fastmcp/actions/workflows/run-tests.yml)
|
|
26
27
|
[](https://github.com/jlowin/fastmcp/blob/main/LICENSE)
|
|
27
28
|
|
|
28
29
|
</div>
|
|
29
30
|
|
|
30
|
-
[Model Context Protocol (MCP)](https://modelcontextprotocol.io)
|
|
31
|
+
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
32
|
|
|
32
33
|
```python
|
|
33
34
|
# server.py
|
|
@@ -44,48 +45,27 @@ if __name__ == "__main__":
|
|
|
44
45
|
mcp.run()
|
|
45
46
|
```
|
|
46
47
|
|
|
47
|
-
Run it locally for testing:
|
|
48
|
-
```bash
|
|
49
|
-
fastmcp dev server.py
|
|
50
|
-
```
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
Run the server locally:
|
|
53
50
|
```bash
|
|
54
|
-
fastmcp
|
|
51
|
+
fastmcp run server.py
|
|
55
52
|
```
|
|
56
53
|
|
|
57
54
|
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
55
|
|
|
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
56
|
|
|
81
57
|
<!-- omit in toc -->
|
|
82
58
|
## Table of Contents
|
|
83
59
|
|
|
84
|
-
- [Key Features:](#key-features)
|
|
85
|
-
- [What's New in v2?](#whats-new-in-v2)
|
|
86
|
-
- [Installation](#installation)
|
|
87
|
-
- [Quickstart](#quickstart)
|
|
88
60
|
- [What is MCP?](#what-is-mcp)
|
|
61
|
+
- [Why FastMCP?](#why-fastmcp)
|
|
62
|
+
- [Key Features](#key-features)
|
|
63
|
+
- [Servers](#servers)
|
|
64
|
+
- [Clients](#clients)
|
|
65
|
+
- [What's New in v2?](#whats-new-in-v2)
|
|
66
|
+
- [Documentation](#documentation)
|
|
67
|
+
- [Installation](#installation)
|
|
68
|
+
- [Quickstart](#quickstart)
|
|
89
69
|
- [Core Concepts](#core-concepts)
|
|
90
70
|
- [The `FastMCP` Server](#the-fastmcp-server)
|
|
91
71
|
- [Tools](#tools)
|
|
@@ -115,7 +95,62 @@ Based on how the MCP ecosystem is evolving, FastMCP 2.0 builds on that foundatio
|
|
|
115
95
|
- [Formatting \& Linting](#formatting--linting)
|
|
116
96
|
- [Pull Requests](#pull-requests)
|
|
117
97
|
|
|
118
|
-
|
|
98
|
+
|
|
99
|
+
## What is MCP?
|
|
100
|
+
|
|
101
|
+
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:
|
|
102
|
+
|
|
103
|
+
- Expose data through **Resources** (think GET endpoints; load info into context)
|
|
104
|
+
- Provide functionality through **Tools** (think POST/PUT endpoints; execute actions)
|
|
105
|
+
- Define interaction patterns through **Prompts** (reusable templates)
|
|
106
|
+
- And more!
|
|
107
|
+
|
|
108
|
+
FastMCP provides a high-level, Pythonic interface for building and interacting with these servers.
|
|
109
|
+
|
|
110
|
+
## Why FastMCP?
|
|
111
|
+
|
|
112
|
+
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.
|
|
113
|
+
|
|
114
|
+
FastMCP aims to be:
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
🚀 **Fast:** High-level interface means less code and faster development
|
|
118
|
+
|
|
119
|
+
🍀 **Simple:** Build MCP servers with minimal boilerplate
|
|
120
|
+
|
|
121
|
+
🐍 **Pythonic:** Feels natural to Python developers
|
|
122
|
+
|
|
123
|
+
🔍 **Complete:** FastMCP aims to provide a full implementation of the core MCP specification for both servers and clients
|
|
124
|
+
|
|
125
|
+
## Key Features
|
|
126
|
+
|
|
127
|
+
### Servers
|
|
128
|
+
- **Create** servers with minimal boilerplate using intuitive decorators
|
|
129
|
+
- **Proxy** existing servers to modify configuration or transport
|
|
130
|
+
- **Compose** servers by into complex applications
|
|
131
|
+
- **Generate** servers from OpenAPI specs or FastAPI objects
|
|
132
|
+
|
|
133
|
+
### Clients
|
|
134
|
+
- **Interact** with MCP servers programmatically
|
|
135
|
+
- **Connect** to any MCP server using any transport
|
|
136
|
+
- **Test** your servers without manual intervention
|
|
137
|
+
- **Innovate** with core MCP capabilities like LLM sampling
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
## What's New in v2?
|
|
141
|
+
|
|
142
|
+
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`).
|
|
143
|
+
|
|
144
|
+
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.
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
## Documentation
|
|
148
|
+
|
|
149
|
+
📚 FastMCP's documentation is available at [gofastmcp.com](https://gofastmcp.com).
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### Installation
|
|
119
154
|
|
|
120
155
|
We strongly recommend installing FastMCP with [uv](https://docs.astral.sh/uv/), as it is required for deploying servers via the CLI:
|
|
121
156
|
|
|
@@ -134,7 +169,7 @@ cd fastmcp
|
|
|
134
169
|
uv sync
|
|
135
170
|
```
|
|
136
171
|
|
|
137
|
-
|
|
172
|
+
### Quickstart
|
|
138
173
|
|
|
139
174
|
Let's create a simple MCP server that exposes a calculator tool and some data:
|
|
140
175
|
|
|
@@ -163,23 +198,8 @@ You can install this server in [Claude Desktop](https://claude.ai/download) and
|
|
|
163
198
|
fastmcp install server.py
|
|
164
199
|
```
|
|
165
200
|
|
|
166
|
-
Alternatively, you can test it with the MCP Inspector:
|
|
167
|
-
```bash
|
|
168
|
-
fastmcp dev server.py
|
|
169
|
-
```
|
|
170
|
-
|
|
171
201
|

|
|
172
202
|
|
|
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
203
|
|
|
184
204
|
## Core Concepts
|
|
185
205
|
|
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
fastmcp/__init__.py,sha256=2bwhjiyLJisyobp1O9tVYMjriHZAx_f4bIKJYOL-Rpk,399
|
|
2
|
-
fastmcp/exceptions.py,sha256=
|
|
2
|
+
fastmcp/exceptions.py,sha256=9_KfANmugNdfZTCSZrohSeVmFmILZX5zz1LXI3wr_pw,508
|
|
3
3
|
fastmcp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
fastmcp/settings.py,sha256=r5LT5yAZmwS1Lppro_fzdrCUJ0otnAmgtjsNgDdQIvs,1980
|
|
5
5
|
fastmcp/cli/__init__.py,sha256=Ii284TNoG5lxTP40ETMGhHEq3lQZWxu9m9JuU57kUpQ,87
|
|
6
6
|
fastmcp/cli/claude.py,sha256=IAlcZ4qZKBBj09jZUMEx7EANZE_IR3vcu7zOBJmMOuU,4567
|
|
7
|
-
fastmcp/cli/cli.py,sha256=
|
|
7
|
+
fastmcp/cli/cli.py,sha256=M3BAkCjtnoGbyorUgaiqmCVSQg7S7_uEXerY-pqnOhk,13997
|
|
8
8
|
fastmcp/client/__init__.py,sha256=BXO9NUhntZ5GnUACfaRCzDJ5IzxqFJs8qKG-CRMSco4,490
|
|
9
9
|
fastmcp/client/base.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
10
10
|
fastmcp/client/client.py,sha256=OMJ1FzrlcRRYKQg3DFxiQpaNDo4uYK3Acs23rxPyE-g,7941
|
|
11
11
|
fastmcp/client/roots.py,sha256=IxI_bHwHTmg6c2H-s1av1ZgrRnNDieHtYwdGFbzXT5c,2471
|
|
12
12
|
fastmcp/client/sampling.py,sha256=WdRhIZbWv54rXYI8lWHv0thXmGCloZYPFpwJK9El_sQ,1613
|
|
13
|
-
fastmcp/client/transports.py,sha256=
|
|
14
|
-
fastmcp/prompts/__init__.py,sha256=
|
|
15
|
-
fastmcp/prompts/prompt.py,sha256=
|
|
16
|
-
fastmcp/prompts/prompt_manager.py,sha256=
|
|
17
|
-
fastmcp/resources/__init__.py,sha256=
|
|
13
|
+
fastmcp/client/transports.py,sha256=WVChsDV1UF0I3reiefsT3dipIh-P_K262TXpucwH-YY,14602
|
|
14
|
+
fastmcp/prompts/__init__.py,sha256=LtPAv2JKIu54AwUd3iwv-HUd4DPcwgEqy6itEd3BH_E,194
|
|
15
|
+
fastmcp/prompts/prompt.py,sha256=wy5gHHiTeYDsDufrVlfJzej_A7lTT34WNI9jwsEaNn8,6268
|
|
16
|
+
fastmcp/prompts/prompt_manager.py,sha256=HGwg8vsx1TVh9hBBWwuDdLm-M-FzBU5oB6Xu8nZC524,3505
|
|
17
|
+
fastmcp/resources/__init__.py,sha256=t0x1j8lc74rjUKtXe9H5Gs4fpQt82K4NgBK6Y7A0xTg,467
|
|
18
18
|
fastmcp/resources/resource.py,sha256=MrfRdLA2FEglvRJP7KgduG7na_qgkBo-_iXTzRbil6c,2038
|
|
19
|
-
fastmcp/resources/resource_manager.py,sha256=
|
|
19
|
+
fastmcp/resources/resource_manager.py,sha256=fIre1GkXhOyWJNGM36qwYoZQC74aEznV4oXfLfCoKdw,10971
|
|
20
20
|
fastmcp/resources/template.py,sha256=Fpjb51_ktWFpS1aQ5CFCt1SFuPe6S7CPuyzQCz7c3Mg,3742
|
|
21
21
|
fastmcp/resources/types.py,sha256=tigil7z-SUJMakGXzDLIGSqTepPrAsRpwqwtBA4yoUY,6168
|
|
22
22
|
fastmcp/server/__init__.py,sha256=pdkghG11VLMZiluQ-4_rl2JK1LMWmV003m9dDRUN8W4,92
|
|
23
|
-
fastmcp/server/context.py,sha256=
|
|
23
|
+
fastmcp/server/context.py,sha256=s1885AZRipKB3VltfaO3VEtMxGefKs8fdZByj-4tbNI,7120
|
|
24
24
|
fastmcp/server/openapi.py,sha256=J7HrAlRziaB2a6pwB0wStbjRJ1E5Lf818yMqD762s5U,22693
|
|
25
|
-
fastmcp/server/proxy.py,sha256=
|
|
26
|
-
fastmcp/server/server.py,sha256=
|
|
25
|
+
fastmcp/server/proxy.py,sha256=gYcoQFDIBraqWMOpWSsZLqefKjL_v0v74juLW1SU1AU,8058
|
|
26
|
+
fastmcp/server/server.py,sha256=ryN7o7G1gNFE1NsAuZVc3WpcmsBtcKOo-mXACN5NCoc,28814
|
|
27
27
|
fastmcp/tools/__init__.py,sha256=ocw-SFTtN6vQ8fgnlF8iNAOflRmh79xS1xdO0Bc3QPE,96
|
|
28
|
-
fastmcp/tools/tool.py,sha256=
|
|
28
|
+
fastmcp/tools/tool.py,sha256=yPRqEM8sntDIbWPtZBy9evDg3BXupe0BKqnpvMwy7Sc,3872
|
|
29
29
|
fastmcp/tools/tool_manager.py,sha256=oUT8ExxIKKpJnFxCUDwThRxdK7WADD40e6yjGBYDPmI,3498
|
|
30
30
|
fastmcp/utilities/__init__.py,sha256=-imJ8S-rXmbXMWeDamldP-dHDqAPg_wwmPVz-LNX14E,31
|
|
31
|
-
fastmcp/utilities/
|
|
31
|
+
fastmcp/utilities/decorators.py,sha256=AjhjsetQZF4YOPV5MTZmIxO21iFp_4fDIS3O2_KNCEg,2990
|
|
32
|
+
fastmcp/utilities/func_metadata.py,sha256=uh-u3gAjLD4kCcGf0ZkZZwBTTl-84JuANZTnDqP5ztI,7841
|
|
32
33
|
fastmcp/utilities/logging.py,sha256=1ipiOXzgWUp3Vih_JtEiLX7aAFmrUDZNr4KrZbofZTM,818
|
|
33
|
-
fastmcp/utilities/openapi.py,sha256=
|
|
34
|
+
fastmcp/utilities/openapi.py,sha256=HiGCC5nh1sWtJRJ7DrFNhdjf1m-7SgyXWOE4nsRvyOc,48762
|
|
34
35
|
fastmcp/utilities/types.py,sha256=m2rPYMzO-ZFvvZ46N-1-Xqyw693K7yq9Z2xR4pVELyk,2091
|
|
35
|
-
fastmcp-2.1.
|
|
36
|
-
fastmcp-2.1.
|
|
37
|
-
fastmcp-2.1.
|
|
38
|
-
fastmcp-2.1.
|
|
39
|
-
fastmcp-2.1.
|
|
36
|
+
fastmcp-2.1.1.dist-info/METADATA,sha256=Db4PK68mC7j-FCLfkUiyAg4hIaFgYho-X465u0c0sOs,26634
|
|
37
|
+
fastmcp-2.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
38
|
+
fastmcp-2.1.1.dist-info/entry_points.txt,sha256=ff8bMtKX1JvXyurMibAacMSKbJEPmac9ffAKU9mLnM8,44
|
|
39
|
+
fastmcp-2.1.1.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
40
|
+
fastmcp-2.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|