diff --git a/pyproject.toml b/pyproject.toml index cafe249c..bbe65807 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,6 +75,10 @@ dev = [ [tool.pytest.ini_options] asyncio_mode = "auto" asyncio_default_fixture_loop_scope = "function" +# Integration tests spin up real external MCP servers (e.g. `uvx +# mcp-server-sqlite`) and are deselected by default so the standard test run +# stays hermetic and green. Run them explicitly with `pytest -m integration`. +addopts = "-m 'not integration'" markers = [ "integration: end-to-end tests requiring external MCP servers", ] diff --git a/server_config.json b/server_config.json index 1b841920..0366a4a3 100644 --- a/server_config.json +++ b/server_config.json @@ -2,7 +2,7 @@ "mcpServers": { "sqlite": { "command": "uvx", - "args": ["mcp-server-sqlite", "--db-path", "test.db"] + "args": ["--with", "mcp<2", "mcp-server-sqlite", "--db-path", "test.db"] }, "echo": { "command": "uvx", diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 1a59cc8b..73920a82 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -27,8 +27,15 @@ async def tool_manager_sqlite(tmp_path): initialization_timeout=30.0, ) ok = await tm.initialize() - if not ok: - pytest.skip("Could not initialize sqlite server (not available)") + # ToolManager.initialize() can report success even when the external server + # failed to start (e.g. `uvx mcp-server-sqlite` is unavailable or resolves a + # version incompatible with the installed MCP SDK), leaving zero tools + # discovered. Skip rather than fail so a broken/missing external server can + # never turn a hermetic run red. + tools = await tm.get_unique_tools() if ok else [] + if not ok or not tools: + await tm.close() + pytest.skip("sqlite MCP server unavailable (no tools discovered)") try: yield tm finally: