Update dependencies and fix type issues by dsp-ant · Pull Request #1268 · modelcontextprotocol/python-sdk · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .github/workflows/shared.yml
2 changes: 1 addition & 1 deletion examples/clients/simple-auth-client/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
]
dependencies = [
"click>=8.0.0",
"click>=8.2.0",
"mcp>=1.0.0",
]

Expand Down
2 changes: 1 addition & 1 deletion examples/servers/simple-auth/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = [{ name = "Anthropic, PBC." }]
license = { text = "MIT" }
dependencies = [
"anyio>=4.5",
"click>=8.1.0",
"click>=8.2.0",
"httpx>=0.27",
"mcp",
"pydantic>=2.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/servers/simple-prompt/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
]
dependencies = ["anyio>=4.5", "click>=8.1.0", "httpx>=0.27", "mcp"]
dependencies = ["anyio>=4.5", "click>=8.2.0", "httpx>=0.27", "mcp"]

[project.scripts]
mcp-simple-prompt = "mcp_simple_prompt.server:main"
Expand Down
2 changes: 1 addition & 1 deletion examples/servers/simple-resource/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
]
dependencies = ["anyio>=4.5", "click>=8.1.0", "httpx>=0.27", "mcp"]
dependencies = ["anyio>=4.5", "click>=8.2.0", "httpx>=0.27", "mcp"]

[project.scripts]
mcp-simple-resource = "mcp_simple_resource.server:main"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ requires-python = ">=3.10"
authors = [{ name = "Anthropic, PBC." }]
keywords = ["mcp", "llm", "automation", "web", "fetch", "http", "streamable", "stateless"]
license = { text = "MIT" }
dependencies = ["anyio>=4.5", "click>=8.1.0", "httpx>=0.27", "mcp", "starlette", "uvicorn"]
dependencies = ["anyio>=4.5", "click>=8.2.0", "httpx>=0.27", "mcp", "starlette", "uvicorn"]

[project.scripts]
mcp-simple-streamablehttp-stateless = "mcp_simple_streamablehttp_stateless.server:main"
Expand Down
2 changes: 1 addition & 1 deletion examples/servers/simple-streamablehttp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ requires-python = ">=3.10"
authors = [{ name = "Anthropic, PBC." }]
keywords = ["mcp", "llm", "automation", "web", "fetch", "http", "streamable"]
license = { text = "MIT" }
dependencies = ["anyio>=4.5", "click>=8.1.0", "httpx>=0.27", "mcp", "starlette", "uvicorn"]
dependencies = ["anyio>=4.5", "click>=8.2.0", "httpx>=0.27", "mcp", "starlette", "uvicorn"]

[project.scripts]
mcp-simple-streamablehttp = "mcp_simple_streamablehttp.server:main"
Expand Down
2 changes: 1 addition & 1 deletion examples/servers/simple-tool/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
]
dependencies = ["anyio>=4.5", "click>=8.1.0", "httpx>=0.27", "mcp"]
dependencies = ["anyio>=4.5", "click>=8.2.0", "httpx>=0.27", "mcp"]

[project.scripts]
mcp-simple-tool = "mcp_simple_tool.server:main"
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ classifiers = [
]
dependencies = [
"anyio>=4.5",
"httpx>=0.27",
"httpx>=0.27.1",
"httpx-sse>=0.4",
"pydantic>=2.11.0,<3.0.0",
"starlette>=0.27",
"python-multipart>=0.0.9",
"sse-starlette>=1.6.1",
"pydantic-settings>=2.5.2",
"uvicorn>=0.23.1; sys_platform != 'emscripten'",
"uvicorn>=0.31.1; sys_platform != 'emscripten'",
"jsonschema>=4.20.0",
"pywin32>=310; sys_platform == 'win32'",
]
Expand All @@ -49,7 +49,7 @@ required-version = ">=0.7.2"

[dependency-groups]
dev = [
"pyright>=1.1.391",
"pyright>=1.1.400",
"pytest>=8.3.4",
"ruff>=0.8.5",
"trio>=0.26.2",
Expand Down
3 changes: 2 additions & 1 deletion tests/client/test_list_roots_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from mcp.client.session import ClientSession
from mcp.server.fastmcp.server import Context
from mcp.server.session import ServerSession
from mcp.shared.context import RequestContext
from mcp.shared.memory import (
create_connected_server_and_client_session as create_session,
Expand Down Expand Up @@ -35,7 +36,7 @@ async def list_roots_callback(
return callback_return

@server.tool("test_list_roots")
async def test_list_roots(context: Context, message: str): # type: ignore[reportUnknownMemberType]
async def test_list_roots(context: Context[ServerSession, None], message: str):
roots = await context.session.list_roots()
assert roots == callback_return
return True
Expand Down
2 changes: 2 additions & 0 deletions tests/client/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ async def test_client_session_initialize():
server_to_client_send, server_to_client_receive = anyio.create_memory_object_stream[SessionMessage](1)

initialized_notification = None
result = None

async def mock_server():
nonlocal initialized_notification
Expand Down Expand Up @@ -239,6 +240,7 @@ async def test_client_session_version_negotiation_success():
"""Test successful version negotiation with supported version"""
client_to_server_send, client_to_server_receive = anyio.create_memory_object_stream[SessionMessage](1)
server_to_client_send, server_to_client_receive = anyio.create_memory_object_stream[SessionMessage](1)
result = None

async def mock_server():
session_message = await client_to_server_receive.receive()
Expand Down
3 changes: 2 additions & 1 deletion tests/server/test_lowlevel_input_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def run_tool_test(
tools: list[Tool],
call_tool_handler: Callable[[str, dict[str, Any]], Awaitable[list[TextContent]]],
test_callback: Callable[[ClientSession], Awaitable[CallToolResult]],
) -> CallToolResult:
) -> CallToolResult | None:
"""Helper to run a tool test with minimal boilerplate.

Args:
Expand All @@ -33,6 +33,7 @@ async def run_tool_test(
The result of the tool call
"""
server = Server("test")
result = None

@server.list_tools()
async def list_tools():
Expand Down
4 changes: 3 additions & 1 deletion tests/server/test_lowlevel_output_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async def run_tool_test(
tools: list[Tool],
call_tool_handler: Callable[[str, dict[str, Any]], Awaitable[Any]],
test_callback: Callable[[ClientSession], Awaitable[CallToolResult]],
) -> CallToolResult:
) -> CallToolResult | None:
"""Helper to run a tool test with minimal boilerplate.

Args:
Expand All @@ -34,6 +34,8 @@ async def run_tool_test(
"""
server = Server("test")

result = None

@server.list_tools()
async def list_tools():
return tools
Expand Down
1 change: 1 addition & 0 deletions tests/server/test_lowlevel_tool_annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async def list_tools():
)
]

tools_result = None
server_to_client_send, server_to_client_receive = anyio.create_memory_object_stream[SessionMessage](10)
client_to_server_send, client_to_server_receive = anyio.create_memory_object_stream[SessionMessage](10)

Expand Down
2 changes: 2 additions & 0 deletions tests/shared/test_progress_notifications.py
Loading
Loading