adb-mcp: Android emulator and device control over adb

io.github.iksnerd由 GitHub 账号 iksnerd 发布v0.24.6更新于 Nov 6, 2026

Drive an Android emulator or device over adb: screenshot, inspect UI, tap, type, build and test.

已验证STDIO仅桌面浏览器自动化开发者工具

概览

AI 生成的概览

通过 adb 操控 Android 模拟器与设备的本地 MCP 服务器:截图、查看界面、点击输入、应用控制、logcat 以及 Gradle 构建与测试。

可以做什么
  • 启动、列出、等待启动和关闭模拟器与设备,通过 Wi-Fi 连接并设置端口转发
  • 截图并读取界面层级,返回真实像素坐标的元素中心与顶层窗口信息
  • 点击、按文字或元素点击、滑动、拖拽、长按、输入文字、发送组合键,并批量执行步骤序列
  • 管理锁屏、生物识别提示、模拟器扩展控制(短信、来电、电量、传感器、旋转)以及应用生命周期、权限、深链和文件推送拉取
  • 读取和流式查看 logcat、清空日志、获取最近一次崩溃并录屏
  • 执行 Gradle 构建、单元与仪器化测试和覆盖率报告,并生成 Android 项目骨架
适用场景
适合需要让助手直接操作真实 Android 模拟器或设备的场景:复现界面问题、走查应用流程、查看截图与日志,或在同一会话中构建和测试 Android 项目。
运行要求
以本地进程通过 stdio 运行,仅支持桌面端(macOS、Linux、Windows)。需要装有 platform-tools(adb)和 emulator 的 Android SDK,通过 ANDROID_HOME 或 ANDROID_SDK_ROOT 定位,或用 --sdk 指定,并至少有一个 AVD。二进制需在 PATH 中或以绝对路径引用;Claude 插件方式还需要 PATH 中有 Node。未声明任何认证或环境变量。
安装前请注意
工具会操作真实设备或模拟器:安装和卸载应用、清除应用数据、修改权限、设置或清除锁屏,以及推送和拉取文件。logcat 输出可能包含令牌和密码,脱敏为可选项。安装脚本和内置更新器会从发布下载中获取并替换二进制文件,请留意其下载内容。

安装

在 SourceWeft 中

  1. 打开 控制台中的 adb-mcp: Android emulator and device control over adb,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[Android robot logo]

adb-mcp

An MCP server that drives Android emulators and devices over adb

[Website] [Release] [CI] [Go] [MCP]


Boot an AVD, screenshot, read the UI hierarchy, tap/swipe/type, set a device lock, read logcat, run Gradle builds and tests. 80 tools, from Claude Code, Cursor, VS Code, or any MCP client over stdio.

It is the Android counterpart to XcodeBuildMCP, built on the official Go MCP SDK.

[An agent driving a real emulator with adb-mcp: describe_ui finds the Chrome icon, tap_on_text taps it, and a screenshot confirms Chrome launched. The emulator screen is shown side by side with the actual tool call and result.]

describe_ui → tap_on_text → screenshot, driven live against a real emulator (emulator-5556), showing the actual tool calls and their actual output.

Android is a trademark of Google LLC. adb-mcp is an independent, unofficial tool built for Android and is not affiliated with, sponsored, or endorsed by Google. The Android robot above is reproduced/modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.

Why

Driving Android by hand means a long runbook of raw adb commands, and it is easy to get wrong (stale tap coordinates, CRLF-corrupted screenshots, forgetting exec-out, guessing coordinates off a downscaled image). This server bakes that knowledge into its tools, so the agent doesn't have to relearn it:

  • Screenshots use exec-out screencap (no CRLF corruption) and are auto-downscaled so the image reader accepts them.
  • describe_ui returns each element's center in true device pixels (so taps land where you mean them to, no guessing off the image) and retries the transient "could not get idle state" failure on its own.

The workflow itself ships as readable resources the agent can pull up mid-task (the observe→act loop, native PIN/lock handling, crash triage, see below) instead of relearning them each session.

Getting started

1. Prerequisites

  • Android SDK with platform-tools (adb) and emulator. The server finds it via $ANDROID_HOME / $ANDROID_SDK_ROOT, else the platform default (~/Library/Android/sdk on macOS). If your MCP client launches the server without those set, pass --sdk /path/to/sdk in the client config's args (the server then exports it, so Gradle finds the SDK too). doctor prints the location it resolved.
  • At least one AVD (create one in Android Studio's Device Manager).

Go is not required: releases ship prebuilt binaries, and it's only needed to build from source.

2. Install

On macOS/Linux:

bash
curl -fsSL https://raw.githubusercontent.com/iksnerd/adb-mcp/main/install.sh | sh

The script (install.sh) picks the right archive for your OS/architecture, verifies its SHA-256 against the release's checksums.txt, and installs to ~/.local/bin (override with BIN_DIR=...; pin a version with VERSION=v0.24.3).

Prefer to grab the binary yourself? Every platform's archive (macOS, Linux, and Windows, amd64 and arm64) is on the Releases page, each with a checksum in checksums.txt. On Windows, download the windows_amd64 or windows_arm64 zip and put adb-mcp.exe somewhere on your PATH.

Once installed, stay current with the built-in updater. It fetches the latest release, verifies its checksum, and swaps the binary in place:

bash
adb-mcp update

The registration below launches the server by the bare name adb-mcp, so it must be on your $PATH (which adb-mcp should resolve; the installer warns if ~/.local/bin isn't on it). Otherwise point the client at the absolute path to the binary instead.

3. Register with your MCP client

Claude Code:

bash
claude mcp add adb -- adb-mcp

(When working inside this repo itself, the bundled .mcp.json is picked up automatically, no registration needed.)

Or install as a plugin, which registers the server and adds a skill per driving guide:

bash
claude plugin marketplace add iksnerd/adb-mcpclaude plugin install adb-mcp@adb-mcp

Register the server one way, not both. claude mcp add and the plugin each register it, under different names (adb and plugin:adb-mcp:adb), so using both gives a session two copies of all the tools and no clear one to call. If you added it with claude mcp add and then install the plugin, remove the first (claude mcp remove adb).

For Codex, the same plugin ships in Codex's manifest shape:

bash
codex plugin marketplace add iksnerd/adb-mcpcodex plugin add adb-mcp@adb-mcp-plugins

The Claude plugin starts the server with node, which downloads the build for your machine from the GitHub release on first run and checks it against a pinned SHA-256, so it needs Node on your PATH but not step 2. The Codex plugin still expects adb-mcp on your PATH from step 2. What the plugin runs and sends is in docs/PRIVACY.md.

Cursor / VS Code: one-click install (assumes adb-mcp is on your PATH from step 2):

[Install in Cursor] [Install in VS Code]

Any other client (Windsurf, Codex, …): run adb-mcp over stdio. The usual config shape:

json
{  "mcpServers": {    "adb": { "command": "adb-mcp" }  }}

To confirm it's wired up, ask your agent to "boot an emulator and take a screenshot".

From source (Go 1.26+)

The module pins toolchain go1.26.10; a Go 1.26 install downloads that patch itself the first time you build.

bash
make install                 # builds ./bin/adb-mcp and copies it to ~/.local/bin# or:go build -o bin/adb-mcp ./cmd/adb-mcp# or straight from the module (note the /cmd/adb-mcp suffix):go install github.com/iksnerd/adb-mcp/cmd/adb-mcp@latest

Tools

80 tools across ten areas. Every device-facing tool takes an optional serial (adb -s). Omit it with one device attached, or pass one from list_devices with several. Full reference: docs/TOOLS.md.

  • Emulator / device: boot, list, wait-for-boot, shut down, connect over Wi-Fi, adb_reverse port forwarding (Metro!)
  • Observe: screenshot to see (works on multi-display foldables, pick a panel with display), describe_ui for true-pixel element centers, with the focused top window (spot a biometric prompt, or the wrong app entirely, occluding your target via optional package), filter/query/compact modes, and a hidden-node count so absence is trustworthy; render_stats counts the real view tree and frame health, which the viewport-scoped describe_ui cannot
  • Interact: tap, tap_on_text/tap_element (id-addressed), swipe, drag, long-press, type, key combos, PIN pads, wait, run_sequence (batch steps + guards in one call, which keeps native-timer flows from being perturbed by per-step round-trips); opt-in verify_change tells you whether a tap/key actually changed the UI; opt-in via_accessibility on tap_on_text/tap_element (EXPERIMENTAL) dispatches a real accessibility click for native views a coordinate tap can't reach, see bridge/README.md
  • Lock / Keystore / Biometrics: set/clear a secure lock screen, check lock state, has_biometric_enrolled + fingerprint_touch/finger_remove to satisfy a BiometricPrompt on the emulator
  • Extended Controls (emulator): send_sms (OTP/2FA), phone_call, set_battery (also works on real devices via dumpsys), cellular (roaming/weak-signal/throttled), set_sensor (accelerometer/light/…), rotate_screen, avd_snapshot, driving the emulator's console-only panel that describe_ui can't see
  • App lifecycle: install/uninstall, launch/stop, get_app_details (version and launcher activity of an installed app, or of a local APK via apk_path with no device), app_state (running pid(s) + Metro-vs-embedded bundle), launch_dev_client (Expo dev build → Metro, skipping the Dev Launcher), reload_app/open_dev_menu, clear data, permissions, deep links, push/pull files
  • Logs & capture: one-shot or streaming logcat (substring/priority/tag filters, since time window, opt-in redact to mask tokens/passwords/API keys before output), clear_logcat, last_crash, screen recording
  • Environment & diagnostics: dark mode, mock location, clean status bar, stay_awake (stop a doze-happy screen blanking your screenshots), doctor
  • Gradle build & test: assembleDebug, unit tests, instrumented tests, JVM unit-test coverage via JaCoCo (get_coverage_report/get_file_coverage), task + variant + module discovery (list_gradle_variants/list_gradle_projects), scaffold_android_project, one-shot build_and_run. Builds return a compact summary (status, error count, first errors, APKs) with the full redacted log on disk, and gradle_build background=true plus build_status keep a multi-minute build from holding the call open
  • Session defaults: pin project_dir/serial once (session_set_defaults) so a multi-module/multi-flavor project or multi-device session doesn't need them repeated on every call

The driving know-how itself ships as six MCP resources (android://guide/*) the client can list and read. See docs/TOOLS.md for the URIs, or jump straight to android://guide/driving for the core loop below.

The core loop

observe → locate → act → re-observe. screenshot to see, describe_ui to get true-pixel centers, tap/tap_on_text/swipe/input_text to act, then screenshot again to confirm. Read android://guide/driving for the full loop and the gotchas that waste turns.

Development

bash
make check     # go vet + go test + doc-count check (unit tests need no emulator)make run       # run over stdio for manual JSON-RPC poking

Layout:

cmd/adb-mcp/main.go        entry: subcommands (update/version) or serve MCP over stdiointernal/tools/            thin MCP tool bindingsinternal/adb/              the device layer: an adb.Client whose methods are the commandsinternal/gradle/           host-side Gradle: builds (summary, log, background jobs), secret redaction, test and coverage reportsinternal/uiauto/           pure uiautomator-hierarchy model + parsing (unit-tested)internal/sdk/              resolves the Android SDK (adb/emulator paths, PATH env)internal/concurrent/       RunAll/RunIndexed: fan out independent I/O calls, join, doneinternal/guides/           the skill guides, embedded and served as MCP resourcesinternal/selfupdate/       the `adb-mcp update` release fetch/verify/swapinternal/bridgeupdate/     the `adb-mcp bridge install` release fetch/verify/install

Dependencies point inward only (tools → adb, gradle, uiauto → sdk), and each internal/tools/<domain>.go adapter mirrors an execution file of the same name (device commands are adb.Client methods). Full map, the package graph, and the rules for adding a tool: ARCHITECTURE.md.

Documentation

Contributing

See CONTRIBUTING.md for setup and conventions. Found a security issue? See SECURITY.md instead of opening a public issue. Licensed under MIT.

来源:README.md,提交 ae844a0

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:该软件包类型无法在沙箱中运行。

版本历史

6
  1. v0.24.6最新Nov 6, 2026
  2. v0.24.5Nov 3, 2026
  3. v0.24.4Nov 1, 2026
  4. v0.24.3Oct 24, 2026
  5. v0.24.1Oct 22, 2026
  6. v0.23.0Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分