From 6068736e3a27edc1c0de9484b679b2a43e8b5eea Mon Sep 17 00:00:00 2001 From: Arvind Kumar Date: Fri, 23 Oct 2026 11:16:10 +0530 Subject: [PATCH] style(mcp): ruff format --- litellm/proxy/mcp_server/mcp_server_manager.py | 4 +++- .../test_mcp_jwt_signer_server_credential.py | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/litellm/proxy/mcp_server/mcp_server_manager.py b/litellm/proxy/mcp_server/mcp_server_manager.py index 3123bfc5784..eb6f29b36b4 100644 --- a/litellm/proxy/mcp_server/mcp_server_manager.py +++ b/litellm/proxy/mcp_server/mcp_server_manager.py @@ -7889,7 +7889,8 @@ class MCPServerManager: for offset in range(0, len(unique_server_ids), batch_size) ] return [server for batch in batches for server in batch if server is not None] - + + _STATIC_CREDENTIAL_AUTH_TYPES: Final = frozenset( (MCPAuth.api_key, MCPAuth.bearer_token, MCPAuth.token, MCPAuth.authorization, MCPAuth.basic) ) @@ -7907,4 +7908,5 @@ def _server_credential_occupies_authorization(server: MCPServer) -> bool: default_slot: Final = "X-API-Key" if server.auth_type == MCPAuth.api_key else "Authorization" return (server.upstream_token_header or default_slot).lower() == "authorization" + global_mcp_server_manager: Final[MCPServerManager] = MCPServerManager() diff --git a/tests/unit/proxy/_experimental/mcp_server/test_mcp_jwt_signer_server_credential.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_jwt_signer_server_credential.py index b27b28dd51a..b7b7e19e149 100644 --- a/tests/unit/proxy/_experimental/mcp_server/test_mcp_jwt_signer_server_credential.py +++ b/tests/unit/proxy/_experimental/mcp_server/test_mcp_jwt_signer_server_credential.py @@ -19,7 +19,9 @@ from litellm.types.mcp import MCPAuth, MCPTransport from litellm.types.mcp_server.mcp_server_manager import MCPServer SIGNER_SINGLETON = "litellm.proxy.guardrails.guardrail_hooks.mcp_jwt_signer.mcp_jwt_signer.get_mcp_jwt_signer" -SIGNER_INJECT = "litellm.proxy.guardrails.guardrail_hooks.mcp_jwt_signer.mcp_jwt_signer.inject_mcp_jwt_headers_for_upstream" +SIGNER_INJECT = ( + "litellm.proxy.guardrails.guardrail_hooks.mcp_jwt_signer.mcp_jwt_signer.inject_mcp_jwt_headers_for_upstream" +) AUTHORIZATION_AUTH_TYPES = [MCPAuth.bearer_token, MCPAuth.token, MCPAuth.authorization, MCPAuth.basic] @@ -158,8 +160,6 @@ async def test_tools_call_drops_hook_authorization_when_server_key_rides_authori @pytest.mark.asyncio async def test_tools_call_keeps_hook_authorization_when_server_key_rides_x_api_key(): - headers = await _call_tool_and_capture_extra_headers( - _server(MCPAuth.api_key), {"Authorization": "Bearer hook-jwt"} - ) + headers = await _call_tool_and_capture_extra_headers(_server(MCPAuth.api_key), {"Authorization": "Bearer hook-jwt"}) - assert headers.get("Authorization") == "Bearer hook-jwt" \ No newline at end of file + assert headers.get("Authorization") == "Bearer hook-jwt"