fix(mcp): backport StreamableHTTPSessionManager stateless fix to v1.81.12-stable#22030
Merged
krrishdholakia merged 1 commit intoBerriAI:litellm_stable_release_1_81_12from Feb 24, 2026
Conversation
…iAI#21323) PR BerriAI#19809 changed stateless=True to stateless=False to enable progress notifications for MCP tool calls. This caused the mcp library to enforce mcp-session-id headers on all non-initialize requests, breaking MCP Inspector, curl, and any client without automatic session management. Revert to stateless=True to restore compatibility with all MCP clients. The progress notification code already handles missing sessions gracefully (defensive checks + try/except), so no other changes are needed. Fixes BerriAI#20242
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile SummaryCherry-pick of #21323 onto
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| litellm/proxy/_experimental/mcp_server/server.py | One-line change reverting stateless=False → stateless=True in StreamableHTTPSessionManager constructor. Fixes regression from PR #19809 that broke MCP clients without session management. |
| tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.py | Adds a regression test asserting session_manager.stateless is True, plus adds @pytest.mark.no_parallel to an adjacent test. No real network calls — all mock-based. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[MCP Client Request] --> B{stateless flag?}
B -->|stateless=True| C[Accept request without mcp-session-id]
B -->|stateless=False| D{Has mcp-session-id header?}
D -->|Yes| E[Process request]
D -->|No| F[Reject request ❌]
C --> E
E --> G[Return response to client]
style B fill:#f9f,stroke:#333
style C fill:#9f9,stroke:#333
style F fill:#f99,stroke:#333
Last reviewed commit: 524cf26
7e4e454
into
BerriAI:litellm_stable_release_1_81_12
4 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-pick of #21323 onto
v1.81.12-stable.Reverts
stateless=False→stateless=TrueinStreamableHTTPSessionManagerand includes a regression test. The original fix was merged tomainon Feb 16 but missed the v1.81.12-stable cut.Fixes #20242