Skip to main content
Glama

adbmcp — Android Debug Bridge, as MCP tools

CI npm license

adbmcp is a Model Context Protocol server that exposes the Android Debug Bridge (adb) to AI agents: list devices, run shell commands, install apps, read logcat, take screenshots, drive the UI (tap/swipe/type/key events), query system services with dumpsys, transfer files, forward ports, manage app permissions and pair/connect to devices over Wi-Fi. It is a thin, predictable wrapper around the official adb binary — no re-implemented adb protocol, no test framework, no extra state.

  • Multi-device first — every device-scoped tool takes an optional device serial and every adb call is scoped with adb -s <serial>; ambiguity is an error listing the candidates.

  • Failures an agent can act on — adb stderr/exit codes are mapped to typed causes (NO_DEVICE, MULTIPLE_DEVICES, DEVICE_UNAUTHORIZED, DEVICE_OFFLINE, ADB_SERVER_CONFLICT, TIMEOUT, COMMAND_FAILED) with a hint for the next step.

  • Safety by construction — full MCP annotations on every tool plus server-side guardrails that are enforced even if a host ignores annotations.

  • stdio by default, Streamable HTTP optional — the client launches adbmcp as a subprocess; --http serves the same tools over /mcp for shared-device-host deployments.

Implements the MVP plus v2.0 items 1–7 in docs/design/product-design-v0.md.

Install

Requires Node.js >= 20 and Android platform-tools (adb) on PATH — or ADB_PATH pointing at the binary.

# from npm
npx -y @yhuangsh/adbmcp

# from a checkout
git clone https://github.com/yhuangsh/adbmcp.git && cd adbmcp
npm install
npm run build
node dist/index.js        # speaks MCP on stdin/stdout

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "adb": {
      "command": "npx",
      "args": ["-y", "adbmcp"],
      "env": {
        "ADB_PATH": "/Users/me/Library/Android/sdk/platform-tools/adb"
      }
    }
  }
}

Cursor (.cursor/mcp.json)

{
  "mcpServers": {
    "adb": {
      "command": "node",
      "args": ["/absolute/path/to/adbmcp/dist/index.js"],
      "env": {
        "ADBMCP_ALLOWED_DEVICES": "emulator-5554"
      }
    }
  }
}

Other stdio clients work the same way: a command plus args, with ADB_PATH / ADBMCP_* environment variables passed through. In stdio mode, stdout carries MCP protocol traffic only; diagnostics go to stderr.

Streamable HTTP (shared device host)

Use HTTP when several agents or MCP clients should share one machine's adb server, devices and allowlist — an emulator farm, a lab phone, or a remote desktop — instead of each client launching its own subprocess. stdio stays the default: with no flags, adbmcp speaks MCP on stdin/stdout.

node dist/index.js --http                                    # http://127.0.0.1:3331/mcp
ADBMCP_HTTP_TOKEN=secret node dist/index.js --http --host 0.0.0.0 --port 8080

Flag / variable

Default

Meaning

--http

off

Enable the Streamable HTTP transport. Without it the server is stdio-only.

--port, ADBMCP_HTTP_PORT

3331

Listen port (--port wins over the env var). 0 asks the OS for an ephemeral port; the real URL is logged to stderr.

--host, ADBMCP_HTTP_HOST

127.0.0.1

Bind address (--host wins over the env var).

ADBMCP_HTTP_TOKEN

unset

When set, every /mcp request must send Authorization: Bearer <token>. Unset is allowed only on a loopback host.

ADBMCP_HTTP_ALLOWED_HOSTS

derived

Comma-separated exact Host header values (host[:port]) for DNS-rebinding protection. Overrides the derived loopback/bound-host list.

The endpoint is stateful: initialize creates a session, Mcp-Session-Id identifies it, and DELETE /mcp closes it. All sessions share one device host, one ADBMCP_ALLOWED_DEVICES allowlist and one logcat stream registry — streams started in one session can be read from another. Sessions are the same trust domain, not isolation between agents.

Client config (Claude Desktop, Cursor, or any Streamable HTTP client):

{
  "mcpServers": {
    "adb": {
      "type": "http",
      "url": "http://localhost:3331/mcp"
    }
  }
}

When ADBMCP_HTTP_TOKEN is set, add "headers": { "Authorization": "Bearer <token>" } to the server entry (client support for header config varies).

Security notes:

  • Loopback by default. Binding a non-loopback host without ADBMCP_HTTP_TOKEN is refused at startup; the error explains the two ways forward (set a token, or bind 127.0.0.1).

  • Token auth is pre-MCP. With a token configured, missing/incorrect credentials get 401 before any MCP session handling; comparison is constant-time (node:crypto timingSafeEqual).

  • DNS-rebinding protection. The SDK transport rejects requests whose Host header is not the bound host or a loopback alias (localhost, 127.0.0.1, ::1) on the actual port. Override with ADBMCP_HTTP_ALLOWED_HOSTS when a reverse proxy forwards a different hostname.

  • One device host, many agents. shell is available to every session; on a shared host prefer ADBMCP_ALLOWED_DEVICES and ADBMCP_SHELL_ALLOWED_PREFIXES, and put the server behind the token.

  • No in-process TLS. The server speaks plain HTTP; terminate TLS in a reverse proxy for non-loopback deployments and set ADBMCP_HTTP_ALLOWED_HOSTS to the forwarded Host value.

  • Only /mcp is served; POST bodies are capped at 1 MiB (413 above that), unsupported methods get 405, and unknown paths get 404.

Deploying over a VPN mesh (Tailscale example)

A common topology: your agent runs on a public server, and one or more device hosts (machines with USB-attached phones) are joined to a private mesh such as a Tailscale tailnet. Nothing needs to be exposed to the public internet — the agent reaches device hosts through the mesh.

Shape A — bind the mesh interface directly. On each device host, set the token, bind to the mesh IP (or 0.0.0.0), and allow the hostname the agent will dial:

ADBMCP_HTTP_TOKEN=<token> ADBMCP_HTTP_ALLOWED_HOSTS='phonehost.tailnet-name.ts.net:3331,127.0.0.1:3331,localhost:3331' \
  adbmcp --http --host 0.0.0.0 --port 3331

WireGuard encrypts mesh traffic; the bearer token stays as the application-level gate so a misconfigured ACL or a compromised mesh member still cannot touch your devices. ALLOWED_HOSTS must contain the exact Host header the agent sends — MagicDNS name and port. Note the override replaces the derived loopback defaults, so loopback entries are re-added for local health checks.

Shape B — loopback + tailscale serve (nice for always-on hosts). Keep adbmcp bound to 127.0.0.1 (optionally with a token still set), then let Tailscale expose it:

adbmcp --http --host 127.0.0.1 --port 3331 &
tailscale serve --bg --https=443 http://127.0.0.1:3331   # --https=443 is the default mode

Keep the token set even in this shape — tailscale serve terminates TLS and limits reachability to the tailnet, but adbmcp should still authenticate its clients. Point the agent at https://phonehost.tailnet-name.ts.net/mcp (tailscale serve passes the original Host header through, so the portless ADBMCP_HTTP_ALLOWED_HOSTS entry is correct here).

Caveats that apply to both shapes: one adbmcp node per device host (the agent configures one MCP server entry per host — there is no cross-host device registry); sessions live until the client deletes them or the process restarts, so a device host that suspends or redeploys drops its logcat streams and agents must re-initialize; and provision the token to the agent out-of-band (secret manager, not chat).

Related MCP server: scrcpy-mcp

Tools

device is optional on every device-scoped tool and required when more than one device is connected. Annotation columns: RO = readOnlyHint, D = destructiveHint, I = idempotentHint, O = openWorldHint.

Tool

What it does

RO

D

I

O

list_devices

adb devices -l: serial, state, model, allowlist status

✅

—

✅

—

get_device_info

Curated build properties (model, Android version, SDK, ABI) + screen size/density

✅

—

✅

—

dumpsys_query

Curated dumpsys dump — battery/activity/window/connectivity, capped at 64 KB

✅

—

✅

—

shell

Arbitrary adb shell command — the power-user escape hatch, guardrailed

—

—

—

✅

list_packages

pm list packages, optional substring filter

✅

—

✅

—

install_apk

adb install a host APK, replace for -r

—

—

—

—

uninstall_package

adb uninstall — destructive, keep_data for -k

—

✅

✅

—

grant_permission

pm grant — destructive: grants a runtime permission

—

✅

✅

—

revoke_permission

pm revoke — destructive: the app loses the permission

—

✅

✅

—

clear_app_data

pm clear — destructive, refused unless the package is in ADBMCP_CLEAR_ALLOWED_PACKAGES

—

✅

✅

—

logcat_snapshot

Bounded adb logcat -d, optionally filtered

✅

—

✅

—

start_logcat_stream

Start a long-lived adb logcat, returns a stream_id

✅

—

—

—

read_logcat_stream

Drain buffered output since the last read

✅

—

—

—

stop_logcat_stream

Stop the stream, return unread output

✅

—

✅

—

screenshot

exec-out screencap -p, returned as PNG image content

✅

—

✅

—

pull_file

adb pull to the host; refuses to overwrite unless overwrite: true

—

—

—

—

push_file

adb push; remote path restricted to allowed roots

—

—

—

✅

forward_port

adb forward (e.g. tcp:8080 → tcp:8080)

—

—

✅

—

remove_forward

adb forward --remove

—

—

✅

—

reverse_port

adb reverse — the device listens on remote and forwards to host local

—

—

✅

—

remove_reverse

adb reverse --remove (takes the remote spec)

—

—

✅

—

list_forwards

adb forward --list as JSON {serial, local, remote}

✅

—

✅

—

list_reverses

adb reverse --list as JSON {serial, remote, local}

✅

—

✅

—

discover_wireless

adb mdns services as JSON {name, type, address, port} — find pairing/connect candidates without knowing host:port

✅

—

✅

✅

connect

adb connect host:port — TCP/IP wireless without pairing

—

—

✅

✅

disconnect

adb disconnect [host:port]; no address disconnects every TCP/IP device

—

—

✅

✅

wireless_pair

adb pair host:pair_port code — Android 11+ pairing, step one of connect; code may be omitted on 2026-07-28 clients with elicitation (the server asks, see Pairing-code elicitation)

—

—

✅

✅

reconnect_wireless

adb connect for every ADBMCP_WIRELESS_TARGETS entry — per-target {address, label, status, cause, detail} JSON

—

—

✅

✅

start_activity

am start by component or action, wait for -W

—

—

—

—

launch_package

Resolve a package's LAUNCHER activity, then am start -n; returns the component, wait for -W

—

—

—

—

force_stop_app

am force-stop

—

—

✅

—

get_ui_hierarchy

uiautomator dump XML with bounds/ids/text; to_file dumps to /data/local/tmp and returns {path, bytes} for pull_file

✅

—

✅

—

tap

input tap x y — tap a screen coordinate (device pixels)

—

—

—

—

swipe

input swipe x1 y1 x2 y2 [duration_ms] — scroll or drag

—

—

—

—

type_text

input text with %s space encoding and device-shell quoting; non-ASCII (e.g. CJK) goes through the ADB_INPUT_B64 broadcast when a capable IME (ADB Keyboard) is active — see Non-ASCII text input

—

—

—

—

key_event

input keyevent — named key (HOME, BACK, …) or keycode 0–300

—

—

—

—

adb_server_restart

kill-server + start-server recovery for version conflicts

—

—

—

—

Also shipped:

  • Resource adb://devices — live device list as JSON (serial, state, model, allowed). State is never cached; re-read the resource to refresh.

  • Prompts — debug_crash, install_and_launch, capture_bug_report: step-by-step orchestrations of the tools above.

uninstall_package, grant_permission, revoke_permission and clear_app_data are the tools with destructiveHint: true; shell, push_file, discover_wireless, connect, disconnect, wireless_pair and reconnect_wireless are the openWorldHint: true tools. They are never merged with read-only tools, so hosts can auto-approve reads and confirm writes.

Wireless discovery

Wireless-debugging targets do not have to be known in advance: discover_wireless runs adb mdns services and returns the _adb-tls-pairing._tcp / _adb-tls-connect._tcp services the device advertises as a JSON array of {name, type, address, port} candidates, so an agent can go discover → pair → connect without asking the user for a host:port:

  • Pairing candidates (type containing adb-tls-pairing) feed wireless_pair: host = address, pair_port = port. The six-digit code still has to come from the device's "Pair device with pairing code" dialog, and the pairing advertisement only exists while that dialog is open — call discover_wireless again after opening it.

  • Connect candidates (type containing adb-tls-connect) feed connect: address = "address:port". IPv6 addresses are reported as-is, but connect only accepts hostname/IPv4.

  • Entries with port: null are announced but unresolved — retry discover_wireless shortly; advertisements are periodic.

Typed failures instead of raw adb output: [MDNS_UNAVAILABLE] means the adb build predates mDNS or its mDNS backend is disabled (upgrade platform-tools, make sure the adb server is running, or fall back to the host:port shown in the device's Wireless debugging settings); [MDNS_NO_SERVICES] means discovery worked but nothing was advertised (enable Wireless debugging in Settings > Developer options, keep both machines on the same LAN, retry a few seconds later). Discovery can be disabled with ADBMCP_MDNS_ENABLED=false and its service-type filter narrowed with ADBMCP_MDNS_SERVICE_TYPES (see the table below).

Pairing-code elicitation (MRTR)

On the 2026-07-28 protocol revision, wireless_pair can be called without the six-digit pairing code: the server answers with an input_required result whose embedded elicitation/create request asks for the code, the client prompts the user (or its host does) and retries the original call carrying the code in inputResponses — the multi-round-trip flow (MRTR, SEP-2322). The elicited code is validated exactly like a code argument (six digits, optional hyphen) before any adb pair runs, and a declined or cancelled prompt surfaces as a normal tool error.

Clients on the 2025-era revision — or 2026-07-28 clients that did not declare the elicitation capability — keep the code-as-argument behavior: omit code there and wireless_pair fails with an actionable error instead of prompting. Pairing codes still expire after a couple of minutes either way, so retry with a fresh code from the device's "Pair device with pairing code" dialog when pairing fails.

Persistent wireless targets

Wireless devices can be declared once in ADBMCP_WIRELESS_TARGETS (label=host:port or host:port, comma-separated) and re-established whenever the connection drops — a Wi-Fi blip, a device reboot, an adb or host restart:

  • On demand: reconnect_wireless runs adb connect for every declared target and reports per-target {address, label, status, cause, detail} as JSON — connected (including "already connected") or failed with the typed adb failure cause (e.g. COMMAND_FAILED, DEVICE_OFFLINE).

  • On first use: when a declared target is missing, any device-scoped call retries it once before failing — resolution runs one bounded reconnect pass (only the requested declared target when an explicit device serial matches one, all of them for implicit resolution) and re-lists. If the device is still gone, the NO_DEVICE error says the targets were already retried once.

There is deliberately no background reconnect loop: adbmcp stays request-scoped and spawn-per-call, so reconnection happens inside a request (the tool call or the failing resolution), never from a timer or daemon. Pairing is not automatic — declare targets only for devices that are already paired; new devices still need wireless_pair (with discover_wireless to find them).

Non-ASCII text input

Android's input text is ASCII-only: typing non-ASCII text (e.g. CJK) through it crashes on the device with a NullPointerException instead of typing anything (issue #3). type_text therefore has two paths:

  • ASCII text (default and unchanged) is sent as input text with %s space encoding and device-shell quoting — one round trip, no extra device calls.

  • Non-ASCII text is sent as am broadcast -a ADB_INPUT_B64 --es msg <base64-utf8> to the active input method. This requires a broadcast-capable IME to be the active IME; the reference implementation is ADB Keyboard (com.android.adbkeyboard/.AdbIME). On every non-ASCII call adbmcp queries settings get secure default_input_method (never cached) and broadcasts only when the active IME matches a configured capable component.

One-time setup, run from your own shell (adbmcp detects the IME but deliberately never installs or switches IMEs on its own):

adb install ADBKeyboard.apk                      # from the ADBKeyBoard releases
adb shell ime enable com.android.adbkeyboard/.AdbIME
adb shell ime set com.android.adbkeyboard/.AdbIME   # must be the ACTIVE input method

Failure modes, both typed and actionable instead of leaking the device-side NPE:

  • [IME_UNAVAILABLE] — the text is non-ASCII but the active IME is not broadcast-capable (or no IME is selected). The message names the active IME and the hint gives the ime enable / ime set commands above.

  • [TEXT_NOT_ASCII] — ADBMCP_TYPE_TEXT_NON_ASCII=reject opts out of the broadcast path, so non-ASCII text is refused before any device call.

IMEs other than ADB Keyboard can be declared broadcast-capable with ADBMCP_IME_BROADCAST_COMPONENTS (see the table below); both the short pkg/.Class form and the flattened pkg/pkg.Class form match.

Configuration

Variable

Default

Meaning

ADB_PATH

adb (from PATH)

Path to the adb binary. Must match the version of any running adb server.

ADBMCP_ALLOWED_DEVICES

unset (all allowed)

Comma-separated serial allowlist. Operations on other serials are refused.

ADBMCP_SHELL_BLOCKED_PATTERNS

reboot, su, mkfs, wipe, rm of / (split/reordered flags and /* included), pipelines into sh/bash

Comma-separated JavaScript regex sources tested against the whole shell command. Overriding replaces the defaults.

ADBMCP_SHELL_ALLOWED_PREFIXES

unset (no prefix restriction)

When set, a shell command must start with one of these comma-separated prefixes.

ADBMCP_PUSH_ALLOWED_ROOTS

/sdcard, /storage/emulated/0, /data/local/tmp

Remote roots push_file may write to.

ADBMCP_CLEAR_ALLOWED_PACKAGES

unset (refuse every clear)

Comma-separated package allowlist for clear_app_data. There is no allow-all mode: unset or empty refuses every clear.

ADBMCP_TYPE_TEXT_NON_ASCII

ime

How type_text handles non-ASCII text (see Non-ASCII text input): ime sends the ADB_INPUT_B64 broadcast when a capable IME is active, reject fails with [TEXT_NOT_ASCII].

ADBMCP_IME_BROADCAST_COMPONENTS

com.android.adbkeyboard/.AdbIME

Comma-separated IME component ids accepted as broadcast-capable for the ADB_INPUT_B64 path. pkg/.Class and flattened pkg/pkg.Class forms both match.

ADBMCP_MDNS_ENABLED

true

Whether discover_wireless may run adb mdns services. When false, discovery is refused with [mdns.disabled].

ADBMCP_MDNS_SERVICE_TYPES

_adb-tls-pairing._tcp, _adb-tls-connect._tcp

Comma-separated service types discover_wireless keeps (trailing dot optional). Overriding replaces the defaults.

ADBMCP_WIRELESS_TARGETS

unset

Comma-separated wireless devices adbmcp re-establishes on demand (reconnect_wireless) and retries once on a failed first use. Entries are label=host:port or host:port, e.g. pixel=192.168.1.42:5555.

ADBMCP_TIMEOUT_MS

30000

Default subprocess timeout (timeout_ms per call overrides it).

ADBMCP_MAX_OUTPUT_BYTES

65536

Head+tail byte cap per call; the dropped middle is reported inline.

ADBMCP_LOGCAT_BUFFER_BYTES

1048576

Ring-buffer cap per logcat stream; overflow is reported as dropped_bytes.

ADBMCP_HTTP_PORT

3331

HTTP mode listen port (equivalent to --port; the flag wins).

ADBMCP_HTTP_HOST

127.0.0.1

HTTP mode bind address (equivalent to --host; the flag wins).

ADBMCP_HTTP_TOKEN

unset

Bearer token required on every /mcp request when set. Non-loopback binds without it are refused.

ADBMCP_HTTP_ALLOWED_HOSTS

derived

Comma-separated exact Host header values accepted by DNS-rebinding protection.

Safety notes

  • Annotations are advisory, guardrails are authoritative. The host decides what to auto-approve; adbmcp enforces its own limits regardless: blocked shell patterns, the device allowlist, remote push roots, and the pull overwrite check.

  • shell is arbitrary code execution on the device. It is annotated as not read-only and open-world, blocklisted by default, and documented as the escape hatch — keep shell disabled or prefix-restricted (ADBMCP_SHELL_ALLOWED_PREFIXES) on shared or CI machines. The default blocklist covers reboot/power-state changes, su, mkfs, wipe, rm of / (including split/reordered flags and the /* glob), and pipelines into sh/bash such as curl … | sh or … | sudo bash. This is a guardrail, not a sandbox: a deliberately obfuscated command can still get through. A pattern-based guardrail: matching runs on the raw command text, including inside quotes, so even prose like echo "use curl | sh to install" is refused — precision always yields to safety here. maintainer can replace the patterns with ADBMCP_SHELL_BLOCKED_PATTERNS.

  • uninstall_package deletes app data unless keep_data: true. clear_app_data deletes app data permanently and is refused unless the package is listed in ADBMCP_CLEAR_ALLOWED_PACKAGES (unset/empty refuses every clear). grant_permission / revoke_permission change an app's granted permissions. All four are marked destructiveHint: true.

  • Device scoping is explicit. With multiple devices connected, calls without device fail with MULTIPLE_DEVICES and the candidate serials instead of guessing.

  • Filesystem writes are bounded. pull_file never overwrites silently; push_file refuses writes outside the allowed remote roots and rejects .. traversal and relative paths. Root containment is lexical: it does not resolve on-device symlinks, so a link pre-created inside an allowed root (e.g. /data/local/tmp/x -> /data/system) can still redirect a push outside it.

  • No privilege escalation. adbmcp never runs adb root/su itself and never retries a permission failure with elevation.

  • The adb server is shared host state. adbmcp never kills or restarts it implicitly; adb_server_restart exists for the version-conflict case and says so in its description.

  • Logcat streams are cleaned up. Streams are killed on stop_logcat_stream, and all remaining streams are terminated on SIGINT/SIGTERM (server shutdown).

Development

npm install
npm run build      # tsc -> dist/
npm test           # vitest, no adb binary or device required
npm run typecheck

Tests drive a fake adb runner and a fake stream spawner, so the whole suite runs without platform-tools, a device or an emulator. Layout:

src/
  index.ts            entrypoint: stdio by default, --http for Streamable HTTP
  http.ts             HTTP sessions, bearer auth, loopback guard, DNS-rebinding allowlist
  server.ts           assembles config + runner + tools/resources/prompts
  config.ts           env config, shell/device/push/clear guardrails
  devices.ts          device parsing, resolution rule, list_devices tool
  adb/runner.ts       subprocess per call: -s scoping, timeouts, head+tail caps
  adb/errors.ts       typed causes mapped from adb stderr/exit codes
  streams/registry.ts long-running logcat handles + ring buffer
  tools/              one module per tool group (37 tools, MVP + v2.0 items 1–6 + v0.6.0 additions)
  resources/devices.ts, prompts/index.ts
test/                 vitest suites (fakes in test/helpers/)

Status

Implements the MVP plus v2.0 items 1–7 from the design (§4.2): reverse port forwards and structured forward/reverse listings, pm grant/revoke plus allowlist-gated clear_app_data, wireless TCP/IP connect/disconnect/wireless_pair, first-class input injection (tap, swipe, type_text, key_event — typed schemas that fix the input text quoting footgun, no DSL), the curated dumpsys_query, and the pulled-forward Streamable HTTP transport. v0.4.0 was a hardening/polish release (no new tools): shell guardrails now also block pipe-to-shell payloads and split/globbed root-deleting rm, address-targeted disconnect failures are reported as typed errors, and reverse_port rejects forward-only device-side specs pre-spawn. v0.5.0 adds Streamable HTTP (/mcp, stateful sessions, one shared device/stream context, optional bearer auth, loopback binding guard, DNS-rebinding protection). v0.6.0 adds launch_package (resolve a package's launcher activity and start it, returning the component) and get_ui_hierarchy to_file (keep large dumps on-device as {path, bytes} for pull_file instead of returning structurally truncated inline XML). v0.6.1 teaches type_text non-ASCII (CJK) input: text rides the ADB_INPUT_B64 broadcast to a capable IME (ADB Keyboard by default) when one is the active input method, with typed IME_UNAVAILABLE/TEXT_NOT_ASCII errors otherwise (ADBMCP_TYPE_TEXT_NON_ASCII chooses the posture). v0.7.0 moves onto the MCP TypeScript SDK v2 packages and serves both protocol revisions: legacy clients keep stateful Streamable HTTP sessions while 2026-07-28 clients get stateless serving (server/discover, resultType, per-request _meta), same guardrails on both paths. v0.8.0 rounds out wireless debugging: discover_wireless finds pairing/connect candidates via mDNS (adb mdns services), wireless_pair accepts MRTR elicitation on 2026-07-28 clients (omit code and answer the server's input_required prompt), and ADBMCP_WIRELESS_TARGETS with reconnect_wireless re-establishes declared wireless devices after drops or restarts. Not implemented: screenrecord, bugreport, iOS, emulator lifecycle management. Windows is best-effort (POSIX-first, like most of the ecosystem).

Contributing

Bug reports and use-case-driven feature requests are welcome — see CONTRIBUTING.md for what makes a good issue, how triage works, and the development setup.

Available Tools

35 tools
adb_server_restartRestart the adb serverA

Recover from adb server version conflicts by running adb kill-server followed by adb start-server, then report the device list. Affects the shared adb server on this host (Android Studio and other tools use it too), so call it only when adb reports a server/version problem or a device is stuck.

Inputs: no named parameters.

clear_app_dataClear app dataA
DestructiveIdempotent

Delete all data stored by an app (pm clear <package>). Destructive and allowlist-gated: the server refuses unless the package is listed in ADBMCP_CLEAR_ALLOWED_PACKAGES (comma-separated); an unset or empty value refuses every clear.

Inputs: package (required), device.

connectConnect to a device over TCP/IPA
Idempotent

Connect adb to a device over TCP/IP (adb connect <host>:<port>), e.g. "192.168.1.42:5555"; a successful connect adds the device to list_devices. Not device-scoped: the address selects the device, and no serial exists until the connection is established. IPv6 literals (e.g. "[::1]:5555") and a bare host without :port are not accepted; specify host:port explicitly. On Android 10+ enable Wireless debugging on the device first; on Android 11+ that also needs a one-time pairing first — call wireless_pair with the code from the Wireless debugging screen, then connect to the port shown there (the pairing port and this connect port are different).

Inputs: address (required).

disconnectDisconnect TCP/IP devicesA
Idempotent

Disconnect one TCP/IP-connected device (adb disconnect <host>:<port>) or, when address is omitted, every TCP/IP-connected device (adb disconnect). USB connections are unaffected. Not device-scoped: for a TCP/IP device the address itself is the serial.

Inputs: address.

dumpsys_queryQuery a dumpsys serviceA
Read-onlyIdempotent

Read a curated Android system service dump (dumpsys <service> [args...]): "battery" for charge/level, "activity" for tasks and activities, "window" for windows and display state, "connectivity" for network state. Output can be huge — "activity" especially — so it is capped (64 KB maximum) with a head+tail truncation marker where bytes were dropped; pass extra_args to narrow it (e.g. "activities" or "windows"). Other dumpsys services are intentionally not exposed; use shell for those.

Inputs: service (required), device, extra_args, timeout_ms.

force_stop_appForce-stop an appA
Idempotent

Stop all processes of a package on one device (am force-stop). Idempotent; safe to call when the app is not running.

Inputs: package (required), device.

forward_portForward a host port to the deviceA
Idempotent

Create a port forward from the host to the device (adb forward), e.g. local "tcp:8080" to remote "tcp:8080". Use it to reach a device-side server (app HTTP server, debug port) from host-only test tooling.

Inputs: local (required), remote (required), device, no_rebind.

get_device_infoGet device informationA
Read-onlyIdempotent

Read a curated set of build properties (model, Android version, SDK level, ABI) plus screen size and density for one device. Use it instead of shell getprop when you only need identity/build details.

Inputs: device.

get_ui_hierarchyGet the UI hierarchyA
Read-onlyIdempotent

Dump the current view hierarchy of one device as uiautomator XML (uiautomator dump), including bounds, resource ids, text and clickability. Use it to find stable selectors before driving the UI through shell (input tap/text). With to_file: true the XML is kept on the device at /data/local/tmp/adbmcp-ui-.xml and returned as {path, bytes} instead of inline text, so large dumps stay structurally valid; retrieve it with pull_file. Dumps accumulate at that prefix by design — remove them with the shell tool (rm ) after pulling.

Inputs: device, to_file, timeout_ms.

grant_permissionGrant a runtime permissionA
DestructiveIdempotent

Grant a runtime permission to an app (pm grant <package> <permission>). Destructive: it changes the permissions the app holds; revoke_permission reverses it. Only changeable runtime permissions work; on stock Android these can be granted to non-debuggable apps too, though some restricted permissions still reject the shell.

Inputs: package (required), permission (required), device.

install_apkInstall an APKA

Install a local APK on one device via adb install. Fails with INSTALL_FAILED_* details from the device when the package cannot be installed.

Inputs: apk_path (required), device, replace, timeout_ms.

key_eventSend a key eventA

Send one key event to the device (input keyevent <code>). Pass a named key (HOME, BACK, ENTER, DEL, MENU, POWER, VOLUME_UP, VOLUME_DOWN, TAB, ESCAPE, APP_SWITCH, WAKEUP, SLEEP) or a raw Android keycode 0-300. Use WAKEUP (or POWER) before driving a screen that may be off, and BACK/HOME to navigate.

Inputs: key (required), device.

launch_packageLaunch an app by package idA

Launch an installed app by package id: resolve its LAUNCHER activity (cmd package resolve-activity --brief) and start it (am start -n, with -W when wait is true). Returns the resolved component so later calls can use start_activity without re-resolving. The monkey -p <package> 1 one-liner exists, but this keeps everyday launches off the shell escape hatch.

Inputs: package (required), wait, device, timeout_ms.

list_devicesList connected Android devicesA
Read-onlyIdempotent

List Android devices and emulators known to adb with their serial, connection state and model. Call this first to discover serials for the "device" parameter of other tools.

Inputs: no named parameters.

list_forwardsList port forwardsA
Read-onlyIdempotent

List the forward socket connections of one device (adb forward --list) as a JSON array of {serial, local, remote} objects (empty array when there are none).

Inputs: device.

list_packagesList installed packagesA
Read-onlyIdempotent

List package names installed on one device (optionally filtered by a substring of the package name), e.g. filter "com.example" to find only the app you care about.

Inputs: device, filter.

list_reversesList reverse port forwardsA
Read-onlyIdempotent

List the reverse socket connections of one device (adb reverse --list) as a JSON array of {serial, remote, local} objects (empty array when there are none). remote is the device-side listen spec, local the host-side target.

Inputs: device.

logcat_snapshotRead a logcat snapshotA
Read-onlyIdempotent

Dump the current logcat buffer (adb logcat -d) from one device, optionally filtered to a log tag. Bounded output; use the stream tools when you need to watch logs over time.

Inputs: device, max_lines, timeout_ms, filter_spec.

pull_filePull a file from the deviceA

Copy a file from the device to the host machine (adb pull). Refuses to overwrite an existing host file unless overwrite is true. This writes to the host filesystem, so it is not a read-only tool.

Inputs: local_path (required), remote_path (required), device, overwrite.

push_filePush a file to the deviceA

Copy a file from the host machine to the device (adb push). For safety the remote path must be inside the configured allowed roots (default /sdcard, /storage/emulated/0, /data/local/tmp).

Inputs: local_path (required), remote_path (required), device.

read_logcat_streamRead a logcat streamA
Read-only

Return buffered logcat output accumulated since the previous read of this stream. Output is capped per call; anything not returned stays buffered for the next read. Dropped bytes are reported when the ring buffer overflowed.

Inputs: stream_id (required), max_bytes.

remove_forwardRemove a port forwardA
Idempotent

Remove a port forward created with forward_port (adb forward --remove <local>).

Inputs: local (required), device.

remove_reverseRemove a reverse port forwardA
Idempotent

Remove a reverse socket connection created with reverse_port (adb reverse --remove <remote>).

Inputs: remote (required), device.

reverse_portReverse a device port to the hostA
Idempotent

Create a reverse socket connection (adb reverse): the device listens on the remote spec and connections are forwarded to the local spec on the host machine. Use it to let device-side code (app under test, on-device scripts) reach a server running on your machine.

Inputs: local (required), remote (required), device, no_rebind.

revoke_permissionRevoke a runtime permissionA
DestructiveIdempotent

Revoke a runtime permission from an app (pm revoke <package> <permission>). Destructive: the app loses the permission immediately and may fail until it is granted again.

Inputs: package (required), permission (required), device.

screenshotCapture a screenshotA
Read-onlyIdempotent

Capture the current screen of one device (exec-out screencap -p) and return it as a PNG image. Follow up with get_ui_hierarchy when you need element coordinates instead of pixels.

Inputs: device.

shellRun a device shell commandA

Escape hatch: run an arbitrary command through adb shell on one device and return stdout/stderr. Powerful but not read-only — destructive commands are refused by default (reboot, su, mkfs, wipe, rm of / including split/reordered flags and the /* glob, and pipelines into sh/bash such as curl … | sh or … | sudo bash). This is a guardrail, not a sandbox: a deliberately obfuscated command can still get through. Prefer the dedicated tools (list_packages, install_apk, get_ui_hierarchy, …) when they cover the job. A non-zero remote exit code is reported as exit_code: N in the output. If the call times out, only the host-side adb client is killed; the command keeps running on the device (inherent to adb).

Inputs: command (required), device, timeout_ms.

start_activityStart an activityA

Launch an activity on one device (am start) either by component ("com.example/.MainActivity") or by intent action ("android.intent.action.VIEW" with optional data/extras). Use wait: true to block until the activity is reported as displayed.

Inputs: data, wait, action, device, +5 more.

start_logcat_streamStart a logcat streamA
Read-only

Start a long-lived adb logcat process on one device and return a stream_id. Poll it with read_logcat_stream and release it with stop_logcat_stream. Streams are killed when the server shuts down.

Inputs: device, filter_spec.

stop_logcat_streamStop a logcat streamA
Read-onlyIdempotent

Terminate a logcat stream and forget its stream_id. Up to max_bytes of output buffered but not yet read is returned in this result; any excess is discarded and reported.

Inputs: stream_id (required), max_bytes.

swipeSwipe the screenA

Swipe from (x1, y1) to (x2, y2) (input swipe X1 Y1 X2 Y2 [duration_ms]), e.g. to scroll a list or dismiss a card. duration_ms is the gesture time in milliseconds (device default 300 when omitted); a longer duration drags more slowly. Coordinates are device pixels; screenshot afterwards to verify the result.

Inputs: x1 (required), x2 (required), y1 (required), y2 (required), +2 more.

tapTap the screenA

Tap a point on the device screen (input tap X Y). Coordinates are device pixels: read them from get_ui_hierarchy bounds or get_device_info screen_size, and screenshot after the tap to verify the result (screenshot → decide → act loop). If the display is off, wake it first with key_event WAKEUP — input events are dropped while the screen is off.

Inputs: x (required), y (required), device.

type_textType textA

Type text into the focused input field (input text <text>). Spaces are encoded as %s (adb's space form) and shell metacharacters are quoted, so the text reaches the device intact; note that a literal "%s" in text still becomes a space on the device. Focus the field first (tap it), and screenshot to confirm what was typed.

Inputs: text (required), device.

uninstall_packageUninstall a packageA
DestructiveIdempotent

Remove an application from one device via adb uninstall. Destructive: the app is deleted from the device (use keep_data to keep its data directory).

Inputs: package (required), device, keep_data, timeout_ms.

wireless_pairPair a device for wireless debuggingA
Idempotent

Pair with an Android 11+ device for wireless debugging (adb pair <host>:<pair_port> <code>), using the pairing code from Settings > Developer options > Wireless debugging > "Pair device with pairing code". This is step one of a two-step flow: after "Successfully paired", call connect with the same host and the port shown on the main Wireless debugging screen — the temporary pairing port above is not that connect port. Pairing codes expire after a couple of minutes, so ask the user for a fresh code if this fails.

Inputs: code (required), host (required), pair_port (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 35 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes, and the forward/reverse and logcat streaming tool groups are well differentiated by their descriptions. Minor ambiguity exists between start_activity and launch_package, and shell intentionally overlaps with many dedicated tools, but the descriptions explicitly guide correct selection.

    Naming Consistency4/5

    All names use snake_case, and most follow a verb_noun pattern (list_devices, install_apk, grant_permission, pull_file). A few deviate with noun-first or single-word names (logcat_snapshot, dumpsys_query, screenshot, shell), but the convention remains readable and consistent.

    Tool Count3/5

    35 tools is heavy for a single server. Each tool maps to a distinct adb operation, which justifies breadth, but some groups could be consolidated (e.g., forward/reverse families, logcat stream lifecycle), making the set borderline overloaded.

    Completeness4/5

    The surface covers device connection, app lifecycle, file transfer, logging, UI automation, shell, and dumpsys querying well. Minor gaps exist around device reboot, system settings, and screen recording, but most workflows can be completed with the available tools.

    Maintenance

    ActivityMaintained
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to control, inspect, and automate Android devices, Waydroid containers, and AVD emulators over ADB. Provides tools for screenshots, UI-hierarchy text-based tapping, gestures, key presses, text input, app management, and raw shell commands.
      12
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables 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.
      801 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to see and control Android devices through ADB and screen mirroring, supporting screen capture, touch input, app management, UI element finding, file transfer, shell commands, clipboard access, and audio/video streaming.
      801 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to drive a connected Android phone over ADB with 28 tools covering screenshots and UI inspection, taps/swipes/typing, app install and launch, file transfer, wireless pairing, and one-call scripted flows like tap-by-text and wait-for-text.
      MIT