Skip to main content

Android-MCP

An MCP server that lets an AI agent operate an Android device over ADB.

It needs only adb. Nothing is installed on the device, and there is no dependency on uiautomator2.

Run

Requires Python 3.13 and adb (Android platform-tools).

uvx --python 3.13 android-mcp

The server speaks MCP on stdio. In a client's config:

{
  "mcpServers": {
    "android-mcp": {
      "command": "uvx",
      "args": ["--python", "3.13", "android-mcp"]
    }
  }
}

From a checkout, use uv run android-mcp instead, or in the config "command": "uv", "args": ["--directory", "/path/to/Android-MCP", "run", "android-mcp"].

The device is connected on the first tool call, so the server starts whether or not one is attached yet.

Choosing the device

With no options it uses the first physical device, or an emulator when there is none.

Option Environment Meaning
--device SERIAL ANDROID_MCP_DEVICE A serial, or host:port for a device on the network
--connection auto|usb|wifi (alias --transport) ANDROID_MCP_CONNECTION How to pick when no device is named
--wifi [HOST] ANDROID_MCP_HOST ADB over Wi-Fi; HOST or HOST:PORT, port 5555 by default
--usb [SERIAL] ADB over USB, optionally a specific serial

Options win over the environment. Other variables:

  • ANDROID_MCP_ADB_PATH names the adb binary. Otherwise adb is looked for on PATH, then in ANDROID_HOME, ANDROID_SDK_ROOT and the default Android Studio SDK folders.
  • SCREENSHOT_QUANTIZED=true reduces screenshots to 256 colours, which makes them smaller.

Tools

Tool Does
ListDevices, ConnectDevice, Device List, choose, or disconnect the device
Snapshot The interactive elements, each with a label and tap coordinates. use_vision adds a screenshot with the labels drawn on it; use_annotation=false leaves it clean
Click, LongClick, Swipe, Drag Touch input by coordinates
ClickBySelector Tap an element found by text, resourceId, className or description (exact match; resourceId may be the part after the slash), with index for the nth match
Type Type into a field. x and y tap it first; clear empties it first. Other scripts and emoji need the optional ADBKeyboard app (below)
Press A button: back, home, recent, volume up, enter, and so on
Notification Pull down the notification shade
Wait, WaitForElement Pause, or wait for an element to appear

Typing other scripts (optional)

Type uses adb shell input text, so on its own it types printable ASCII and the accented Latin letters Android can compose (é ñ ü ÿ and 107 others, not ç ß å ø). A newline presses Enter and a tab presses Tab. For anything else (CJK, Cyrillic, Arabic, emoji, ç), install the ADBKeyboard app on the device once:

adb install keyboardservice-debug.apk

Download it from the releases page. This project does not bundle it: ADBKeyboard is GPL-2.0, and it is only ever talked to over broadcasts. I tested v2.5-dev (SHA-256 41a8a099…46fbbb) on Android 15.

With it installed, text that input text cannot type is sent through it automatically. For about a second the device's keyboard is switched to ADBKeyboard, which shows no keyboard of its own, and then the keyboard that was active before is put back (and ADBKeyboard is disabled again if it was not enabled). A text field must be focused, or the call fails with an error saying so. If a crash ever leaves the device on ADBKeyboard, adb shell ime reset restores the default. Without the app, such text is rejected before anything is sent, with these instructions in the error.

Other limits

  • Busy screens. The element list comes from uiautomator dump, which gives up when the screen never goes idle (a video, a running timer). Snapshot with use_vision then returns the screenshot alone and says so; click by coordinates still works.
  • Drag needs Android 8 or later. Clearing a field uses input keycombination, which needs Android 12; older devices fall back to a slower method that clears up to 200 characters.

Development

uv sync
uv run pytest
uv run ruff check . && uv run ruff format --check .

The tests need no device. Layers, bottom to top: android_mcp.adb (talks to adb), android_mcp.tree (reads the screen), android_mcp.mobile (one connected device: state and actions), android_mcp.server (the MCP tools and the choice of device).

Metadata

Release files for android-mcp 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for android-mcp 0.3.0
File Size Uploaded Provenance Actions
android_mcp-0.3.0.tar.gz 86.5 kB Without provenance Details for android_mcp-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for android-mcp 0.3.0
File Interpreter ABI Platform Actions
android_mcp-0.3.0-py3-none-any.whl Python 3 none any Details for android_mcp-0.3.0-py3-none-any.whl

Total release size: 129.4 kB

Release files / android_mcp-0.3.0.tar.gz

Download URL android_mcp-0.3.0.tar.gz
Size 86.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d0e6236a45feaea81da6475df3a015b9852a337cb9a4c5b1abc2d5bc8e83384d
BLAKE2b-256 checksum
How to use checksums
044b77d5bac15f22b7abacdbca39a32cdfb22aac15127f45d036c7a5d9b89365
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Release files / android_mcp-0.3.0-py3-none-any.whl

Download URL android_mcp-0.3.0-py3-none-any.whl
Size 42.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
28d2da42ebc94fd40e2eb82ee02ccd2034d92696fa3648d181731c7aa4c79ce6
BLAKE2b-256 checksum
How to use checksums
c5f32dda14cc3750a1de3d7e5a7ded92354048c37196e9d75f9d167b2b07166d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Security for android-mcp 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page