@@ -94,19 +94,19 @@ The Model Context Protocol allows applications to provide context for LLMs in a
9494
9595### Adding MCP to your python project
9696
97- We recommend using [ uv ] ( https://docs.astral.sh/uv / ) to manage your Python projects.
97+ We recommend using [ Poetry ] ( https://python-poetry.org / ) to manage your Python projects.
9898
99- If you haven't created a uv -managed project yet, create one:
99+ If you haven't created a Poetry -managed project yet, create one:
100100
101101 ``` bash
102- uv init mcp-server-demo
102+ poetry new mcp-server-demo
103103 cd mcp-server-demo
104104 ```
105105
106106 Then add MCP to your project dependencies:
107107
108108 ``` bash
109- uv add " mcp[cli]"
109+ poetry add " mcp[cli]"
110110 ```
111111
112112Alternatively, for projects using pip for dependencies:
@@ -117,10 +117,10 @@ pip install "mcp[cli]"
117117
118118### Running the standalone MCP development tools
119119
120- To run the mcp command with uv :
120+ To run the mcp command with Poetry :
121121
122122``` bash
123- uv run mcp
123+ poetry run mcp
124124```
125125
126126## Quickstart
@@ -133,7 +133,7 @@ Let's create a simple MCP server that exposes a calculator tool and some data:
133133FastMCP quickstart example.
134134
135135Run from the repository root:
136- uv run examples/snippets/servers/fastmcp_quickstart.py
136+ poetry run python examples/snippets/servers/fastmcp_quickstart.py
137137"""
138138
139139from mcp.server.fastmcp import FastMCP
@@ -180,7 +180,7 @@ _Full example: [examples/snippets/servers/fastmcp_quickstart.py](https://github.
180180You can install this server in [ Claude Code] ( https://docs.claude.com/en/docs/claude-code/mcp ) and interact with it right away. First, run the server:
181181
182182``` bash
183- uv run --with mcp examples/snippets/servers/fastmcp_quickstart.py
183+ poetry run python examples/snippets/servers/fastmcp_quickstart.py
184184```
185185
186186Then add it to Claude Code:
@@ -722,7 +722,7 @@ Client usage:
722722``` python
723723"""
724724cd to the `examples/snippets` directory and run:
725- uv run completion-client
725+ poetry run completion-client
726726"""
727727
728728import asyncio
@@ -734,9 +734,8 @@ from mcp.types import PromptReference, ResourceTemplateReference
734734
735735# Create server parameters for stdio connection
736736server_params = StdioServerParameters(
737- command = " uv " , # Using uv to run the server
737+ command = " poetry " , # Using poetry to run the server
738738 args = [" run" , " server" , " completion" , " stdio" ], # Server with completion support
739- env = {" UV_INDEX" : os.environ.get(" UV_INDEX" , " " )},
740739)
741740
742741
@@ -998,7 +997,7 @@ MCP servers can use authentication by providing an implementation of the `TokenV
998997``` python
999998"""
1000999Run from the repository root:
1001- uv run examples/snippets/servers/oauth_server.py
1000+ poetry run python examples/snippets/servers/oauth_server.py
10021001"""
10031002
10041003from pydantic import AnyHttpUrl
@@ -1160,28 +1159,28 @@ _Full lifespan example: [examples/snippets/servers/lifespan_example.py](https://
11601159The fastest way to test and debug your server is with the MCP Inspector:
11611160
11621161``` bash
1163- uv run mcp dev server.py
1162+ poetry run mcp dev server.py
11641163
11651164# Add dependencies
1166- uv run mcp dev server.py --with pandas --with numpy
1165+ poetry run mcp dev server.py --with pandas --with numpy
11671166
11681167# Mount local code
1169- uv run mcp dev server.py --with-editable .
1168+ poetry run mcp dev server.py --with-editable .
11701169```
11711170
11721171### Claude Desktop Integration
11731172
11741173Once your server is ready, install it in Claude Desktop:
11751174
11761175``` bash
1177- uv run mcp install server.py
1176+ poetry run mcp install server.py
11781177
11791178# Custom name
1180- uv run mcp install server.py --name " My Analytics Server"
1179+ poetry run mcp install server.py --name " My Analytics Server"
11811180
11821181# Environment variables
1183- uv run mcp install server.py -v API_KEY=abc123 -v DB_URL=postgres://...
1184- uv run mcp install server.py -f .env
1182+ poetry run mcp install server.py -v API_KEY=abc123 -v DB_URL=postgres://...
1183+ poetry run mcp install server.py -f .env
11851184```
11861185
11871186### Direct Execution
@@ -1194,7 +1193,7 @@ For advanced scenarios like custom deployments:
11941193
11951194This is the simplest way to run an MCP server directly.
11961195cd to the `examples/snippets` directory and run:
1197- uv run direct-execution-server
1196+ poetry run direct-execution-server
11981197 or
11991198 python servers/direct_execution.py
12001199"""
@@ -1227,10 +1226,10 @@ Run it with:
12271226``` bash
12281227python servers/direct_execution.py
12291228# or
1230- uv run mcp run servers/direct_execution.py
1229+ poetry run mcp run servers/direct_execution.py
12311230```
12321231
1233- Note that ` uv run mcp run` or ` uv run mcp dev` only supports server using FastMCP and not the low-level server variant.
1232+ Note that ` poetry run mcp run` or ` poetry run mcp dev` only supports server using FastMCP and not the low-level server variant.
12341233
12351234### Streamable HTTP Transport
12361235
@@ -1240,7 +1239,7 @@ Note that `uv run mcp run` or `uv run mcp dev` only supports server using FastMC
12401239``` python
12411240"""
12421241Run from the repository root:
1243- uv run examples/snippets/servers/streamable_config.py
1242+ poetry run python examples/snippets/servers/streamable_config.py
12441243"""
12451244
12461245from mcp.server.fastmcp import FastMCP
@@ -1622,7 +1621,7 @@ For more control, you can use the low-level server implementation directly. This
16221621``` python
16231622"""
16241623Run from the repository root:
1625- uv run examples/snippets/servers/lowlevel/lifespan.py
1624+ poetry run python examples/snippets/servers/lowlevel/lifespan.py
16261625"""
16271626
16281627from collections.abc import AsyncIterator
@@ -1739,7 +1738,7 @@ The lifespan API provides:
17391738``` python
17401739"""
17411740Run from the repository root:
1742- uv run examples/snippets/servers/lowlevel/basic.py
1741+ poetry run python examples/snippets/servers/lowlevel/basic.py
17431742"""
17441743
17451744import asyncio
@@ -1808,7 +1807,7 @@ if __name__ == "__main__":
18081807_ Full example: [ examples/snippets/servers/lowlevel/basic.py] ( https://github.com/modelcontextprotocol/python-sdk/blob/main/examples/snippets/servers/lowlevel/basic.py ) _
18091808<!-- /snippet-source -->
18101809
1811- Caution: The ` uv run mcp run` and ` uv run mcp dev` tool doesn't support low-level server.
1810+ Caution: The ` poetry run mcp run` and ` poetry run mcp dev` tool doesn't support low-level server.
18121811
18131812#### Structured Output Support
18141813
@@ -1818,7 +1817,7 @@ The low-level server supports structured output for tools, allowing you to retur
18181817``` python
18191818"""
18201819Run from the repository root:
1821- uv run examples/snippets/servers/lowlevel/structured_output.py
1820+ poetry run python examples/snippets/servers/lowlevel/structured_output.py
18221821"""
18231822
18241823import asyncio
@@ -1921,7 +1920,7 @@ For full control over the response including the `_meta` field (for passing data
19211920``` python
19221921"""
19231922Run from the repository root:
1924- uv run examples/snippets/servers/lowlevel/direct_call_tool_result.py
1923+ poetry run python examples/snippets/servers/lowlevel/direct_call_tool_result.py
19251924"""
19261925
19271926import asyncio
@@ -2059,7 +2058,7 @@ from mcp.types import PaginatedRequestParams, Resource
20592058
20602059async def list_all_resources () -> None :
20612060 """ Fetch all resources using pagination."""
2062- async with stdio_client(StdioServerParameters(command = " uv " , args = [" run" , " mcp-simple-pagination" ])) as (
2061+ async with stdio_client(StdioServerParameters(command = " poetry " , args = [" run" , " mcp-simple-pagination" ])) as (
20632062 read,
20642063 write,
20652064 ):
@@ -2109,7 +2108,7 @@ The SDK provides a high-level client interface for connecting to MCP servers usi
21092108``` python
21102109"""
21112110cd to the `examples/snippets/clients` directory and run:
2112- uv run client
2111+ poetry run client
21132112"""
21142113
21152114import asyncio
@@ -2123,9 +2122,8 @@ from mcp.shared.context import RequestContext
21232122
21242123# Create server parameters for stdio connection
21252124server_params = StdioServerParameters(
2126- command = " uv " , # Using uv to run the server
2125+ command = " poetry " , # Using poetry to run the server
21272126 args = [" run" , " server" , " fastmcp_quickstart" , " stdio" ], # We're already in snippets dir
2128- env = {" UV_INDEX" : os.environ.get(" UV_INDEX" , " " )},
21292127)
21302128
21312129
@@ -2201,7 +2199,7 @@ Clients can also connect using [Streamable HTTP transport](https://modelcontextp
22012199``` python
22022200"""
22032201Run from the repository root:
2204- uv run examples/snippets/clients/streamable_basic.py
2202+ poetry run python examples/snippets/clients/streamable_basic.py
22052203"""
22062204
22072205import asyncio
@@ -2241,7 +2239,7 @@ When building MCP clients, the SDK provides utilities to help display human-read
22412239``` python
22422240"""
22432241cd to the `examples/snippets` directory and run:
2244- uv run display-utilities-client
2242+ poetry run display-utilities-client
22452243"""
22462244
22472245import asyncio
@@ -2253,9 +2251,8 @@ from mcp.shared.metadata_utils import get_display_name
22532251
22542252# Create server parameters for stdio connection
22552253server_params = StdioServerParameters(
2256- command = " uv " , # Using uv to run the server
2254+ command = " poetry " , # Using poetry to run the server
22572255 args = [" run" , " server" , " fastmcp_quickstart" , " stdio" ],
2258- env = {" UV_INDEX" : os.environ.get(" UV_INDEX" , " " )},
22592256)
22602257
22612258
@@ -2330,7 +2327,7 @@ To spin up RS server locally, see
23302327 examples/servers/simple-auth/README.md
23312328
23322329cd to the `examples/snippets` directory and run:
2333- uv run oauth-client
2330+ poetry run oauth-client
23342331"""
23352332
23362333import asyncio
0 commit comments