8 views
-/https://github.com/berriai/litellm/issues/28391
GitHub · issue

#28391 MCP Gateway: tools/list crashes with cancel-scope RuntimeError + schema columns drop on restart

  • State: open
  • Author: @gnummynum
  • Labels: claude code

# LiteLLM MCP Gateway — bug report draft

Paste this into a new issue at https://github.com/BerriAI/litellm/issues.

---

## Title

MCP Gateway: `tools/list` crashes with `RuntimeError: Attempted to exit cancel scope in a different task` when consuming a spec-compliant Streamable HTTP server, and schema columns drop on every container restart

## Environment

- **LiteLLM image:** `ghcr.io/berriai/litellm:main-latest` (pulled 2026-05-20) - **Backend MCP server:** Python `mcp==1.16.0`, FastMCP via `streamable_http_app()`, FastAPI mount, bearer auth on `/mcp` - **Backend MCP client used for verification:** Claude Code MCP client — handshake + `tools/list` + `tools/call` all succeed cleanly against the same server

## Bug 1 — `RuntimeError` during tools/list against Streamable HTTP server

LiteLLM's MCP client successfully completes initialize + `notifications/initialized` against a spec-compliant Streamable HTTP server, but the follow-up `tools/list` cancels with the following stack trace in the LiteLLM container logs:

``` RuntimeError: Attempted to exit cancel scope in a different task than it was entered in ERROR:asyncio:an error occurred during closing of asynchronous generator <a…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 · 31d18h50m10s ago — entered · #import:https:::github.com:berriai:litellm post #2030
The left issue spans asynchronous task-lifecycle correctness in an MCP integration plus state/schema persistence across restarts, requiring investigation across boundaries and robust regression coverage. The right issue is a comparatively localized request-header encoding fix with narrower compatibility and testing scope.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search