Skip to main content
Glama

Android MCP Server

🤖 An MCP (Model Context Protocol) server designed for Android development, enabling AI assistants to directly control Android devices for screenshots, UI analysis, app management, and more.

中文文档


Table of Contents


Related MCP server: scrcpy-mcp

Introduction

This project is built on the FastMCP framework and communicates with Android devices via ADB (Android Debug Bridge). It exposes 19 practical tools to AI assistants (such as Claude, CodeBuddy, etc.), covering the complete Android development and debugging workflow:

Screenshot → UI Analysis → Interaction → Logcat → App Management → File Transfer

Prerequisites

  • Python >= 3.11

  • uv package manager

  • ADB installed and added to PATH (adb --version works)

  • Android device connected or emulator running (adb devices recognizes it)

  • USB Debugging enabled on the Android device


Installation

# Clone the project
git clone https://github.com/huarangmeng/AndroidMcpServer
cd AndroidMcpServer

# Install dependencies
uv sync

Dependencies

Package

Version

Purpose

mcp[cli]

>= 1.2.0

MCP framework

Pillow

>= 10.3.0

Screenshot processing


Configuration

CodeBuddy

Add the following to ~/.codebuddy/mcp.json:

{
  "mcpServers": {
    "android_mcp": {
      "command": "/Users/<your-username>/.local/bin/uv",
      "args": [
        "run",
        "--project", "/path/to/AndroidMcpServer",
        "python",
        "/path/to/AndroidMcpServer/main.py",
        "--mode", "stdio",
        "--temp-dir", "/tmp/android_mcp"
      ],
      "transportType": "stdio"
    }
  }
}

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "android_mcp": {
      "command": "uv",
      "args": [
        "run",
        "--project", "/path/to/AndroidMcpServer",
        "python",
        "/path/to/AndroidMcpServer/main.py",
        "--mode", "stdio",
        "--temp-dir", "/tmp/android_mcp"
      ]
    }
  }
}

HTTP Mode

# Start HTTP server
uv run main.py --mode streamable-http --temp-dir /tmp/android_mcp --port 3001

# Service URL: http://localhost:3001/mcp

Tools

A total of 19 tools in 5 categories:

📸 Screenshot & UI Analysis

Tool

Description

get_screenshot

Capture device screenshot (auto-scaled to 50%)

get_ui_dump

Get XML UI hierarchy with attribute filtering

🖱️ Interaction

Tool

Parameters

Description

tap_screen

x, y

Tap at coordinates

swipe_screen

x1,y1,x2,y2,duration_ms

Swipe gesture

long_press

x, y, duration_ms

Long press

send_text

text_to_send

Send text to focused input (English only)

perform_system_action

action

System keys: BACK / HOME / RECENT_APPS

📱 App Management

Tool

Parameters

Description

launch_app

package_name

Launch app

force_stop_app

package_name

Force stop app

clear_app_data

package_name

Clear app data

install_apk

apk_path, replace_existing

Install APK

get_app_list

include_system_apps

List installed apps

grant_permission

package_name, permission

Grant runtime permission

🔍 Debugging & Diagnostics

Tool

Parameters

Description

get_logcat_output

app_package, log_level

Get last 100 logcat lines

get_device_info

—

Get device model, OS version, etc.

get_current_activity

—

Get current foreground Activity

get_memory_info

package_name

View app memory usage

📂 File Operations

Tool

Parameters

Description

pull_file

device_path, local_path

Pull file from device

push_file

local_path, device_path

Push file to device


Debugging

Use MCP Inspector for local debugging:

# Install MCP Inspector
npm install -g @modelcontextprotocol/inspector

# Start with config file
npx @modelcontextprotocol/inspector --config mcp-inspector-config.json --server android-stdio

Or start manually:

# stdio mode
uv run main.py --mode stdio --temp-dir /tmp/android_mcp

# HTTP mode
uv run main.py --mode streamable-http --temp-dir /tmp/android_mcp --port 3001

References

Available Tools

19 tools
clear_app_dataA

清除指定应用的所有数据和缓存(相当于「清除数据」操作)。

Inputs: package_name (required). Returns: result

force_stop_appB

强制停止指定包名的 Android 应用。

Inputs: package_name (required). Returns: result

get_app_listB

列出设备上已安装的应用包名列表。

Inputs: include_system_apps. Returns: result

get_current_activityA

获取当前前台运行的 Activity 名称,用于定位当前所在页面。

Inputs: no named parameters. Returns: result

get_device_infoA

获取已连接 Android 设备的基本信息,包括型号、系统版本、分辨率、序列号等。返回 JSON 格式字符串。

Inputs: no named parameters. Returns: result

get_logcat_outputB

从已连接的 Android 设备获取最近 100 行日志。

Inputs: app_package (required), log_level. Returns: result

get_memory_infoB

获取指定应用的内存占用信息(PSS、RSS 等)。

Inputs: package_name (required). Returns: result

get_screenshotA

获取已连接 Android 设备的屏幕截图。 用于检查界面视觉效果;若需识别元素,优先使用 get_ui_dump。

Inputs: no named parameters.

get_ui_dumpA

获取 XML 格式的 UI 视图层级,用于理解屏幕结构和定位元素。

Inputs: returned_attributes (required). Returns: result

grant_permissionC

为指定应用授予运行时权限。

Inputs: permission (required), package_name (required). Returns: result

install_apkB

将本地 APK 文件安装到已连接的 Android 设备。

Inputs: apk_path (required), replace_existing. Returns: result

launch_appB

启动指定包名的 Android 应用(使用 monkey 命令)。

Inputs: package_name (required). Returns: result

long_pressB

在屏幕指定坐标执行长按操作(通过零距离滑动模拟)。

Inputs: x (required), y (required), duration_ms. Returns: result

perform_system_actionB

执行系统级操作,如返回、回到主页或打开最近任务列表。

Inputs: action (required). Returns: result

pull_fileC

从 Android 设备拉取文件到本地。

Inputs: local_path (required), device_path (required). Returns: result

push_fileC

将本地文件推送到 Android 设备。

Inputs: local_path (required), device_path (required). Returns: result

send_textA

模拟键盘向当前焦点输入框发送文本。注意:不支持中文,中文请使用其他输入法方案。

Inputs: text_to_send (required). Returns: result

swipe_screenC

在屏幕上执行滑动操作,从起点滑动到终点。

Inputs: x1 (required), x2 (required), y1 (required), y2 (required), +1 more. Returns: result

tap_screenA

在屏幕指定坐标执行点击操作。坐标应从 get_ui_dump 的 bounds 属性动态获取。

Inputs: x (required), y (required). Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 19 tools

    Disambiguation5/5

    Each tool targets a distinct device operation with clear boundaries: gestures (tap/long_press/swipe), file transfer (push/pull), app lifecycle (launch/force_stop/clear_data/install), and info gathering (device/memory/logcat/activity) do not overlap. The descriptions even disambiguate similar tools like get_ui_dump vs get_screenshot, directing agents to the right one.

    Naming Consistency5/5

    All names are snake_case and verb-first, following a predictable verb_noun pattern (get_device_info, push_file, launch_app, clear_app_data). Minor variation like long_press/tap_screen still fits the scheme cleanly.

    Tool Count4/5

    19 tools is slightly above the ideal 3-15 band but each earns its place in a device-automation surface. The set is cohesive rather than padded, so it's a minor overage rather than a scope mismatch.

    Completeness4/5

    Strong coverage of input, app lifecycle, file transfer, permissions, and introspection for Android automation. Minor gaps exist (no uninstall/revoke_permission, no element-text convenience, no waiting/rotation), but core workflows are fully supported.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      C
      maintenance
      A MCP server that enables AI assistants to control Android devices via ADB, supporting device info, screen control, input simulation, app management, shell execution, file transfer, and UI parsing.
      20
      -
    • A
      license
      A
      quality
      C
      maintenance
      MCP server that gives AI agents full vision and control over Android devices via ADB and scrcpy. Supports screenshots, input, apps, UI automation, shell, files, and clipboard.
      38
      392 npm
      136
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      An MCP server that provides tools for controlling Android devices using uiautomator2, enabling AI to automate tasks like tapping, swiping, and managing apps.
      186 PyPI
      55
      Apache 2.0
    • A
      license
      B
      quality
      D
      maintenance
      An MCP server that allows AI agents to drive real Android devices via adb, capturing screenshots, reading the live UI tree, and performing actions like tap, swipe, and type.
      13
      5 npm
      1
      Apache 2.0