mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-29 08:21:22 +00:00
* fix: strip stale mcp-session-id header to prevent 'Session not found' error loop When VSCode reconnects to LiteLLM's MCP endpoint after a reload, it sends a stale mcp-session-id header. The session was already cleaned up, causing a 404 'Session not found' error. VSCode retries with the same stale ID, creating an infinite error loop. Before forwarding requests to the StreamableHTTP session manager, check if the mcp-session-id header references a valid session. If the session doesn't exist, strip the header so a new session is created automatically. Fixes #20292 * refactor: extract stale session handling into _strip_stale_mcp_session_header helper