Automate and control Android devices using the UIAutomator2 framework.
基于FastMCP框架实现的UIAutomator2 MCP服务器,提供Android设备自动化控制能力。
Android设备管理
UI自动化操作
应用管理
git clone https://github.com/yourusername/uiautomator2-mcp.git
cd uiautomator2-mcp
pip install -e .
在Claude Desktop的配置目录下创建或编辑mcp.json
文件(通常在~/.cursor/mcp.json
或%APPDATA%\Cursor\mcp.json
):
{
"mcpServers": {
"android": {
"command": "uv",
"args": [
"--directory",
"/path/to/uiautomator2-mcp", // 替换为你的项目路径
"run",
"src/server.py"
]
}
}
}
配置说明:
android
: MCP服务器的唯一标识符command
: 用于运行Python的命令(这里使用uv,也可以使用python)args
: 命令行参数
--directory
: 项目目录路径run
: uv的运行命令src/server.py
: 服务器入口文件路径你可以根据需要调整以下配置:
{
"mcpServers": {
"android": {
"command": "python",
"args": [
"/path/to/uiautomator2-mcp/src/server.py"
]
}
}
}
{
"mcpServers": {
"android": {
"command": "/path/to/venv/bin/python",
"args": [
"/path/to/uiautomator2-mcp/src/server.py"
]
}
}
}
{
"mcpServers": {
"android": {
"command": "python",
"args": [
"/path/to/uiautomator2-mcp/src/server.py"
],
"env": {
"PYTHONPATH": "/path/to/uiautomator2-mcp",
"ANDROID_HOME": "/path/to/android-sdk"
}
}
}
}
你可以在同一配置文件中定义多个MCP服务器:
{
"mcpServers": {
"android": {
"command": "uv",
"args": [
"--directory",
"/path/to/uiautomator2-mcp",
"run",
"src/server.py"
]
},
"android-debug": {
"command": "uv",
"args": [
"--directory",
"/path/to/uiautomator2-mcp",
"run",
"src/server.py",
"--debug"
]
}
}
}
配置完成后,你可以在Claude中直接使用所有可用的工具:
# 初始化UIAutomator2
await mcp.call_tool("mcp_android_init_uiautomator2", {})
# 启动应用
await mcp.call_tool("mcp_android_start_app", {
"package_name": "com.example.app"
})
# 点击元素
await mcp.call_tool("mcp_android_click_element", {
"text": "登录"
})
pip install -e ".[dev]"
pytest
欢迎提交Issue和Pull Request。
MIT License
Provides API documentation from Apifox projects as a data source for AI programming tools that support MCP.
Provides multi-cluster Kubernetes management and operations using MCP, featuring a management interface, logging, and nearly 50 built-in tools covering common DevOps and development scenarios. Supports both standard and CRD resources.
Enhances LLM reasoning by transforming prompts into Chain of Draft or Chain of Thought formats, improving quality and reducing token usage. Requires API keys for external LLM services.
Clojure linter
Client implementation for Mastra, providing seamless integration with MCP-compatible AI models and tools.
MCP Server for PGYER platform, supports uploading, querying apps, etc.
Integrates with the Neo N3 blockchain for wallet management, asset transfers, contract interactions, and blockchain queries.
Enable AI agents to interact with the Atla API for state-of-the-art LLMJ evaluation.
Remote server (SSE/Streamable) for the latest Svelte and SvelteKit documentation
A command-line interface wrapper for the Google Gemini API, enabling interaction with Gemini's Search and Chat tools.