diff --git a/litellm/proxy/_experimental/mcp_server/server.py b/litellm/proxy/_experimental/mcp_server/server.py index 53d904367a5..45ca7291123 100644 --- a/litellm/proxy/_experimental/mcp_server/server.py +++ b/litellm/proxy/_experimental/mcp_server/server.py @@ -197,6 +197,7 @@ if MCP_AVAILABLE: from litellm.proxy._experimental.mcp_server.auth.litellm_auth_handler import ( MCPAuthenticatedUser, ) + from litellm.proxy._experimental.mcp_server.db import get_user_credential from litellm.proxy._experimental.mcp_server.mcp_server_manager import ( global_mcp_server_manager, ) @@ -1606,7 +1607,6 @@ if MCP_AVAILABLE: _byok_cred_cache.move_to_end(cache_key) # promote to MRU return credential - from litellm.proxy._experimental.mcp_server.db import get_user_credential from litellm.proxy.proxy_server import prisma_client if prisma_client is None: @@ -1695,7 +1695,6 @@ if MCP_AVAILABLE: ) return - from litellm.proxy._experimental.mcp_server.db import get_user_credential from litellm.proxy.proxy_server import prisma_client if prisma_client is None: diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_openapi_oauth2_endpoints.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_openapi_oauth2_endpoints.py index a367b62f1d0..49a9164b111 100644 --- a/tests/test_litellm/proxy/_experimental/mcp_server/test_openapi_oauth2_endpoints.py +++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_openapi_oauth2_endpoints.py @@ -167,6 +167,10 @@ async def test_callback_provider_error_in_json_body(): ) as mock_mgr, patch( "litellm.proxy._experimental.mcp_server.openapi_oauth2_endpoints.get_request_base_url", return_value="http://localhost:4000", + ), patch( + "litellm.proxy.proxy_server.prisma_client", + MagicMock(), + create=True, ), patch( "httpx.AsyncClient" ) as mock_client_cls: