From c085619f292449ed27566506c0e34c9d13baf243 Mon Sep 17 00:00:00 2001 From: yassin Date: Thu, 17 Sep 2026 20:44:24 +0000 Subject: [PATCH] fix(mcp): pass the original receive to the SSE handler when no body was consumed Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/proxy/_experimental/mcp_server/server.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/_experimental/mcp_server/server.py b/litellm/proxy/_experimental/mcp_server/server.py index 1ba20a7aa0c..bfd0587f86b 100644 --- a/litellm/proxy/_experimental/mcp_server/server.py +++ b/litellm/proxy/_experimental/mcp_server/server.py @@ -4837,7 +4837,9 @@ if MCP_AVAILABLE: scope, receive, send, sse_body, _sse_client_ip ): return - sse_receive: Final = _replay_consumed_messages(sse_consumed_messages, receive) + sse_receive: Final = ( + _replay_consumed_messages(sse_consumed_messages, receive) if sse_consumed_messages else receive + ) async with _gateway_initialize_instructions_request_scope( user_api_key_auth,