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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(mcp): satisfy type-discipline lint
jesus3a97dc4d4a20
diff --git a/litellm/proxy/management_endpoints/mcp_management_endpoints.py b/litellm/proxy/management_endpoints/mcp_management_endpoints.pyindex 23e74e8b9b6..02edfcb2e74 100644--- a/litellm/proxy/management_endpoints/mcp_management_endpoints.py+++ b/litellm/proxy/management_endpoints/mcp_management_endpoints.py@@ -635,7 +635,7 @@ if MCP_AVAILABLE:def _preserved_admin_config_credentials(credentials: "MCPCredentials | str | None",- ) -> "dict[str, str | list[str]] | None":+ ) -> "dict[str, str | list[str]] | None": # mutable-ok: API response payload"""Keep non-secret admin-config keys and scopes, which are stored unencrypted so they lift outas plaintext; every secret and minted-token key is dropped.@@ -646,20 +646,24 @@ if MCP_AVAILABLE:parsed: object = credentialsif isinstance(credentials, str):try:- parsed = cast(object, json.loads(credentials))+ parsed = cast(object, json.loads(credentials)) # cast-ok: JSON parse result is validated belowexcept (ValueError, TypeError):return Noneif not isinstance(parsed, dict):return None- parsed_credentials: Final = cast(Mapping[str, object], parsed)+ parsed_credentials: Final = cast(Mapping[str, object], parsed) # cast-ok: dict shape validated abovescopes: Final[object] = parsed_credentials.get("scopes")- scopes_as_objects: Final[list[object]] = cast(list[object], scopes) if isinstance(scopes, list) else []- preserved_scopes: Final[dict[str, list[str]]] = (- {"scopes": cast(list[str], scopes_as_objects)}+ scopes_as_objects: Final = (+ cast(Sequence[object], scopes) # cast-ok: list shape validated above+ if isinstance(scopes, list)+ else ()+ )+ preserved_scopes: Final = (+ {"scopes": cast(list[str], scopes_as_objects)} # cast-ok: every scope is validated belowif scopes_as_objects and all(isinstance(scope, str) and scope for scope in scopes_as_objects)else {})- preserved: Final[dict[str, str | list[str]]] = {+ preserved: Final = { # mutable-ok: API response payload**{key: valuefor key in MCP_ADMIN_CONFIG_CREDENTIAL_KEYS