Fix importorskip guard and add LiteLLM_TeamTableCachedObj import

- Add pytest.importorskip("mcp") at module level so tests skip cleanly
  in CI environments without the mcp package (instead of ImportError)
- Import LiteLLM_TeamTableCachedObj into MCP_AVAILABLE block so type
  annotations resolve for static analysis and get_type_hints()
- Remove string quotes from type annotations now that the import exists

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
yuneng-jiang 2026-03-20 12:13:09 -07:00
parent 1cd7a48c33
commit 700fd86de9
2 changed files with 6 additions and 3 deletions

View file

@ -112,6 +112,7 @@ if MCP_AVAILABLE:
)
from litellm.proxy._types import (
LiteLLM_MCPServerTable,
LiteLLM_TeamTableCachedObj,
LitellmUserRoles,
MakeMCPServersPublicRequest,
MCPApprovalStatus,
@ -147,7 +148,7 @@ if MCP_AVAILABLE:
user_api_key_dict: UserAPIKeyAuth,
team_id: Optional[str] = None,
server_id: Optional[str] = None,
) -> Tuple[str, "LiteLLM_TeamTableCachedObj"]:
) -> Tuple[str, LiteLLM_TeamTableCachedObj]:
"""
Verify that the caller is an MCP server manager for a team and (for edit/delete)
that the target server belongs to that team.
@ -206,7 +207,7 @@ if MCP_AVAILABLE:
async def _auto_assign_mcp_server_to_team(
server_id: str,
team_id: str,
team_obj: "LiteLLM_TeamTableCachedObj",
team_obj: LiteLLM_TeamTableCachedObj,
prisma_client: Any,
) -> None:
"""
@ -245,7 +246,7 @@ if MCP_AVAILABLE:
async def _remove_mcp_server_from_team(
server_id: str,
team_obj: "LiteLLM_TeamTableCachedObj",
team_obj: LiteLLM_TeamTableCachedObj,
) -> None:
"""Remove a server ID from a team's ObjectPermissionTable.mcp_servers list."""
from litellm.proxy.proxy_server import prisma_client

View file

@ -1,5 +1,7 @@
import pytest
pytest.importorskip("mcp", reason="mcp package not installed")
from litellm.proxy._types import (
LiteLLM_TeamTable,
LitellmUserRoles,