fix(mcp): auto-register tools on startup and support cross-platform setup for all major AI IDEs

- Fix missing mcp_server.tools import on server initialization so mobile_run_task, mobile_manage_task, mobile_get_device_state, and mobile_inspect_trace are automatically registered.

- Inject PYTHONPATH in generated and installed MCP configurations to guarantee Python module resolution across Windows, macOS, and Linux regardless of IDE CWD.

- Expand artemis mcp --install and --generate-config to support VS Code, Cline, Roo Code, Claude Code CLI (~/.claude.json), Cursor, Windsurf, Antigravity, and OpenClaw.

- Enhance config file merging with robust exception handling and fallback initialization.
This commit is contained in:
somew1nd committed 2026-08-18 17:49:47 -07:00
1 parent fc6ddad655
commit 9e5aee85c8
12 files changed
+202 -67

No files matched your search

+14
View File
@@ -111,3 +111,17 @@ async def test_mobile_inspect_trace_invalid_action():
res = await mobile_inspect_trace(action="invalid_action", trace_id="trace-123")
assert "error" in res
assert "not supported" in res["message"]
@pytest.mark.asyncio
async def test_mcp_server_auto_registers_tools():
"""Verify that importing mcp_server.base auto-registers all mobile tools without manual tools import."""
from mcp_server.base import mcp
tools = await mcp.list_tools()
tool_names = {t.name for t in tools}
assert {
"mobile_run_task",
"mobile_manage_task",
"mobile_get_device_state",
"mobile_inspect_trace",
}.issubset(tool_names)
+6 -1
View File
@@ -90,13 +90,16 @@ def test_cli_mcp_generate_config_antigravity():
def test_cli_mcp_generate_config_all():
"""Verify 'artemis mcp --generate-config all' includes antigravity, cursor, windsurf, and claude."""
"""Verify 'artemis mcp --generate-config all' includes antigravity, cursor, windsurf, claude, vscode, cline, and roo."""
result = runner.invoke(app, ["mcp", "--generate-config", "all"])
assert result.exit_code == 0
assert "antigravity" in result.output
assert "cursor" in result.output
assert "windsurf" in result.output
assert "claude" in result.output
assert "vscode" in result.output
assert "cline" in result.output
assert "roo" in result.output
def test_cli_mcp_install_antigravity(tmp_path, monkeypatch):
@@ -111,6 +114,7 @@ def test_cli_mcp_install_antigravity(tmp_path, monkeypatch):
data = json.loads(jetski_file.read_text())
assert "artemis" in data["mcpServers"]
assert "mobile_run_task" in data["mcpServers"]["artemis"]["tools"]
assert "PYTHONPATH" in data["mcpServers"]["artemis"]["env"]
def test_cli_mcp_install_all(tmp_path, monkeypatch):
@@ -122,5 +126,6 @@ def test_cli_mcp_install_all(tmp_path, monkeypatch):
assert (tmp_path / ".cursor" / "mcp.json").exists()
assert (tmp_path / ".codeium" / "windsurf" / "mcp_config.json").exists()
assert (tmp_path / ".openclaw" / "openclaw.json").exists()
assert (tmp_path / ".claude.json").exists()