Closed
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featureenhancementRequest for a new feature that's not currently supportedRequest for a new feature that's not currently supportedready for workEnough information for someone to start working onEnough information for someone to start working on
Description
We should be using httpx.AsyncClient with httpx.ASGITransport.
Metadata
Metadata
Assignees
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featureenhancementRequest for a new feature that's not currently supportedRequest for a new feature that's not currently supportedready for workEnough information for someone to start working onEnough information for someone to start working on
Activity
jeevakumar-m commentedon May 30, 2025
could you pls give more insights on this , happy to work on this
Kludex commentedon May 30, 2025
The idea is to not have Uvicorn running on the test suite, it's to use the ASGITransport to "run as the server".
jeevakumar-m commentedon May 30, 2025
Ok got it thanks , it needs to be updated for all the applicable tests under folder named -> 'tests'. Could you please assign this task
knotseaborg commentedon Jun 24, 2025
@jeevakumar-m Any success with this issue?
I'm running into
ResourceWarning: Unclosed <MemoryObjectReceiveStream at xxxxxx>when testingtest_streamablehttp_client-like functions in test_streamable_http.py with ASGITransport.For the tests, I passed a client factory which returns
httpx.AsyncClientwired withhttpx.ASGITransporttostreamablehttp_client(referenced below).python-sdk/src/mcp/client/streamable_http.py
Lines 441 to 449 in 679b229
bjoaquinc commentedon Nov 2, 2025
Hello. I am a new contributor and picked up this issue as my first task.
I started implementing it and wanted to check if I have the right understanding.
ASGITransport works well for normal request/response tests, but it does not support streaming. It buffers until the application completes, so SSE, WebSockets, and other long-lived streams do not behave correctly. MCP relies on SSE and web socket functionality for testing, so those tests still appear to require a real server such as uvicorn.
I also tried
StreamingASGITransportinsrc/mcp/server/streaming_asgi_transport.pyhere for SSE tests, but I encountered resource and event loop cleanup issues (for example, resource busy and event loop closed errors). It does not currently seem like a drop-in replacement for uvicorn for streaming tests.Before I continue, can you confirm whether the intended approach for this issue is:
I wanted to check that I am aligned with the intended direction before submitting a PR.
Thank you.
Kludex commentedon Nov 2, 2025
We should implement the transport on our side, if it can't handle stream. Uvicorn should be dropped from the test suite. Maybe a good first step is to actually implement that transport.
bjoaquinc commentedon Nov 2, 2025
@Kludex Ok noted on this, thanks. I'll look into how to improve
StreamingASGITransportso that it can be used as a drop in replacement for uvicorn in streaming tests.maxisbey commentedon Aug 10, 2026
This landed as part of v2, which is now released — closing. Feel free to reopen if there's something still outstanding.