Closed
Description
Describe the bug
When sending an HTTP DELETE request to end the current session, this client SDK will log a warning if the server responds with 204 instead of 200:
python-sdk/src/mcp/client/streamable_http.py
Lines 413 to 414 in 76919cf
HTTP 204 is an acceptable status code for a DELETE that has no response payload.
To Reproduce
Given this simple client:
async def run():
# Connect to a streamable HTTP server
async with streamablehttp_client(
"<server_url>",
headers=headers,
) as (
read_stream,
write_stream,
_,
):
# Create a session using the client streams
async with ClientSession(read_stream, write_stream) as session:
# Initialize the connection
await session.initialize()
# List available tools
tools = await session.list_tools()
Running it produces:
❯ python main.py
Session termination failed: 204
Expected behavior
No warning. 204 is the correct response code to return for a body-less response, per RFC 7231.
Metadata
Metadata
Assignees
Labels
No labels