Skip to content

Commit 866172c

Browse files
committed
Merge branch 'main' of https://github.com/modelcontextprotocol/python-sdk into feat/rfc7523
2 parents 27f38e2 + d1ac8d6 commit 866172c

File tree

17 files changed

+308
-286
lines changed

17 files changed

+308
-286
lines changed

.github/workflows/shared.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
strategy:
3737
matrix:
3838
python-version: ["3.10", "3.11", "3.12", "3.13"]
39+
dep-resolution: ["lowest-direct", "highest"]
3940
os: [ubuntu-latest, windows-latest]
4041

4142
steps:
@@ -48,18 +49,11 @@ jobs:
4849
version: 0.7.2
4950

5051
- name: Install the project
51-
run: uv sync --frozen --all-extras --python ${{ matrix.python-version }}
52+
run: uv sync --frozen --all-extras --python ${{ matrix.python-version }} --resolution ${{ matrix.dep-resolution }}
5253

5354
- name: Run pytest
5455
run: uv run --frozen --no-sync pytest
5556

56-
# This must run last as it modifies the environment!
57-
- name: Run pytest with lowest versions
58-
run: |
59-
uv sync --all-extras --upgrade
60-
uv run --no-sync pytest
61-
env:
62-
UV_RESOLUTION: lowest-direct
6357
readme-snippets:
6458
runs-on: ubuntu-latest
6559
steps:

examples/clients/simple-auth-client/pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ classifiers = [
1414
"Programming Language :: Python :: 3",
1515
"Programming Language :: Python :: 3.10",
1616
]
17-
dependencies = ["click>=8.0.0", "mcp"]
17+
dependencies = [
18+
"click>=8.2.0",
19+
"mcp>=1.0.0",
20+
]
1821

1922
[project.scripts]
2023
mcp-simple-auth-client = "mcp_simple_auth_client.main:cli"

examples/servers/simple-auth/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = [{ name = "Anthropic, PBC." }]
88
license = { text = "MIT" }
99
dependencies = [
1010
"anyio>=4.5",
11-
"click>=8.1.0",
11+
"click>=8.2.0",
1212
"httpx>=0.27",
1313
"mcp",
1414
"pydantic>=2.0",

examples/servers/simple-prompt/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ classifiers = [
1818
"Programming Language :: Python :: 3",
1919
"Programming Language :: Python :: 3.10",
2020
]
21-
dependencies = ["anyio>=4.5", "click>=8.1.0", "httpx>=0.27", "mcp"]
21+
dependencies = ["anyio>=4.5", "click>=8.2.0", "httpx>=0.27", "mcp"]
2222

2323
[project.scripts]
2424
mcp-simple-prompt = "mcp_simple_prompt.server:main"

examples/servers/simple-resource/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ classifiers = [
1818
"Programming Language :: Python :: 3",
1919
"Programming Language :: Python :: 3.10",
2020
]
21-
dependencies = ["anyio>=4.5", "click>=8.1.0", "httpx>=0.27", "mcp"]
21+
dependencies = ["anyio>=4.5", "click>=8.2.0", "httpx>=0.27", "mcp"]
2222

2323
[project.scripts]
2424
mcp-simple-resource = "mcp_simple_resource.server:main"

examples/servers/simple-streamablehttp-stateless/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ requires-python = ">=3.10"
77
authors = [{ name = "Anthropic, PBC." }]
88
keywords = ["mcp", "llm", "automation", "web", "fetch", "http", "streamable", "stateless"]
99
license = { text = "MIT" }
10-
dependencies = ["anyio>=4.5", "click>=8.1.0", "httpx>=0.27", "mcp", "starlette", "uvicorn"]
10+
dependencies = ["anyio>=4.5", "click>=8.2.0", "httpx>=0.27", "mcp", "starlette", "uvicorn"]
1111

1212
[project.scripts]
1313
mcp-simple-streamablehttp-stateless = "mcp_simple_streamablehttp_stateless.server:main"

examples/servers/simple-streamablehttp/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ requires-python = ">=3.10"
77
authors = [{ name = "Anthropic, PBC." }]
88
keywords = ["mcp", "llm", "automation", "web", "fetch", "http", "streamable"]
99
license = { text = "MIT" }
10-
dependencies = ["anyio>=4.5", "click>=8.1.0", "httpx>=0.27", "mcp", "starlette", "uvicorn"]
10+
dependencies = ["anyio>=4.5", "click>=8.2.0", "httpx>=0.27", "mcp", "starlette", "uvicorn"]
1111

1212
[project.scripts]
1313
mcp-simple-streamablehttp = "mcp_simple_streamablehttp.server:main"

examples/servers/simple-tool/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ classifiers = [
1818
"Programming Language :: Python :: 3",
1919
"Programming Language :: Python :: 3.10",
2020
]
21-
dependencies = ["anyio>=4.5", "click>=8.1.0", "httpx>=0.27", "mcp"]
21+
dependencies = ["anyio>=4.5", "click>=8.2.0", "httpx>=0.27", "mcp"]
2222

2323
[project.scripts]
2424
mcp-simple-tool = "mcp_simple_tool.server:main"

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ classifiers = [
2323
]
2424
dependencies = [
2525
"anyio>=4.5",
26-
"httpx>=0.27",
26+
"httpx>=0.27.1",
2727
"httpx-sse>=0.4",
2828
"pydantic>=2.11.0,<3.0.0",
2929
"starlette>=0.27",
3030
"python-multipart>=0.0.9",
3131
"sse-starlette>=1.6.1",
3232
"pydantic-settings>=2.5.2",
33-
"uvicorn>=0.23.1; sys_platform != 'emscripten'",
33+
"uvicorn>=0.31.1; sys_platform != 'emscripten'",
3434
"jsonschema>=4.20.0",
3535
"pywin32>=310; sys_platform == 'win32'",
3636
"pyjwt[crypto]>=2.10.1",
@@ -50,7 +50,7 @@ required-version = ">=0.7.2"
5050

5151
[dependency-groups]
5252
dev = [
53-
"pyright>=1.1.391",
53+
"pyright>=1.1.400",
5454
"pytest>=8.3.4",
5555
"ruff>=0.8.5",
5656
"trio>=0.26.2",

src/mcp/client/streamable_http.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ async def _handle_resumption_request(self, ctx: RequestContext) -> None:
248248
ctx.metadata.on_resumption_token_update if ctx.metadata else None,
249249
)
250250
if is_complete:
251+
await event_source.response.aclose()
251252
break
252253

253254
async def _handle_post_request(self, ctx: RequestContext) -> None:
@@ -330,6 +331,7 @@ async def _handle_sse_response(
330331
# If the SSE event indicates completion, like returning respose/error
331332
# break the loop
332333
if is_complete:
334+
await response.aclose()
333335
break
334336
except Exception as e:
335337
logger.exception("Error reading SSE stream:")

0 commit comments

Comments
 (0)