Skip to content

Commit 1f6e8ec

Browse files
committed
Use Client instead of ClientSession
1 parent b11e04f commit 1f6e8ec

File tree

2 files changed

+96
-99
lines changed

2 files changed

+96
-99
lines changed

tests/server/test_streamable_http_manager.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
import pytest
1010
from starlette.types import Message
1111

12-
from mcp import types
13-
from mcp.client.session import ClientSession
12+
from mcp import Client, types
1413
from mcp.client.streamable_http import streamable_http_client
1514
from mcp.server import streamable_http_manager
1615
from mcp.server.lowlevel import Server
@@ -332,9 +331,7 @@ async def list_tools(req: types.ListToolsRequest) -> types.ListToolsResult:
332331
async with (
333332
mcp_app.router.lifespan_context(mcp_app),
334333
httpx.ASGITransport(mcp_app) as transport,
335-
httpx.AsyncClient(transport=transport) as client,
336-
streamable_http_client(f"http://{host}/mcp", http_client=client) as (read_stream, write_stream),
337-
ClientSession(read_stream, write_stream) as session,
334+
httpx.AsyncClient(transport=transport) as http_client,
335+
Client(streamable_http_client(f"http://{host}/mcp", http_client=http_client)) as client,
338336
):
339-
await session.initialize()
340-
await session.list_tools()
337+
await client.list_tools()

0 commit comments

Comments
 (0)