migration
This commit is contained in:
@@ -7,6 +7,8 @@ import pytest
|
||||
import pytest_asyncio
|
||||
from httpx import ASGITransport
|
||||
from httpx import AsyncClient
|
||||
from httpx2 import ASGITransport as McpASGITransport
|
||||
from httpx2 import AsyncClient as McpAsyncClient
|
||||
from mcp import ClientSession
|
||||
from mcp.client.streamable_http import streamable_http_client
|
||||
|
||||
@@ -35,15 +37,15 @@ def mcp_session_factory():
|
||||
mcp_url = f"http://testserver{app.state.settings.mounts.mcp}"
|
||||
async with (
|
||||
app.router.lifespan_context(app),
|
||||
AsyncClient(
|
||||
transport=ASGITransport(app=app),
|
||||
McpAsyncClient(
|
||||
transport=McpASGITransport(app=app),
|
||||
base_url="http://testserver",
|
||||
timeout=10.0,
|
||||
) as http_client,
|
||||
streamable_http_client(
|
||||
mcp_url,
|
||||
http_client=http_client,
|
||||
) as (read_stream, write_stream, _),
|
||||
) as (read_stream, write_stream),
|
||||
ClientSession(read_stream, write_stream) as session,
|
||||
):
|
||||
if initialize:
|
||||
|
||||
Reference in New Issue
Block a user