π Universal MCP Server for ARTEMIS
This directory contains the universal Model Context Protocol (MCP) server for ARTEMIS, enabling seamless mobile device automation inside AI IDEs and agents like Antigravity, Cursor, Claude Code, OpenClaw, and Windsurf.
ποΈ Architecture
mcp_server/
βββ __init__.py # Package exports (mcp, main)
βββ base.py # Shared FastMCP instance
βββ server.py # Server entrypoint (stdio / sse)
βββ rules.md # AI Agent Testing Mindset & system prompt rules for IDEs
βββ background/ # Background process execution
β βββ task_runner.py # Subprocess runner for Artemis Agent
βββ notifiers/ # Multi-environment notification adapters
β βββ base.py # BaseNotifier abstract class
β βββ agentapi.py # Jetski / Antigravity AgentAPI notifier
β βββ webhook.py # OpenClaw / CI / Discord / Slack webhook notifier
β βββ desktop.py # Native OS toast notifier
β βββ file.py # File audit logger
β βββ composite.py # Multi-channel notification dispatcher
βββ tools/ # Modular standard MCP tools
β βββ task_runner.py # mobile_run_task
β βββ task_manager.py # mobile_manage_task
β βββ device_state.py # mobile_get_device_state
β βββ inspect_trace.py # mobile_inspect_trace
βββ utils/ # Environment, device, and trace utilities
βββ device_utils.py # Cross-platform ADB and emulator resolver
βββ env_utils.py # Python interpreter and process manager
βββ trace_store.py # Traces directory and status manager
π§ AI Agent Behavioral Rules (rules.md)
When connecting ARTEMIS to AI coding assistants like Antigravity, Claude Code, Cursor, or Windsurf, providing the assistant with domain-specific testing discipline is critical for generating reliable test code.
The included rules.md file contains the Mobile Testing Mindset (ARTEMIS Integration) guideline. It teaches the AI agent how to properly collaborate with ARTEMIS:
- The Runnable Code Principle & Active Exploration: Instructs the AI to never guess or hallucinate UI transitions. Instead, it must first explore the live app via ARTEMIS MCP tools (
mobile_run_task, etc.) to discover and verify real-world interaction paths before writing test scripts. - Flash vs. Pro Routing Strategy: Guides the AI to choose Flash for rapid, straightforward UI actions (< 30 steps) and Pro for complex multi-agent planning, polling loops, or video/log diagnosis.
- Latency & Timing Compensation: Clarifies the difference between AI exploratory latency (e.g., model decision intervals) and the deterministic timing requirements of final test code.
- "Dynamic-First, Coordinate-Fallback" Locator Pattern: Teaches the AI to prioritize dynamic UI locators (Resource IDs, OCR text, semantics) for layout resilience, while implementing absolute coordinate fallbacks for maximum execution reliability.
How Global Rules & MCP are Installed
When you run uv run artemis mcp --install all (or target a specific IDE like --install cursor, --install claude, etc.), the installer automatically synchronizes both global MCP server configuration and global testing rules into the corresponding user home directories (without creating project-level rule files in your workspace):
- Antigravity / Jetski: Automatically installs global rules to
~/.gemini/rules/artemis.md. - Cursor: Automatically installs global YAML-frontmatter rule file at
~/.cursor/rules/artemis.mdc. - Claude Code / Desktop: Automatically installs global rules to
~/.claude/rules/artemis.md. - Windsurf: Automatically installs global rules to
~/.codeium/windsurf/rules/artemis.md. - VS Code: Automatically installs global rules to
~/.vscode/rules/artemis.md. - Cline / Roo Code: Automatically installs global rules to
~/.cline/rules/artemis.mdand~/.roo/rules/artemis.md. - OpenClaw: Automatically installs global rules to
~/.openclaw/rules/artemis.md.
(Note: If you prefer manual configuration, you can also copy the contents of rules.md into your IDE's system prompt or global rules settings.)
π οΈ MCP Tools Overview
mobile_run_task: Asynchronously launches an autonomous mobile automation task (FlashorPromodel).mobile_manage_task: Manages task lifecycle (status,stop,inject_instruction).mobile_get_device_state: Real-time observer (screenshotor OCR+XMLhierarchy).mobile_inspect_trace: Granular trace inspection, visual action overlays, and agent reasoning.
π How to Run & Configure
CLI Execution
# Start server over stdio
python -m mcp_server
# Or via Artemis CLI
uv run artemis mcp
IDE Configuration
One-Click Auto Install (Recommended)
Run the automated installer to detect and configure your IDE (Antigravity, Cursor, Claude Code/Desktop, OpenClaw):
uv run artemis mcp --install all
# Or install specifically for Antigravity:
uv run artemis mcp --install antigravity
Manual JSON Config Generation
Run uv run artemis mcp --generate-config antigravity (or all) to output ready-to-use configuration JSON with resolved .venv Python and project paths.