diff --git a/litellm/proxy/_experimental/mcp_server/openapi_oauth2_endpoints.py b/litellm/proxy/_experimental/mcp_server/openapi_oauth2_endpoints.py
index d6f0d5b1a4e..9fd1be888b7 100644
--- a/litellm/proxy/_experimental/mcp_server/openapi_oauth2_endpoints.py
+++ b/litellm/proxy/_experimental/mcp_server/openapi_oauth2_endpoints.py
@@ -125,6 +125,10 @@ def _build_error_html(title: str, message: str) -> str:
h2 {{ color: #dc2626; font-size: 20px; margin-bottom: 12px; }}
p {{ color: #475569; font-size: 14px; line-height: 1.6; }}
+
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 62408d52bc8..793a190d980 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
@@ -585,8 +585,22 @@ def test_spec_path_server_uses_tool_registry():
assert server.spec_path == "https://example.com/openapi.json"
assert server.is_byok is True
- # The spec_path short-circuit in _get_tools_from_server is conditional on this field
- assert manager is not None
+
+ # Verify the manager's short-circuit path: _get_tools_from_server checks
+ # spec_path before attempting MCP client creation. We confirm this by
+ # patching _create_mcp_client and asserting it is NOT called when spec_path is set.
+ from unittest.mock import AsyncMock, patch
+
+ with patch.object(manager, "_create_mcp_client", new_callable=AsyncMock) as mock_create:
+ # _get_tools_from_server is async but returns early for spec_path servers
+ import asyncio
+
+ async def _run():
+ return await manager._get_tools_from_server(server)
+
+ asyncio.get_event_loop().run_until_complete(_run())
+
+ mock_create.assert_not_called()
# ---------------------------------------------------------------------------