Skip to content

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]

fix(mcp): freeze the session group counter behind MappingProxyType

yassin72ef7033c2e2
diff --git a/litellm/proxy/_experimental/mcp_server/server.py b/litellm/proxy/_experimental/mcp_server/server.py
index 9adc203b092..524bac747ad 100644
--- a/litellm/proxy/_experimental/mcp_server/server.py
+++ b/litellm/proxy/_experimental/mcp_server/server.py
@@ -3838,7 +3838,7 @@ if MCP_AVAILABLE:
sessions: Sequence[MCPGatewaySession],
label_for: Callable[[MCPGatewaySession], str | None],
) -> tuple[MCPGatewaySessionGroupCount, ...]:
- counts: Final = Counter(label_for(session) for session in sessions)
+ counts: Final = types.MappingProxyType(Counter(label_for(session) for session in sessions))
return tuple(
sorted(
(MCPGatewaySessionGroupCount(label=label, count=count) for label, count in counts.items()),