litellm - 💡(How to fix) Fix [Bug]: asyncio.CancelledError when listing tools for MCP server registered via REST API with transport: http + auth_type: oauth2

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

asyncio.exceptions.CancelledError File ".../litellm/proxy/_experimental/mcp_server/mcp_server_manager.py", line ... in _fetch_tools_with_timeout transport=http auth_type=oauth2

Registration response:

{ "server_id": "60cb722d-d685-4bfd-824f-3a2caf62348e", "status": "unknown", "health_check_error": null, "last_health_check": "2026-05-11T08:07:28.810223" }

Code Example

POST /v1/mcp/server
{
  "server_name": "DatabricksSQL",
  "transport": "http",
  "url": "https://<workspace>.azuredatabricks.net/api/2.0/mcp/sql",
  "auth_type": "oauth2",
  "token_url": "https://<workspace>.azuredatabricks.net/oidc/v1/token",
  "credentials": {
    "client_id": "<client_id>",
    "client_secret": "<client_secret>"
  }
}

---

asyncio.exceptions.CancelledError
  File ".../litellm/proxy/_experimental/mcp_server/mcp_server_manager.py", line ...
    in _fetch_tools_with_timeout
  transport=http  auth_type=oauth2


Registration response:

{
  "server_id": "60cb722d-d685-4bfd-824f-3a2caf62348e",
  "status": "unknown",
  "health_check_error": null,
  "last_health_check": "2026-05-11T08:07:28.810223"
}
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

When an MCP server using Streamable HTTP transport (transport: http) and OAuth2 client credentials (auth_type: oauth2) is registered via the REST API (POST /v1/mcp/server), tool discovery always fails silently. The server is created successfully (HTTP 201), background health check runs and sets last_health_check, but status stays permanently unknown and no tools are ever returned from that server. The LiteLLM pod logs show asyncio.CancelledError — the async task running the Streamable HTTP client is externally cancelled before the OAuth2 token exchange and tool listing can complete.

The same server configuration works correctly when registered via the ConfigMap mcp_servers: block — all tools are discovered at startup with no errors.

Steps to Reproduce

  1. Deploy LiteLLM Enterprise with a data plane (control plane / data plane split).
  2. Register an MCP server via REST API with transport: http and auth_type: oauth2:
POST /v1/mcp/server
{
  "server_name": "DatabricksSQL",
  "transport": "http",
  "url": "https://<workspace>.azuredatabricks.net/api/2.0/mcp/sql",
  "auth_type": "oauth2",
  "token_url": "https://<workspace>.azuredatabricks.net/oidc/v1/token",
  "credentials": {
    "client_id": "<client_id>",
    "client_secret": "<client_secret>"
  }
}
  1. Wait for background health check to run (observe last_health_check timestamp is set).
  2. Call GET /v1/mcp/tools?server_id=<id> — returns 0 tools from this server.
  3. Check pod logs — asyncio.CancelledError in _fetch_tools_with_timeout.

Relevant log output

asyncio.exceptions.CancelledError
  File ".../litellm/proxy/_experimental/mcp_server/mcp_server_manager.py", line ...
    in _fetch_tools_with_timeout
  transport=http  auth_type=oauth2


Registration response:

{
  "server_id": "60cb722d-d685-4bfd-824f-3a2caf62348e",
  "status": "unknown",
  "health_check_error": null,
  "last_health_check": "2026-05-11T08:07:28.810223"
}

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

docker.litellm.ai/berriai/litellm:v1.83.7-stable / MCP SDK 1.26.0

Twitter / LinkedIn details

https://www.linkedin.com/in/reddybhavaniprasad/

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - 💡(How to fix) Fix [Bug]: asyncio.CancelledError when listing tools for MCP server registered via REST API with transport: http + auth_type: oauth2