Skip to content

The agent that grows with you

test: gate the two remaining MCP-SDK-dependent tests; keep mcp_serve's per-test gates

teknium1abd7a4753fef
diff --git a/tests/test_mcp_serve.py b/tests/test_mcp_serve.py
index ed47a3ec390..a1f2c20bd22 100644
--- a/tests/test_mcp_serve.py
+++ b/tests/test_mcp_serve.py
@@ -19,8 +19,6 @@ from unittest.mock import MagicMock
import pytest
-pytest.importorskip("mcp", reason="MCP SDK not installed")
-
# ---------------------------------------------------------------------------
# Fixtures
diff --git a/tests/tools/test_mcp_capability_gating.py b/tests/tools/test_mcp_capability_gating.py
index c23ab292e7a..f689298a7cd 100644
--- a/tests/tools/test_mcp_capability_gating.py
+++ b/tests/tools/test_mcp_capability_gating.py
@@ -250,8 +250,8 @@ def _mcp_error(code, message="boom"):
``.error.code`` attribute ``_is_method_not_found_error`` inspects survives
unchanged, which is the point of the structural check.
"""
- from mcp.shared.exceptions import MCPError
- return MCPError(code=code, message=message)
+ exceptions = pytest.importorskip("mcp.shared.exceptions", reason="MCP SDK not installed")
+ return exceptions.MCPError(code=code, message=message)
class TestMethodNotFoundDetection:
diff --git a/tests/tools/test_mcp_dashboard_oauth.py b/tests/tools/test_mcp_dashboard_oauth.py
index d7b297910dd..28e1baebfef 100644
--- a/tests/tools/test_mcp_dashboard_oauth.py
+++ b/tests/tools/test_mcp_dashboard_oauth.py
@@ -83,6 +83,8 @@ def test_dashboard_flow_accepts_only_one_concurrent_callback():
@pytest.mark.usefixtures("require_mcp_2_sdk")
def test_mcp_oauth_helpers_use_dashboard_flow_without_loopback_port():
+ # _build_client_metadata validates through the SDK's OAuthClientMetadata model.
+ pytest.importorskip("mcp.shared.auth", reason="MCP SDK not installed")
from tools.mcp_dashboard_oauth import DashboardOAuthFlow, dashboard_oauth_flow
from tools.mcp_oauth import (
HermesTokenStorage,