The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Fix/mcp health check cancelled error (#19851)
jquintere78d17cd0a6b
diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.pyindex fd251488db4..54047932ad5 100644--- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py+++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py@@ -2481,6 +2481,9 @@ class MCPServerManager:except asyncio.TimeoutError:health_check_error = "Health check timed out after 10 seconds"status = "unhealthy"+ except asyncio.CancelledError:+ health_check_error = "Health check was cancelled"+ status = "unknown"except Exception as e:health_check_error = str(e)status = "unhealthy"diff --git a/tests/mcp_tests/test_mcp_server.py b/tests/mcp_tests/test_mcp_server.pyindex ea823df1fb2..9718d714cfe 100644--- a/tests/mcp_tests/test_mcp_server.py+++ b/tests/mcp_tests/test_mcp_server.py@@ -1053,6 +1053,7 @@ async def test_mcp_server_manager_access_groups_from_config():mcp_server_manager_mod.global_mcp_server_manager = original_managerasync def test_mcp_server_manager_config_integration_with_database():"""Test that config-based servers properly integrate with database servers,