Skip to content

TheDeathDragon/AndroidMCP

Repository files navigation

AndroidMCP

License: Apache 2.0 Release

English | 简体中文

MCP server for Android 11+ devices. C# .NET 8.

Install

PowerShell:

iwr https://raw.githubusercontent.com/TheDeathDragon/AndroidMCP/main/scripts/install.ps1 | iex

Or auto-merge into ~/.claude.json:

& ([scriptblock]::Create((iwr https://raw.githubusercontent.com/TheDeathDragon/AndroidMCP/main/scripts/install.ps1))) -AutoConfig

The installer fetches the latest release, extracts to %LOCALAPPDATA%\Programs\android-mcp\, and prints the Claude Code config (or merges it with -AutoConfig).

After install, /reload-plugins in Claude Code to load the tools.

Requires adb on PATH.

Claude Code config

-AutoConfig writes this for you. Manual:

{
  "mcpServers": {
    "android-mcp": {
      "type": "stdio",
      "command": "C:/Users/<you>/AppData/Local/Programs/android-mcp/android-mcp.exe"
    }
  }
}

Tools

Name Purpose
list_devices enumerate devices visible to adb
screenshot PNG via on-device agent
dump_hierarchy XML / lean JSON view tree
device_info device info
click tap (x, y)
long_press hold (x, y) for duration_ms
swipe swipe with duration
input_text type ASCII into focused field
key_event KEYCODE by name or number
shell arbitrary adb shell (60 s timeout)
push_file host -> device file copy
pull_file device -> host file copy
install_apk push + pm install
list_packages installed packages with metadata
get_package_info single-app summary
launch_app monkey -p <pkg> launcher intent
stop_app am force-stop
clear_app_data pm clear
set_package_enabled pm enable / pm disable-user
get_top_activity foreground component from dumpsys activity
screen_size display W×H from wm size
swipe_direction directional swipe sized to the screen
scroll_to_edge fling to edge
find_element selector → matching nodes
tap_element tap element center
wait_for_element poll hierarchy until match or timeout
scroll_until_visible scroll loop with stability + edge detection
press_home KEYCODE_HOME
press_back KEYCODE_BACK
press_recents KEYCODE_APP_SWITCH
wake_unlock wake screen + wm dismiss-keyguard (no PIN)
clear_recents remove non-home tasks via am stack remove

Every tool except list_devices needs serial. Call list_devices first. If the device may be asleep or on the lockscreen, call wake_unlock once.

Tips

  • Prefer find_element / tap_element over dump_hierarchy + click.
  • dump_hierarchy returns lean JSON by default; pass format=xml for raw.
  • XPath siblings read labeled values: //node[@text='X']/following-sibling::node[1].
  • screenshot is for visual checks, not text extraction.

initialize.result.instructions ships a condensed version of these tips so MCP-aware clients inject them into the model's system prompt.

Run standalone

%LOCALAPPDATA%\Programs\android-mcp\android-mcp.exe                # stdio
%LOCALAPPDATA%\Programs\android-mcp\android-mcp.exe --http 9460    # HTTP + SSE

Flags: --debug, --quiet.

Build from source

git clone --recursive https://github.com/TheDeathDragon/AndroidMCP.git
cd AndroidMCP
agent\build.bat
publish.bat

License

Apache 2.0

About

MCP server for driving Android devices over ADB. C# .NET 8, direct ADB protocol, on-device agent for fast UI ops, multi-device by serial.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors