From c72760711d209dd44e1879faab3af5cc17bcf6c1 Mon Sep 17 00:00:00 2001 From: yuneng-jiang Date: Wed, 11 Mar 2026 22:53:55 -0700 Subject: [PATCH] Exclude allow_all_keys servers from team-scoped MCP server dropdown When a team is selected in the Create Key UI, the MCP server dropdown now only shows servers the team has explicit access to, not global allow_all_keys servers. Those servers are already accessible at request time without needing to be attached to a key. Co-Authored-By: Claude Opus 4.6 --- .../management_endpoints/mcp_management_endpoints.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/litellm/proxy/management_endpoints/mcp_management_endpoints.py b/litellm/proxy/management_endpoints/mcp_management_endpoints.py index 57c1786b610..22cd6fd141e 100644 --- a/litellm/proxy/management_endpoints/mcp_management_endpoints.py +++ b/litellm/proxy/management_endpoints/mcp_management_endpoints.py @@ -646,12 +646,14 @@ if MCP_AVAILABLE: team_id: str, ) -> List[LiteLLM_MCPServerTable]: """ - Return MCP servers scoped to a team: team's allowed servers + allow_all_keys servers. + Return MCP servers explicitly allowed by the team. Used by the Create Key UI to populate the MCP server dropdown. + + Does NOT include allow_all_keys servers — those are globally + accessible at request time and don't need to be attached to a key. """ from litellm.proxy.auth.auth_checks import get_team_object from litellm.proxy.management_helpers.object_permission_utils import ( - _get_allow_all_keys_server_ids, _get_team_allowed_mcp_servers, ) from litellm.proxy.proxy_server import prisma_client, user_api_key_cache @@ -663,9 +665,7 @@ if MCP_AVAILABLE: check_db_only=True, ) - team_server_ids = await _get_team_allowed_mcp_servers(team_obj) - allow_all_server_ids = _get_allow_all_keys_server_ids() - all_allowed_ids = team_server_ids | allow_all_server_ids + all_allowed_ids = await _get_team_allowed_mcp_servers(team_obj) if not all_allowed_ids: return [] @@ -693,7 +693,7 @@ if MCP_AVAILABLE: team_id: Optional[str] = Query( None, description="Filter MCP servers by team scope. When provided, returns only " - "servers the team has access to plus globally available (allow_all_keys) servers. " + "servers the team has explicit access to. " "Used by the Create Key UI to show team-scoped MCP servers.", ), ):