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
test mapped tests MCP
Ishaan Jafferc4022ade497a
diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex 29a65887747..06cb67e56c5 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -12975,6 +12975,39 @@"supports_vision": true,"supports_web_search": true},+ "gpt-5-pro-2025-10-06": {+ "input_cost_per_token": 1.5e-05,+ "input_cost_per_token_batches": 7.5e-06,+ "litellm_provider": "openai",+ "max_input_tokens": 400000,+ "max_output_tokens": 272000,+ "max_tokens": 272000,+ "mode": "responses",+ "output_cost_per_token": 1.2e-04,+ "output_cost_per_token_batches": 6e-05,+ "supported_endpoints": [+ "/v1/batch",+ "/v1/responses"+ ],+ "supported_modalities": [+ "text",+ "image"+ ],+ "supported_output_modalities": [+ "text"+ ],+ "supports_function_calling": true,+ "supports_native_streaming": false,+ "supports_parallel_function_calling": true,+ "supports_pdf_input": true,+ "supports_prompt_caching": true,+ "supports_reasoning": true,+ "supports_response_schema": true,+ "supports_system_messages": true,+ "supports_tool_choice": true,+ "supports_vision": true,+ "supports_web_search": true+ },"gpt-5-codex": {"cache_read_input_token_cost": 1.25e-07,"input_cost_per_token": 1.25e-06,diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py b/tests/test_litellm/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.pyindex 7da941db390..7927aa7f486 100644--- a/tests/test_litellm/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py+++ b/tests/test_litellm/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py@@ -1053,7 +1053,7 @@ async def test_get_team_object_permission_with_already_loaded_permission():from the team object without making an additional DB call."""from litellm.proxy._types import LiteLLM_ObjectPermissionTable, LiteLLM_TeamTable-+# Create mock object permissionmock_object_permission = LiteLLM_ObjectPermissionTable(object_permission_id="perm-123",@@ -1077,28 +1077,34 @@ async def test_get_team_object_permission_with_already_loaded_permission():)# Mock get_team_object to return our team with loaded permission+ # Also need to mock prisma_client from proxy_server+ mock_prisma = MagicMock()with patch(- "litellm.proxy._experimental.mcp_server.auth.user_api_key_auth_mcp.get_team_object"- ) as mock_get_team:+ "litellm.proxy.proxy_server.prisma_client",+ mock_prisma,+ ):with patch(- "litellm.proxy._experimental.mcp_server.auth.user_api_key_auth_mcp.get_object_permission"- ) as mock_get_perm:- mock_get_team.return_value = mock_team_obj-- # Call the method- result = await MCPRequestHandler._get_team_object_permission(- mock_user_auth- )-- # Assert we got the object permission- assert result == mock_object_permission- assert result.mcp_servers == ["server1", "server2"]-- # Verify get_team_object was called- mock_get_team.assert_called_once()-- # Verify get_object_permission was NOT called (since it was already loaded)- mock_get_perm.assert_not_called()+ "litellm.proxy.auth.auth_checks.get_team_object"+ ) as mock_get_team:+ with patch(+ "litellm.proxy.auth.auth_checks.get_object_permission"+ ) as mock_get_perm:+ mock_get_team.return_value = mock_team_obj++ # Call the method+ result = await MCPRequestHandler._get_team_object_permission(+ mock_user_auth+ )++ # Assert we got the object permission+ assert result == mock_object_permission+ assert result.mcp_servers == ["server1", "server2"]++ # Verify get_team_object was called+ mock_get_team.assert_called_once()++ # Verify get_object_permission was NOT called (since it was already loaded)+ mock_get_perm.assert_not_called()@pytest.mark.asyncio@@ -1108,7 +1114,7 @@ async def test_get_team_object_permission_fetches_from_db_when_not_loaded():is not loaded but object_permission_id exists."""from litellm.proxy._types import LiteLLM_ObjectPermissionTable, LiteLLM_TeamTable-+# Create mock object permission (to be returned from DB)mock_object_permission = LiteLLM_ObjectPermissionTable(object_permission_id="perm-456",@@ -1132,35 +1138,41 @@ async def test_get_team_object_permission_fetches_from_db_when_not_loaded():)# Mock the methods+ # Also need to mock prisma_client from proxy_server+ mock_prisma = MagicMock()with patch(- "litellm.proxy._experimental.mcp_server.auth.user_api_key_auth_mcp.get_team_object"- ) as mock_get_team:+ "litellm.proxy.proxy_server.prisma_client",+ mock_prisma,+ ):with patch(- "litellm.proxy._experimental.mcp_server.auth.user_api_key_auth_mcp.get_object_permission"- ) as mock_get_perm:- mock_get_team.return_value = mock_team_obj- mock_get_perm.return_value = mock_object_permission-- # Call the method- result = await MCPRequestHandler._get_team_object_permission(- mock_user_auth- )-- # Assert we got the object permission- assert result == mock_object_permission- assert result.mcp_servers == ["server3", "server4"]-- # Verify get_team_object was called- mock_get_team.assert_called_once()-- # Verify get_object_permission WAS called (since it wasn't loaded)- mock_get_perm.assert_called_once_with(- object_permission_id="perm-456",- prisma_client=mock.ANY,- user_api_key_cache=mock.ANY,- parent_otel_span=mock_user_auth.parent_otel_span,- proxy_logging_obj=mock.ANY,- )+ "litellm.proxy.auth.auth_checks.get_team_object"+ ) as mock_get_team:+ with patch(+ "litellm.proxy.auth.auth_checks.get_object_permission"+ ) as mock_get_perm:+ mock_get_team.return_value = mock_team_obj+ mock_get_perm.return_value = mock_object_permission++ # Call the method+ result = await MCPRequestHandler._get_team_object_permission(+ mock_user_auth+ )++ # Assert we got the object permission+ assert result == mock_object_permission+ assert result.mcp_servers == ["server3", "server4"]++ # Verify get_team_object was called+ mock_get_team.assert_called_once()++ # Verify get_object_permission WAS called (since it wasn't loaded)+ mock_get_perm.assert_called_once_with(+ object_permission_id="perm-456",+ prisma_client=mock.ANY,+ user_api_key_cache=mock.ANY,+ parent_otel_span=mock_user_auth.parent_otel_span,+ proxy_logging_obj=mock.ANY,+ )@pytest.mark.asyncio@@ -1170,7 +1182,7 @@ async def test_get_allowed_mcp_servers_for_team_uses_helper():helper which handles both loaded and unloaded object_permission cases."""from litellm.proxy._types import LiteLLM_ObjectPermissionTable-+# Create mock object permission with servers and access groupsmock_object_permission = LiteLLM_ObjectPermissionTable(object_permission_id="perm-789",diff --git a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.pyindex 929ec41e09a..99325693b53 100644--- a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py+++ b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py@@ -2,7 +2,6 @@ import asyncioimport jsonimport osimport sys-from litellm._uuid import uuidfrom typing import Optional, castfrom unittest.mock import AsyncMock, MagicMock, patch@@ -10,6 +9,8 @@ import pytestfrom fastapi import HTTPExceptionfrom fastapi.testclient import TestClient+from litellm._uuid import uuid+sys.path.insert(0, os.path.abspath("../../../")) # Adds the parent directory to the system path@@ -412,8 +413,10 @@ async def test_new_team_with_mcp_tool_permissions(mock_db_client, mock_admin_aut)# Verify mcp_tool_permissions was stored+ import jsonassert "mcp_tool_permissions" in created_permission_data- assert created_permission_data["mcp_tool_permissions"] == {+ # mcp_tool_permissions is stored as a JSON string+ assert json.loads(created_permission_data["mcp_tool_permissions"]) == {"server_a": ["read_wiki_structure", "read_wiki_contents"],"server_b": ["ask_question"],}