NM

nim444/mcp-android-server-python

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

59 stars 12 forks 质量 71 趋势 13MIT

nim444/mcp-android-server-python 是从 https://github.com/nim444/mcp-android-server-python. 导入的一个 MCP 服务器候选

概览

nim444/mcp-android-server-python 是从 https://github.com/nim444/mcp-android-server-python. 导入的一个 MCP 服务器候选

概述(AI 翻译)

该项目提供了一个**MCP(模型上下文协议)**服务器,用于使用uiautomator2自动化Android设备。它设计为可以轻松插入GitHub Copilot Chat、Claude或Open Interpreter等AI代理中,通过自然语言控制Android设备。

模块化建筑

服务器已被重构为一个干净的模块化架构,工具按功能组织:

模块化建筑的优势

  • 可维护性:无需动用主服务器即可轻松添加/修改/移除工具
  • 组织:按功能逻辑分组的工具
  • 测试:单个工具模块可以单独进行单元测试
  • 可重复使用:工具模块可在其他项目中重复使用
  • 可扩展性:新工具类别可作为独立模块添加
  • 代码清洁:主服务器线数从1321行减少到61行

快速演示


要求

  • Python 3.13及更高版本
  • Android 调试桥(adb)已安装并已在 PATH 中
  • 连接并启用USB调试的Android设备
  • 兼容 uiAutomator2 的安卓设备

特色

设备管理

  • 智能设备检测:自动查找并连接可用设备

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Android Agent

This project provides an MCP (Model Context Protocol) server for automating Android devices using uiautomator2. It’s designed to be easily plugged into AI agents like GitHub Copilot Chat, Claude, or Open Interpreter to control Android devices through natural language.

Modular Architecture

The server has been refactored into a clean, modular architecture with tools organized by functionality:

mcp-android-server-python/
├── server.py                    # Main server (61 lines - clean & focused)
├── server_original_backup.py    # Backup of original monolithic version
└── tools/                       # 🆕 Modular tools package
    ├── __init__.py             # Central registration & imports
    ├── device_tools.py         # Device connection & status tools
    ├── app_tools.py            # Application management tools
    ├── screen_tools.py         # Screen control & unlock tools
    ├── input_tools.py          # User input simulation (click, swipe, text)
    ├── inspection_tools.py     # UI inspection & screenshots
    └── advanced_tools.py       # Advanced features (toast, activity wait)

Benefits of Modular Architecture

  • Maintainability: Easy to add/modify/remove tools without touching main server
  • Organization: Tools grouped logically by functionality
  • Testing: Individual tool modules can be unit tested separately
  • Reusability: Tool modules can be reused in other projects
  • Scalability: New tool categories can be added as separate modules
  • Clean Code: Main server reduced from 1321 lines to 61 lines

Quick Demo


Requirements

  • Python 3.13 or higher
  • Android Debug Bridge (adb) installed and in PATH
  • Connected Android device with USB debugging enabled
  • uiautomator2 compatible Android device

Features

Device Management

  • Smart Device Detection: Automatically finds and connects to available devices
  • Comprehensive Device Info: Get serial, resolution, battery, WiFi IP, Android version
  • ADB Diagnostics: Check ADB availability and connection status
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "mcp-android": { "type": "stdio", "command": "bash", "args": [ "-c", "cd /path/to/mcp-adb && source .venv/bin/activate && uv run python server.py" ] } } }