r/coolgithubprojects • • 1d ago

mobile-agent: a Rust daemon, CLI and MCP server that lets AI agents drive iOS Simulators, iPhones and Android devices, built around performance

https://github.com/gesposito/mobile-agent

I built mobile-agent because agents driving phones spend most of their time waiting: every tap is followed by a fresh read of the device and a sleep "to let it settle".

mobile-agent keeps a live mirror of each attached screen (windows, accessibility tree, latest frame), updated from the platform's change events and frame callbacks, so snapshots, waits and settle checks are answered from the mirror instead of polling the device.

- Android: a single-dex agent pushed over adb runs under `app_process` as the shell user. No APK is installed and no instrumentation runs. On the emulator it uses the gRPC controller when that answers.

- iOS Simulator: everything runs from the host, with no XCTest runner and nothing installed. Input goes through the Simulator's HID service, frames come from the display's IOSurface, and the accessibility tree comes from a small Rust reader.

- Physical iPhones (USB): a Rust XCTest runner serves the tree, and the rest goes over a CoreDevice tunnel opened in-process, without root.

- Interface: the CLI follows agent-browser's grammar (`snapshot`, `click u/e3`, `fill`, `wait`), so agent prompts written for browsers carry over. The MCP server exposes the same tools to Claude Code, Codex, Cursor and others.

Try it with Claude Code:

claude mcp add --transport stdio mobile-agent -- npx -y --package=@mobileagent/cli@alpha mobile-agent-mcp

1 Upvotes

3 comments sorted by

1

u/kantorcodes1 1d ago

Question on the MCP side: snapshot and wait read from the mirror, while click and fill act on a real device. Once an MCP client connects, does it get every tool, or can you hand a client the read tools only and keep click and fill off? A phone is a lot of surface to leave open by default.

1

u/tilt2k 1d ago

mobile-agent-mcp --tools read-only serves only the tools that observe:
- The tools left are devices, status, doctor, snapshot, diff_snapshot, get, wait, screenshot and help.
- tools/list shows only those, and a call to anything else is refused with an error that names the profile.
- The instructions card the server sends a client says it's in read-only mode.

1

u/kantorcodes1 1d ago

That is the split I was asking about. tools/list hiding the action tools entirely is the stronger design: a client that never sees click or fill cannot call them by accident.

I work on HOL Guard, the policy layer that sits in front of MCP servers. Your split maps onto a Guard descriptor without changes: the nine read tools (devices, status, doctor, snapshot, diff_snapshot, get, wait, screenshot, help) stay at inherit, and the tools that act on a real device, click and fill included, sit at review, so a person approves them before they run.

Would you add the descriptor? The file is contributions/mcp-servers/mcp.mobile-agent.json in hashgraph-online/hol-guard. First step: run python scripts/refresh_extension_artifacts.py --trust-only, which creates the trust binding at contracts/extensions/trust/command.mcp-mobile-agent.v1.json, then run the same script with --check-trust and tests/test_guard_mcp_server_contribution.py to verify. mcp.brickproof-adb.json is the closest descriptor already merged, an ADB device-control server with the same read and action split. The guide is here: https://github.com/hashgraph-online/hol-guard/blob/main/docs/guard/mcp-server-contributions.md