File tree Expand file tree Collapse file tree
src/jacobian/adapters/mcp Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3535 operating_guide ,
3636 server_instructions ,
3737)
38- from jacobian .adapters .mcp .remote import TenantRuntimeRouter
38+ from jacobian .adapters .mcp .remote import (
39+ DEFAULT_MAX_TENANT_RUNTIMES ,
40+ DEFAULT_TENANT_IDLE_TIMEOUT_SECONDS ,
41+ TenantRuntimeRouter ,
42+ )
3943from jacobian .adapters .mcp .resources import (
4044 _register_reasoning_resource ,
4145 _register_resources_and_prompts ,
@@ -402,24 +406,6 @@ def create_server(
402406 if tenant_isolation and capability_exclusions :
403407 raise ValueError ("capability exclusions are supported only by local evaluation" )
404408
405- # Keep ``--help`` and ``--version`` independent of the MCP runtime's
406- # heavier imports and shutdown hooks.
407- from mcp .server .mcpserver import Context
408-
409- from jacobian .adapters .mcp .remote import (
410- DEFAULT_MAX_TENANT_RUNTIMES ,
411- DEFAULT_TENANT_IDLE_TIMEOUT_SECONDS ,
412- TenantRuntimeRouter ,
413- )
414- from jacobian .runtime .model import JacobianRuntime
415-
416- globals ().update (
417- {
418- "Context" : Context ,
419- "JacobianRuntime" : JacobianRuntime ,
420- }
421- )
422-
423409 selected_authority = _selected_checker_authority (checker_authority )
424410 configured_root = _configured_root (state_dir )
425411 runtime = (
Original file line number Diff line number Diff line change 1010import pytest
1111from mcp .server .extension import Extension , ResourceBinding , ToolBinding
1212
13+ import jacobian .adapters .mcp .server as server_module
1314from jacobian .adapters .mcp .constants import ReasoningLogMode
1415from jacobian .adapters .mcp .server import JacobianCoreExtension , create_server
1516from jacobian .contracts .capabilities import CapabilityResult
@@ -38,12 +39,17 @@ def test_mcp_sdk_is_exactly_pinned_and_v2_bindings_are_used() -> None:
3839
3940def test_mcp_v2_static_validation_context_errors_and_structured_resources (
4041 tmp_path : Path ,
42+ monkeypatch : pytest .MonkeyPatch ,
4143) -> None :
44+ monkeypatch .delattr (server_module , "Context" , raising = False )
45+
4246 async def scenario () -> None :
4347 from mcp import Client
4448 from mcp .shared .exceptions import MCPError
4549
46- async with Client (create_server (tmp_path ), raise_exceptions = True ) as client :
50+ server = create_server (tmp_path )
51+ assert not hasattr (server_module , "Context" )
52+ async with Client (server , raise_exceptions = True ) as client :
4753 listed = await client .list_tools ()
4854 assert all (
4955 tool .input_schema .get ("additionalProperties" ) is False
You can’t perform that action at this time.
0 commit comments