minhalvp/android-mcp-server
Local MCP server for Android UI automation over adb, with element refs for targeting.
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
android-pilot is a local Python MCP server that exposes an Android phone or emulator to an MCP client through adb. The package requires Python 3.11 or later and declares mcp>=2,<3 and Pillow>=10. Its entry point is android-pilot. server.py exposes the tools and holds the reference store; screen.py parses UI Automator XML, renders compact text, and checks element refs; device.py is the only module that executes external commands.
The interaction loop is observe, act, and refresh. A snapshot assigns eN refs to actionable controls. The client passes a ref to a tool instead of turning a visual position into coordinates. Before acting, the server checks that the target still resolves; it rejects a stale or ambiguous target rather than guessing. MCP is the integration boundary: Claude Code, Codex, and OpenCode are named client examples, and no model runs inside the server.
Key Capabilities & Differentiators
The text snapshot reports screen size, static text for context, and actionable elements with roles, labels, and relevant states such as focus, checked, and disabled. Off-screen elements are omitted by default but can be requested with include_offscreen=True; password field text is omitted from snapshots. Clients can tap or long-press, swipe in four directions, type printable ASCII, and send a fixed set of navigation and editing keys. Text entry can focus a field by ref, clear it, or submit it.
When the UI hierarchy does not expose a usable target, screenshot() returns a JPEG scaled to 30% of device resolution, and tap accepts coordinates in screenshot pixels. then_snapshot=true lets a client get the resulting text snapshot in the action response rather than making a separate call. shell(command) provides a separate escape hatch for arbitrary adb shell commands; it is not constrained by element-reference checks.
Trade-offs & Limitations
Against a raw adb wrapper, the text-and-ref layer gives an agent named controls and state instead of making it interpret XML or guess screenshot coordinates. This is most useful when the UI Automator hierarchy exposes useful labels and actionable nodes. Custom-drawn interfaces and poorly labeled controls push the client back to screenshots and coordinates. Ref checks reduce accidental actions but can require extra snapshots on rapidly changing screens or in lists with identical rows. The screenshot scale can obscure fine detail, and built-in text entry is limited to printable ASCII.
Compared with a scripted UI test suite, the server is better suited to exploratory or assisted navigation than to repeatable regression assertions. Its main operational constraint is trust: a connected client can read the screen, send input, and run arbitrary commands with adb shell permissions. Ref validation prevents some wrong-target taps, not unauthorized behavior, and omitting password field text from snapshots does not make other screen data private. Use trusted clients, a known adb binary, and dedicated test devices.
Hardware & Deployment Guide
Install uv and Android Platform-Tools, make adb available to the client process, and connect an emulator or an authorized phone with USB debugging enabled. Register uvx android-pilot as the MCP command, or use claude mcp add android -- uvx android-pilot with Claude Code. Use adb devices to confirm that the target is ready. If multiple devices are attached, the default is the first listed device; specify --device to make the target explicit.
The server can start before adb or the device is ready and retry discovery on a later tool call. An invalid explicit --adb-path or ADB_PATH, by contrast, prevents startup. GUI clients that inherit a different PATH may need an absolute uvx path. A source checkout can be launched with uv --directory /path/to/android-mcp-server run android-pilot; development checks use pytest, Ruff, and ty. The manifest identifies version 0.2.0a3 as alpha, and no GitHub release is listed. Pin the version you validate before adopting it for a shared workflow.
server.py registers MCP tools and stores refs; screen.py parses UI Automator XML and validates refs; device.py is the only module that runs external commands.eN refs to actionable elements. Changed, missing, or ambiguously moved targets require a fresh snapshot rather than a guessed tap.then_snapshot=true, returning the resulting screen state without a separate snapshot call.screenshot() returns a JPEG at 30% of device resolution, and coordinate taps use screenshot pixels.--device selects a specific target.shell(command) runs arbitrary adb shell commands with the Android shell's permissions; the client can also read and operate the UI.Exploratory Android QA, reproducing UI bugs, and checking app or system state on a trusted emulator or dedicated test phone, especially when the UI exposes usable element labels.
You need deterministic regression assertions, built-in non-ASCII text entry, or a least-privilege interface for untrusted clients or sensitive devices.
Quick Start & Installation
git clone https://github.com/minhalvp/android-mcp-server.git cd android-mcp-server uv sync # installs the project and dev tools (pytest, ruff, ty) uv run pytest uv run ruff check . uv run ty check
Comparison vs. Top Coding, Skills & MCP Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| android-mcp-server ★ | 818 | +3 | Python | Apache-2.0 | Local MCP server for Android UI automation over adb, with element refs for targe |
| skills | 204.1k | +2.5k | Python | — | A Claude Agent Skills catalog for packaging and reusing task workflows |
| ui-ux-pro-max-skill | 158.5k | +3.6k | Python | MIT | A search-and-rules skill that gives coding agents a UI design system to build fr |
| graphify | 156.8k | +2.4k | Python | Apache-2.0 | Local AST graphs for dependency tracing, with CLI and MCP access. |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/minhalvp/android-mcp-server.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about android-mcp-server
How does an MCP client select a device and interact with it?
uvx android-pilot as a local MCP command and confirm that adb devices lists an authorized phone or emulator. Start with snapshot, pass the returned element ref to an action, and refresh the snapshot if the server rejects that ref. Set --device explicitly when more than one target is connected.What CPU, memory, or VRAM should I budget for?
Can I self-host it or ship it with a commercial product?
When is this a better fit than raw adb or scripted UI tests?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy