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]

Merge branch 'main' into litellm_dev_10_09_2025_p1

Krish Dholakia5507d50acf87
diff --cc litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
index 9b7ccf7b41c,28581c778c6..1d8fa7f2feb
--- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
+++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
@@@ -1158,36 -1175,19 +1175,41 @@@ class MCPServerManager
extra_headers=extra_headers,
)
- async with client:
- # Use the original tool name (without prefix) for the actual call
- call_tool_params = MCPCallToolRequestParams(
- name=original_tool_name,
- arguments=arguments,
- )
- tasks.append(asyncio.create_task(client.call_tool(call_tool_params)))
+ call_tool_params = MCPCallToolRequestParams(
+ name=original_tool_name,
+ arguments=arguments,
+ )
+
+ async def _call_tool_via_client(client, params):
+ async with client:
+ return await client.call_tool(params)
+
+ tasks.append(
+ asyncio.create_task(_call_tool_via_client(client, call_tool_params))
+ )
+ # IMPORTANT: Must await tasks INSIDE the context manager to keep connection alive
+ try:
+ mcp_responses = await asyncio.gather(*tasks)
+ except (
+ BlockedPiiEntityError,
+ GuardrailRaisedException,
+ HTTPException,
+ ) as e:
+ # Re-raise guardrail exceptions to properly fail the MCP call
+ verbose_logger.error(
+ f"Guardrail blocked MCP tool call during result check: {str(e)}"
+ )
+ raise e
+
+ # If proxy_logging_obj is None, the tool call result is at index 0
+ # If proxy_logging_obj is not None, the tool call result is at index 1 (after the during hook task)
+ result_index = 1 if proxy_logging_obj else 0
+ result = mcp_responses[result_index]
+
+ return cast(CallToolResult, result)
+
+ # For OpenAPI tools, await outside the client context
try:
mcp_responses = await asyncio.gather(*tasks)
diff --cc litellm/proxy/_new_secret_config.yaml
index 68297d4a5fe,c0772f964ba..108bef4fff3
--- a/litellm/proxy/_new_secret_config.yaml
+++ b/litellm/proxy/_new_secret_config.yaml
@@@ -1,21 -1,4 +1,4 @@@
model_list:
- - model_name: gpt-5-mini
+ - model_name: gpt-5-codex
litellm_params:
- model: openai/gpt-4o-mini
- api_base: "https://webhook.site/2f385e05-00aa-402b-86d1-efc9261471a5"
- api_key: dummy
- - model_name: "byok-wildcard/*"
- litellm_params:
- model: openai/*
- - model_name: xai-grok-3
- litellm_params:
- model: xai/grok-3
- - model_name: hosted_vllm/whisper-v3
- litellm_params:
- model: hosted_vllm/whisper-v3
- api_base: "https://webhook.site/2f385e05-00aa-402b-86d1-efc9261471a5"
- api_key: dummy
-
- litellm_settings:
- callbacks: ["prometheus"]
- custom_prometheus_metadata_labels: ["metadata.initiative", "metadata.business-unit"]
- model: gpt-5-codex
++ model: gpt-5-codex