From ba5cc5a5b318b0a60847100718b735775f233769 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sun, 28 Sep 2025 17:45:04 -0700 Subject: [PATCH] fix: fix linting errors --- .../_experimental/mcp_server/auth/user_api_key_auth_mcp.py | 2 +- .../proxy/_experimental/mcp_server/mcp_server_manager.py | 2 +- litellm/proxy/_experimental/mcp_server/rest_endpoints.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) 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()