Skip to main content
Glama

android-mcp

CI

English | 简体中文

An MCP (Model Context Protocol) server that lets an AI client operate Android devices over ADB — list devices, inspect the screen, read the UI hierarchy, tap and swipe, type text, manage apps, and pull logs.

The server talks to devices through the standard adb binary from Android platform-tools. It never builds shell strings: every adb invocation is an argument list with a timeout and bounded output, and commands that target a device always carry an explicit serial when more than one device is present.

Requirements

  • Python 3.11+

  • Android platform-tools (adb) on your PATH, or pointed to by the ADB_PATH environment variable

  • A device or emulator with USB debugging enabled

Related MCP server: android-phone-mcp

Install

pip install .

For development:

python -m venv .venv
.venv/bin/pip install -e '.[dev]'

Run

android-mcp            # console script
python -m android_mcp  # equivalent

The server speaks MCP over stdio. Example client configuration (for an MCP client that launches servers as subprocesses):

{
  "mcpServers": {
    "android": {
      "command": "android-mcp",
      "env": { "ADB_PATH": "/path/to/platform-tools/adb" }
    }
  }
}

Tools

Tool

Description

list_devices

Devices visible to adb, with state and model. Returns an empty list plus an error message instead of failing when adb is missing.

get_device_info

Model, manufacturer, Android version, SDK, build id, battery level.

screenshot

Current screen as a PNG image.

dump_ui_tree

UI hierarchy as a compact text tree (class, text, id, bounds, [clickable] and other flags).

tap

Tap at pixel coordinates.

swipe

Swipe between two points with a duration.

press_key

Key by name (HOME, BACK, ENTER, POWER, DPAD_UP, ...) or numeric keycode.

input_text

Type text into the focused field (no newlines).

launch_app

Launch an app by package name.

list_packages

Installed packages, optionally third-party only.

install_apk

Install a local APK (adb install -r).

uninstall_package

Uninstall by package name.

logcat

Last N log lines (1–1000), with optional substring filter.

shell_readonly

One read-only command from a strict allowlist: getprop [name], dumpsys battery, df [path], ps [-A|-e]. Everything else is rejected before it reaches the device.

Most tools accept an optional serial. When exactly one usable device is attached it is selected automatically; with several, the serial is required so commands are never ambiguous.

Safety notes

  • shell_readonly is the only free-form command surface, and it is deliberately tiny: tokens are character-checked (no shell metacharacters) and arguments are constrained per command.

  • Package names for launch/uninstall are validated against the standard package-name grammar.

  • Text input escapes spaces and shell metacharacters for adb shell input text.

  • All adb calls have timeouts (30 s default, longer for installs) and captured output is capped at 4 MiB.

Development

.venv/bin/python -m pytest

The test suite needs no real device: it runs against a fake adb executable (tests/fake_adb.py) that serves canned devices, properties, screenshots, UI dumps, and logs, and it includes an end-to-end test that spawns the server over stdio and calls its tools through a real MCP client.

License

MIT — see LICENSE.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI assistants to interact with Android devices and emulators via ADB, providing tools for screenshots, UI inspection, touch and text input, app management, and device control.
      42
      113 npm
      23
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Enables an AI client to control an Android emulator or USB device over ADB by selecting a device, inspecting the UI hierarchy, and performing taps, swipes, text entry, key presses, and app launches. It relies only on Android platform-tools and exposes a compatible tool surface for phone automation.
      12
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI agents to control Android devices through the Android Debug Bridge, covering device listing, shell commands, app install/uninstall, logcat reading, screenshots, UI automation (tap/swipe/type/key events), dumpsys queries, file transfer, port forwarding, permission management, and Wi-Fi pairing. Failures are mapped to typed, actionable causes and tool calls are safety-annotated and guardrailed, with multi-device calls scoped explicitly by serial.
      35
      47 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to control a real Android device over adb with nothing installed on the phone, exposing tools to list devices, dump the UI as numbered tappable refs, tap, type, swipe, send key events, launch and close apps, read device state, capture screenshots, and wait.
      70 PyPI
      1
      MIT