style(mcp): ruff format

This commit is contained in:
Arvind Kumar 2026-10-23 11:16:10 +05:30
parent e944217dab
commit 6068736e3a
2 changed files with 8 additions and 6 deletions

View file

@ -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()

View file

@ -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"
assert headers.get("Authorization") == "Bearer hook-jwt"