Skip to content

Commit ae2b484

Browse files
use poetry instead of uv
1 parent c6fa1ff commit ae2b484

File tree

5 files changed

+120
-2599
lines changed

5 files changed

+120
-2599
lines changed

CLAUDE.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ This document contains critical information about working with this codebase. Fo
55
## Core Development Rules
66

77
1. Package Management
8-
- ONLY use uv, NEVER pip
9-
- Installation: `uv add package`
10-
- Running tools: `uv run tool`
11-
- Upgrading: `uv add --dev package --upgrade-package package`
12-
- FORBIDDEN: `uv pip install`, `@latest` syntax
8+
- ONLY use Poetry, NEVER pip
9+
- Installation: `poetry add package`
10+
- Dev dependencies: `poetry add --group dev package`
11+
- Running tools: `poetry run tool`
12+
- Upgrading: `poetry update package`
13+
- FORBIDDEN: `pip install`, manual dependency management
1314

1415
2. Code Quality
1516
- Type hints required for all code
@@ -19,7 +20,7 @@ This document contains critical information about working with this codebase. Fo
1920
- Line length: 120 chars maximum
2021

2122
3. Testing Requirements
22-
- Framework: `uv run --frozen pytest`
23+
- Framework: `poetry run pytest`
2324
- Async testing: use anyio, not asyncio
2425
- Coverage: test edge cases and errors
2526
- New features require tests
@@ -56,9 +57,9 @@ This document contains critical information about working with this codebase. Fo
5657
## Code Formatting
5758

5859
1. Ruff
59-
- Format: `uv run --frozen ruff format .`
60-
- Check: `uv run --frozen ruff check .`
61-
- Fix: `uv run --frozen ruff check . --fix`
60+
- Format: `poetry run ruff format .`
61+
- Check: `poetry run ruff check .`
62+
- Fix: `poetry run ruff check . --fix`
6263
- Critical issues:
6364
- Line length (88 chars)
6465
- Import sorting (I001)
@@ -69,7 +70,7 @@ This document contains critical information about working with this codebase. Fo
6970
- Imports: split into multiple lines
7071

7172
2. Type Checking
72-
- Tool: `uv run --frozen pyright`
73+
- Tool: `poetry run pyright`
7374
- Requirements:
7475
- Explicit None checks for Optional
7576
- Type narrowing for strings
@@ -109,7 +110,7 @@ This document contains critical information about working with this codebase. Fo
109110
- Pytest:
110111
- If the tests aren't finding the anyio pytest mark, try adding PYTEST_DISABLE_PLUGIN_AUTOLOAD=""
111112
to the start of the pytest run command eg:
112-
`PYTEST_DISABLE_PLUGIN_AUTOLOAD="" uv run --frozen pytest`
113+
`PYTEST_DISABLE_PLUGIN_AUTOLOAD="" poetry run pytest`
113114

114115
3. Best Practices
115116
- Check git status before commits

README.md

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -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

112112
Alternatively, 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:
133133
FastMCP quickstart example.
134134
135135
Run 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

139139
from mcp.server.fastmcp import FastMCP
@@ -180,7 +180,7 @@ _Full example: [examples/snippets/servers/fastmcp_quickstart.py](https://github.
180180
You 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

186186
Then add it to Claude Code:
@@ -722,7 +722,7 @@ Client usage:
722722
```python
723723
"""
724724
cd to the `examples/snippets` directory and run:
725-
uv run completion-client
725+
poetry run completion-client
726726
"""
727727

728728
import asyncio
@@ -734,9 +734,8 @@ from mcp.types import PromptReference, ResourceTemplateReference
734734

735735
# Create server parameters for stdio connection
736736
server_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
"""
1000999
Run 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

10041003
from pydantic import AnyHttpUrl
@@ -1160,28 +1159,28 @@ _Full lifespan example: [examples/snippets/servers/lifespan_example.py](https://
11601159
The 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

11741173
Once 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
11951194
This is the simplest way to run an MCP server directly.
11961195
cd 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
12281227
python 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
"""
12421241
Run 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

12461245
from 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
"""
16241623
Run 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

16281627
from collections.abc import AsyncIterator
@@ -1739,7 +1738,7 @@ The lifespan API provides:
17391738
```python
17401739
"""
17411740
Run 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

17451744
import 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
"""
18201819
Run 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

18241823
import asyncio
@@ -1921,7 +1920,7 @@ For full control over the response including the `_meta` field (for passing data
19211920
```python
19221921
"""
19231922
Run 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

19271926
import asyncio
@@ -2059,7 +2058,7 @@ from mcp.types import PaginatedRequestParams, Resource
20592058

20602059
async 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
"""
21112110
cd to the `examples/snippets/clients` directory and run:
2112-
uv run client
2111+
poetry run client
21132112
"""
21142113

21152114
import asyncio
@@ -2123,9 +2122,8 @@ from mcp.shared.context import RequestContext
21232122

21242123
# Create server parameters for stdio connection
21252124
server_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
"""
22032201
Run 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

22072205
import asyncio
@@ -2241,7 +2239,7 @@ When building MCP clients, the SDK provides utilities to help display human-read
22412239
```python
22422240
"""
22432241
cd to the `examples/snippets` directory and run:
2244-
uv run display-utilities-client
2242+
poetry run display-utilities-client
22452243
"""
22462244

22472245
import asyncio
@@ -2253,9 +2251,8 @@ from mcp.shared.metadata_utils import get_display_name
22532251

22542252
# Create server parameters for stdio connection
22552253
server_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
23322329
cd to the `examples/snippets` directory and run:
2333-
uv run oauth-client
2330+
poetry run oauth-client
23342331
"""
23352332

23362333
import asyncio

0 commit comments

Comments
 (0)