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: fix linting errors

Krrish Dholakiaba5cc5a5b318
diff --git a/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py b/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py
index 581da3cec2e..6d6ebec6d05 100644
--- a/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py
+++ b/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py
@@ -164,7 +164,7 @@ class MCPRequestHandler:
Returns:
Dict[str, Dict[str, str]]: Mapping of server alias to header dict
"""
- server_auth_headers = {}
+ server_auth_headers: Dict[str, Dict[str, str]] = {}
prefix = "x-mcp-"
for header_name, header_value in headers.items():
diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
index 6423a9ae153..d4297bc7c94 100644
--- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
+++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
@@ -729,7 +729,7 @@ class MCPServerManager:
)
# Get server-specific auth header if available
- server_auth_header = None
+ server_auth_header: Optional[Union[Dict[str, str], str]] = None
if mcp_server_auth_headers and mcp_server.alias:
server_auth_header = mcp_server_auth_headers.get(mcp_server.alias)
elif mcp_server_auth_headers and mcp_server.server_name:
diff --git a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py b/litellm/proxy/_experimental/mcp_server/rest_endpoints.py
index ef770a9d433..66f6e0ca0fb 100644
--- a/litellm/proxy/_experimental/mcp_server/rest_endpoints.py
+++ b/litellm/proxy/_experimental/mcp_server/rest_endpoints.py
@@ -1,5 +1,5 @@
import importlib
-from typing import Dict, List, Optional
+from typing import Dict, List, Optional, Union
from fastapi import APIRouter, Depends, Query, Request
@@ -34,9 +34,9 @@ if MCP_AVAILABLE:
############ MCP Server REST API Routes #################
def _get_server_auth_header(
server,
- mcp_server_auth_headers: Optional[Dict[str, str]],
+ mcp_server_auth_headers: Optional[Dict[str, Dict[str, str]]],
mcp_auth_header: Optional[str],
- ) -> Optional[str]:
+ ) -> Optional[Union[Dict[str, str], str]]:
"""Helper function to get server-specific auth header with case-insensitive matching."""
if mcp_server_auth_headers and server.alias:
normalized_server_alias = server.alias.lower()