PolarHub
  • Agents
  • MCP Servers
  • Skills
  • PolarBear
PolarHub © 2026
MCP Serversos-automationAndroid-MCP
返回「os-automation」

Android-MCP

modelscope·@HadyAhmed00/Android-MCP

os-automation0下载LocalModelScope

简介

暂无描述。

MCP Server 详情

来自 ModelScope 索引

Android-MCP

Android-MCP is a lightweight, open-source tool that bridges between AI agents and Android devices. Running as an MCP server, it lets LLM agents perform real-world tasks such as app navigation, UI interaction and automated QA testing without relying on traditional computer-vision pipelines or preprogrammed scripts.

Forked and customized by Hady Ahmed

Features

  • Direct Device Control: Click, swipe, drag, type, and press buttons on Android devices
  • UI State Inspection: Get device state with UI hierarchy and optional annotated screenshots
  • MCP Integration: Works with any MCP-compatible client (Claude Desktop, VS Code, etc.)
  • Emulator Support: Works with Android emulators (tested on emulator-5554)
  • Physical Device Support: Connect to real Android devices via ADB
  • Vision Capabilities: Generate annotated screenshots with numbered UI elements for vision-based AI agents

Requirements

  • Python 3.12+
  • Android device or emulator running
  • ADB (Android Debug Bridge) installed and configured
  • uiautomator2 compatible Android device (Android 4.4+)

Installation

From Source

  1. Clone the repository:
git clone https://github.com/HadyAhmed00/Android-MCP.git
cd Android-MCP
  1. Install dependencies:
pip install -e .

Or install manually:

pip install mcp uiautomator2 pillow ipykernel

Quick Start

1. Start the MCP Server

For emulator:

python main.py --emulator

For physical device:

python main.py

The server will connect to your Android device via ADB and start listening for MCP client connections.

2. Configure with MCP Client

To use this with Claude Code or other MCP clients, add the following to your MCP configuration:

Example MCP Config:

{
  "mcpServers": {
    "android-mcp": {
      "command": "python",
      "args": [
        "/path/to/Android-MCP/main.py",
        "--emulator"
      ]
    }
  }
}

Available Tools

The MCP server exposes 9 tools for controlling Android devices:

1. State-Tool

Get the current state of the device including UI hierarchy and optional screenshot.

Parameters:

  • use_vision (bool, optional): Include annotated screenshot with labeled UI elements

Example:

Get device state with screenshot

2. Click-Tool

Click on a specific coordinate on the screen.

Parameters:

  • x (int): X coordinate
  • y (int): Y coordinate

Example:

Click on coordinates 540, 800

3. Long-Click-Tool

Long press (hold) on a specific coordinate.

Parameters:

  • x (int): X coordinate
  • y (int): Y coordinate

Example:

Long click on 540, 800 for 2 seconds

4. Swipe-Tool

Perform a swipe gesture from one point to another.

Parameters:

  • x1 (int): Starting X coordinate
  • y1 (int): Starting Y coordinate
  • x2 (int): Ending X coordinate
  • y2 (int): Ending Y coordinate

Example:

Swipe from top to bottom (refresh)

5. Type-Tool

Type text at a specific coordinate (automatically focuses the field).

Parameters:

  • text (str): Text to type
  • x (int): X coordinate
  • y (int): Y coordinate
  • clear (bool, optional): Clear existing text before typing

Example:

Type "hello world" into the search field

6. Drag-Tool

Drag from one location and drop at another.

Parameters:

  • x1 (int): Starting X coordinate
  • y1 (int): Starting Y coordinate
  • x2 (int): Ending X coordinate
  • y2 (int): Ending Y coordinate

Example:

Drag and drop item from position to trash

7. Press-Tool

Press device buttons (home, back, power, volume, etc.).

Parameters:

  • button (str): Button name (back, home, power, volume_up, volume_down)

Example:

Press the back button

8. Notification-Tool

Open the notification bar to access notifications.

Parameters: None

Example:

Open notification bar

9. Wait-Tool

Wait for a specified duration (useful for allowing apps to load).

Parameters:

  • duration (int): Seconds to wait

Example:

Wait for 2 seconds

Usage Workflow

Basic Example: Navigate and Click

  1. Get device state with vision:

    Get the current state of the device with a screenshot
    

    This returns the UI hierarchy and an annotated screenshot showing numbered UI elements.

  2. Click on an element:

    Click on element 0 (the button that was labeled as 0)
    
  3. Get updated state:

    Get the device state again
    

Example: Form Submission

1. Get device state with vision to see the form
2. Click on the name field (element 2)
3. Type "John Doe"
4. Click on the email field (element 3)
5. Type "john@example.com"
6. Scroll down to find the submit button
7. Click the submit button
8. Wait 2 seconds for the form to process
9. Get device state to confirm submission

Example: App Navigation

1. Get device state to see current screen
2. Click the "Settings" button
3. Wait 1 second for settings to load
4. Get device state to see settings menu
5. Click on "About Phone"
6. Get state to view device information

Architecture

The project is organized into three main modules:

main.py

  • Entry point that creates the FastMCP server
  • Defines and exposes all 9 tools
  • Handles command-line arguments (--emulator)

src/mobile/

  • Mobile class: Manages device connection and state
  • MobileState: Data class representing device state
  • Captures screenshots and processes them

src/tree/

  • Tree class: Parses Android UI XML hierarchy
  • Extracts interactive elements (buttons, inputs, etc.)
  • Generates annotated screenshots with numbered labels
  • Helper utilities for coordinate extraction

Troubleshooting

Device Not Connecting

  1. Check ADB:

    adb devices
    

    Your device should appear in the list.

  2. For emulators:

    ad…
    

相关 MCP Servers(来自「os-automation」)

串口智控

一座通过串行通信将物理硬件设备与人工智能大语言模型连接起来的桥梁,允许用户使用自然语言命令控制硬件。

@mcp2everything/mcp2serial

代码运行器

用于运行代码片段并显示结果的MCP服务器。

@formulahendry/mcp-server-code-runner

Android MCP 控制服务器

一个通过ADB实现对Android设备程序化控制的服务器,提供截图捕获、UI布局分析和包管理等功能,这些功能可以被像Claude Desktop这样的MCP客户端使用。

@minhalvp/android-mcp-server

Claude代码工具

Claude Code作为模型上下文协议(MCP)服务器的一种实现,通过标准的MCP接口启用Claude的软件工程能力(代码生成、编辑、评审和文件操作)。

@auchenberg/claude-code-mcp

Cursor MCP 安装器

用于Cursor IDE的模型上下文协议(MCP)服务器,可简化其他MCP服务器的安装和配置。

@matthewdcage/cursor-mcp-installer

Docker容器管理平台

一个MCP服务器,允许通过自然语言管理Docker容器,使用户能够在不自行运行命令的情况下组合、检查和调试容器。

@ckreiling/mcp-server-docker

自动安装

点击按钮会唤起 PolarBear 客户端,并把当前 MCP Server 的 Markdown 详情文档地址传给客户端。

/api/mcps/hadyahmed00-android-mcp/markdown
打开 PolarBear 安装查看 Markdown 文档

手动安装

在 PolarBear 或其他支持 MCP 的客户端中,新建 MCP Server,并参考下方来源或安装提示配置。

git clone https://github.com/HadyAhmed00/Android-MCP.git cd Android-MCP

基本信息

分类
os-automation / testing-and-qa-tools
运行方式
No
许可证
MIT License
详情文件
hadyahmed00-android-mcp.md