android-ui-mcp-server
Automates Android devices via ADB and UIAutomator2, providing tools for shell commands, app installation, screenshots, logcat, port forwarding, Wi-Fi, UI interactions (click, swipe, UI tree, OCR, image matching, clipboard), and WebView automation via Chrome DevTools Protocol.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
android-ui-mcp-server
العربية | Deutsch | English | Español | Français | हिन्दी | 日本語 | 한국어 | Polski | Português | Русский | 中文
Android MCP Server for automating Android devices via ADB and UIAutomator2.
It provides 82 MCP tools in three categories:
Category | Prefix | Count | Description |
ADB |
| 22 | Device communication via ADB (shell, install, screenshot, logcat, port forwarding, WiFi, etc.) |
UI |
| 32 | UI automation via UIAutomator2 (click, swipe, getTree, OCR, image matching, clipboard, etc.) |
Playwright |
| 28 | WebView automation via Chrome DevTools Protocol (click, eval, React tree, scroll, etc.) |
Architecture
100% Rust backend. Each tool is a struct implementing the McpTool trait (see crates/mcp-server/src/tools/mcp_tool.rs), following the convention: one struct = one file, file name = tool name (snake_case), e.g. click.rs → ui_click.
crates/mcp-server/src/tools/
├── mcp_tool.rs # Common trait
├── registry.rs # Central registration of all tools
├── adb/ # 22 ADB tools
├── ui/ # 32 UI tools
└── pw/ # 28 Playwright/WebView toolsThe application is a native Tauri v2 desktop app — a single process that owns all backend state (MCP listener, ADB, emulator cache, scrcpy, diagnostics, tool registry). AI clients spawn a tiny android-mcp-proxy binary that bridges stdio ↔ authenticated localhost TCP to the Tauri host. The React frontend communicates with the backend exclusively via Tauri's native IPC (invoke + Channel<UiEvent>) — no HTTP server, no Socket.IO, no browser WebSocket.
Admin UI and i18n
The web interface (admin panel) lives in ui/src/. It is a React 19 frontend loaded by Tauri's WebView and communicating with the Rust backend via native IPC.
ui/src/
├── App.tsx # Root component — wires hooks and components
├── nativeClient.ts # Single import point for @tauri-apps/api (invoke + Channel)
├── types.ts # Shared types (Snapshot, ActiveSession, SetupPhase, …)
├── i18n/ # Internationalization (12 languages)
│ ├── index.ts # Bundle aggregator, t(), detectLocale()
│ ├── types.ts # Locale, LocaleOption types
│ └── ui/ # UI strings (~300 keys × 12 languages, en = source of truth)
├── hooks/ # React hooks (each state/logic in a separate file)
│ └── useUiEvents.ts # Subscribes to Channel<UiEvent> + gap detection → resync
├── components/ # UI components (one file = one component)
│ └── LivePreviewSection.tsx # Native Channel<Vec<u8>> live preview (no WebSocket)
└── utils/ # Pure helper functions (no React dependency)Tauri Desktop App
The admin panel runs in a Tauri v2 desktop app. The Tauri app IS the backend — it starts the MCP TCP listener, owns all shared state (AppRuntime), and serves the React frontend via Tauri's native WebView. AI clients spawn android-mcp-proxy (a tiny stdio ↔ TCP bridge) which connects to the Tauri app's MCP listener via authenticated localhost TCP. See ARCHITECTURE.md for details.
Related MCP server: Karagöz
Installation
macOS (Homebrew)
brew tap b2bc-devkit/tap
brew install b2bc-devkit/tap/android-ui-mcp-server
brew services start android-ui-mcp-server # optional: auto-start at loginThe formula installs the tray app android-ui-mcp-server and the MCP bridge
android-mcp-proxy as bare universal binaries — there is no .app bundle.
Distribution deliberately avoids casks: Homebrew propagates macOS quarantine
attributes onto cask-installed executables, which made unsigned binaries hang
when spawned directly (including android-mcp-proxy launched by AI clients).
Formula-installed binaries are not quarantined. Migrating from the retired
cask? Run brew uninstall --cask android-ui-mcp-server first, then install
the formula as above.
Windows (Scoop)
scoop bucket add b2bc https://github.com/b2bc-devkit/scoop-bucket
scoop install android-ui-mcp-serverThe package installs android-ui-mcp-server.exe and android-mcp-proxy.exe
side by side and creates a Start Menu shortcut for the tray app. It requires
the WebView2 Runtime, which is preinstalled on Windows 11 and most
up-to-date Windows 10 systems.
Persistent UiAutomator2 server
For every connected device the backend keeps a persistent appium-uiautomator2-server (v10.6.6) alive under instrumentation. ui_* tools (UI tree, tap/swipe actions, screenshots) are served by it whenever it is running and transparently fall back to plain adb shell commands otherwise.
Both server APKs are downloaded once from GitHub Releases into
~/.android-mcp-server/, verified against pinned SHA-256 digests (as is the scrcpy server jar), and installed only when missing or outdated.Per-device state (
stopped / installing / starting / running / error / disabled), server version and local forward port are shown in the admin UI — in the Connected Devices header widgets (alongside the ADB and scrcpy widgets) and in each session's details.The feature can be toggled at runtime (global switch / per-device restart in the widget popover) or disabled at startup via
ANDROID_MCP_DISABLE_UIAUTOMATOR_SERVER=1.
Live Preview (scrcpy)
The admin UI can mirror a device screen with the scrcpy v3.1 protocol: the server JAR is pushed per session and streams H.264 (up to 768 px / 30 fps / 4 Mbps) over an ADB reverse tunnel, decoded in the frontend with WebCodecs (@yume-chan/scrcpy-decoder-webcodecs). Touch input is injected back over the scrcpy control socket. Per-device streaming state is reported in the scrcpy widget of the Connected Devices header.
Build
All build and quality gates are wired through Wireit (Google's incremental build orchestrator) with content-hash caching — re-running npm run build skips any step whose inputs haven't changed.
npm run verify # FULL verification (Wireit-cached):
# quality gates (build) + release builds (rust, tauri)
npm run build # quality gates only:
# vite build (UI) + lint:check + trivy:scan
# + cargo:fmt + cargo:clippy + cargo:deny + cargo:machete
npm run build:ui # only build the admin UI bundle (vite)
npm run build:rust # cargo build --release -p mcp-server -p android-mcp-proxy (domain lib + proxy)
npm run build:tauri # cargo build --release -p android-ui-mcp-server-app (Tauri app)
npm start # build + run Tauri app in release modeRust quality, profiling and analysis gates
npm run setup:rust-tools # cross-platform bootstrap — installs all tools below
# (cargo-deny, cargo-machete, cargo-dylint, dylint-link,
# cargo-flamegraph, samply, nightly toolchains for dylint/miri)
# Blocking gates (run by `npm run build` via Wireit):
npm run cargo:fmt # cargo fmt --check (formatting)
npm run cargo:clippy # cargo clippy --workspace --all-targets -- -D warnings
npm run cargo:deny # cargo deny check (advisories, bans, licenses, sources)
npm run cargo:machete # cargo machete (unused dependencies)
# Nightly-only gates (separate rust-analysis.yml CI workflow):
npm run cargo:dylint # company custom lints (nightly-2026-04-16)
npm run cargo:miri # memory-safety / UB detection (nightly)
npm run cargo:nightly # both: cargo:dylint + cargo:miri (Wireit-cached)
# Benchmarks (on demand):
npm run bench # criterion CPU benchmarks
npm run bench:callgrind # gungraun (Callgrind) instruction-count benchmarks
# Profiling (on demand):
npm run profile:flamegraph # CPU flamegraph
npm run profile:samply # CPU sampling profiler
npm run profile:dhat # heap profiling (feature dhat-heap)Tests
cargo test -p mcp-server # Rust unit tests
npm run test:e2e # build:rust (Wireit) + Playwright e2e tests
# (UI specs attach to the app's WebView2 over CDP;
# the harness sets ANDROID_MCP_E2E_CDP_PORT so the
# window is created with --remote-debugging-port)
cargo run -p mcp-server --example uia2_live
# live UiAutomator2 end-to-end verification on a
# connected device/emulator (serial as first arg)See AGENTS.md for details.
Security (Trivy CVE scan)
The project uses @b2bc-devkit/trivy-scan to run
Aqua Security's Trivy vulnerability scanner.
trivy-scan downloads the official Trivy binary for your OS/CPU on first use, verifies its SHA-256
checksum, and caches it in your user cache directory. No manual installation is required.
npm run trivy:scan # HIGH/CRITICAL scan (table output); configured via trivy.yamlIn CI (.github/workflows/ci.yml), the test job runs the full Wireit build including trivy:scan as a
blocking gate, plus cargo fmt --check, cargo clippy, cargo deny check, cargo machete, and cargo test.
A separate security-reports job generates JSON + HTML reports as artifacts.
Libraries & tooling
The project is built on a modern, CPU-conscious toolchain. Key libraries and tools:
Tool | Version | Role |
stable | Backend (82 MCP tools, Tauri host, proxy, scrcpy, OCR) | |
7.x | Frontend UI only (React 19 + Ant Design 6) | |
8.x | Admin UI bundler | |
1.83 | Lint (replaces ESLint, Rust-based, | |
0.14.x | Caching build orchestrator (wires all | |
— | HIGH/CRITICAL CVE scan ( | |
2.x | Desktop shell for the admin dashboard (replaces Electron) | |
0.20.x | Dependency / license / security audit (Wireit gate) | |
0.9.x | Unused dependency detection (Wireit gate) | |
6.x | Custom company lints ( | |
— | Memory-safety / UB detection for | |
0.5.x | CPU benchmarks + regression detection | |
0.19.x | Instruction-count benchmarks (deterministic, no noise) | |
0.6.x | CPU profiling (flamegraph visualization) | |
0.13.x | CPU sampling profiler | |
0.3.x | Heap profiling + allocation site analysis |
Startup WiFi setup
The interactive WiFi setup wizard is available in the admin dashboard UI (Tauri app).
Pairing and connection are performed through the wizard UI — no environment variables required.
See WIFI_CONFIGURATION.md for details.
Device selection (serial)
Tools that execute commands on a device support an optional serial field.
Behavior
if you provide
serial→ the command targets the specified device,if you omit
serialand there is exactly 1device→ the server selects it automatically,if you omit
serialand there is more than 1device→ the server returns a clear error with a list of serials and an example.
Example error:
Multiple connected Android devices detected (...). Provide 'serial' in tool input. Example: { "serial": "192.168.1.190:37395" }
adb_run_as_shell
Runs a command in the application's UID context via run-as.
Parameters
packageName(required) — e.g.com.mpartedcommand(required) — shell command executed underrun-asserial(optional) — target device
Usage example
{
"packageName": "com.mparted",
"serial": "192.168.1.190:37395",
"command": "/data/user/0/com.mparted/files/tools/arm64-v8a/bin/blkid --help >/data/local/tmp/mp_runas_blkid.out 2>&1; echo EXIT:$?; tail -n 40 /data/local/tmp/mp_runas_blkid.out"
}run-as requirements
the app must be installed,
the app must support
run-as(debuggable),the command is executed via
sh -c(supports redirections,;,|, etc.).
WebView and Playwright/React tools (pw_*)
The Playwright/React tools for WebView operate on an active CDP connection.
Connection handling
if there is no active connection and exactly 1 WebView is detected → the connection is established automatically,
if more than 1 WebView is detected → you must specify
packageName(works in allpw_*tools, e.g.pw_getReactTree,pw_click) or manually useui_webviewwith theconnectcommand,if no WebView is detected → make sure the WebView screen is visible and
webContentsDebuggingEnabled=true.
Parallel pw_* invocations
pw_*requests are serialized per controller session to avoid RPC races on parallel calls (e.g.pw_eval+pw_getReactTree).
Smoke scenario (WebView + pw_*)
The following sequence lets you quickly verify that the CDP channel and pw_* tools work correctly.
List available WebViews
{
"command": "list"
}(Optional) explicit connect when multiple WebViews are present
{
"command": "connect",
"packageName": "com.example.app"
}Simple JS test in the WebView
{
"expression": "document.title",
"packageName": "com.example.app"
}React tree test
{
"maxDepth": 4,
"packageName": "com.example.app"
}Note: pw_getReactTree now has a fast preflight. When the current WebView has no React hook (__REACT_DEVTOOLS_GLOBAL_HOOK__), the tool immediately returns an empty structure and a warning instead of waiting for the full RPC timeout.
Expected result:
no
Not connected to any WebViewerror,a correct response for
pw_eval,a returned tree (or a controlled message if the screen is not a React app).
On a failed connect, the response now includes:
errorwith the specific reason (Reason: ...),details(includingpackageName,socketName, a diagnostic hint).
Tool documentation
Detailed documentation for each tool (parameters, examples) is embedded directly in the binary at compile time (include_dir! / include_str! in src-tauri/src/embedded.rs). The source files live in docs/tools/ and are available in 12 languages:
docs/tools/en/— English (source of truth, fallback)docs/tools/ar/— Arabicdocs/tools/de/— Germandocs/tools/es/— Spanishdocs/tools/fr/— Frenchdocs/tools/hi/— Hindidocs/tools/ja/— Japanesedocs/tools/ko/— Koreandocs/tools/pl/— Polishdocs/tools/pt/— Portuguesedocs/tools/ru/— Russiandocs/tools/zh/— Chinese
When a localized doc is unavailable, the tool falls back to English automatically.
CI
.github/workflows/ci.yml runs on push/PR to main:
testjob —ubuntu-latest+macos-latestmatrix:npm ci,npm run build(Wireit quality gates including trivy-scan),cargo fmt --check,cargo clippy,cargo deny check,cargo machete,cargo test --workspace,npm run test:unit:runtest-windowsjob —windows-2025-vs2026: same gates as abovesecurity-reportsjob —ubuntu-latest: generates Trivy JSON + HTML reports as artifacts
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Cloud Android devices for AI agents: install an APK, read the screen, tap, type, read logcat.
Give your AI agent a real cloud Android phone: push APKs, drive it, get screenshots and logs.
Let Claude, ChatGPT and other agents use your Android phone: see the screen, tap, type, open apps.
Let AI agents control Android and iOS devices on Mobilerun Cloud: screen, input, apps, workflows.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to fully control Android devices through over 30 tools for app management, UI automation, and vision-based analysis via ADB. It supports multi-device management, action recording, and smart execution strategies ranging from UI hierarchy parsing to coordinate-based interaction.371MIT
- AlicenseAqualityBmaintenanceEnables AI agents to automate Android and iOS devices, including emulators and physical devices, by capturing screenshots, reading UI accessibility trees, performing touch and text input, and managing app lifecycle and logs.184MIT
- AlicenseCqualityCmaintenanceEnables an AI agent to see and control Android devices, including x86_64 emulators and redroid, through 68 tools covering gestures, typing, apps, notifications, files, browser control, and more.681MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to visually perceive and directly control Android devices via ADB and screen-control tooling, including screenshots, taps, swipes, typing, app management, UI inspection, file transfer, shell commands, and audio/video streaming.1,154 npmMIT