UIAutomator2 MCP 服务器 logo

UIAutomator2 MCP 服务器

Community
GitDzreal93

Android automator mcp

PublisherGitDzreal93
Repositoryuiautomator2-mcp
LanguagePython
Forks
5
Stars
20
Available tools
0
Transport typestdio
Categories
Links
  • Connect tools to AI workflows

    UIAutomator2 MCP 服务器 exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    20 stars and 5 forks from the linked repository.

UIAutomator2 MCP Server

基于FastMCP框架实现的UIAutomator2 MCP服务器,提供Android设备自动化控制能力。

功能特性

  • Android设备管理

    • ADB命令执行
    • 应用包管理
    • 屏幕截图
  • UI自动化操作

    • 元素点击
    • 文本输入
    • 屏幕滑动
    • 元素等待
    • 页面滚动
  • 应用管理

    • 应用启动/停止
    • 当前应用信息
    • UIAutomator2服务管理

环境要求

  • Python 3.10+
  • ADB工具
  • Android设备或模拟器

安装

  1. 克隆项目
bash
git clone https://github.com/yourusername/uiautomator2-mcp.git
cd uiautomator2-mcp
  1. 安装依赖
bash
pip install -e .

MCP配置

1. 配置mcp.json

在Claude Desktop的配置目录下创建或编辑mcp.json文件(通常在~/.cursor/mcp.json或%APPDATA%\Cursor\mcp.json):

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: 服务器入口文件路径

2. 配置选项

你可以根据需要调整以下配置:

  1. 使用Python直接运行:
json
{
  "mcpServers": {
    "android": {
      "command": "python",
      "args": [
        "/path/to/uiautomator2-mcp/src/server.py"
      ]
    }
  }
}
  1. 使用虚拟环境:
json
{
  "mcpServers": {
    "android": {
      "command": "/path/to/venv/bin/python",
      "args": [
        "/path/to/uiautomator2-mcp/src/server.py"
      ]
    }
  }
}
  1. 添加环境变量:
json
{
  "mcpServers": {
    "android": {
      "command": "python",
      "args": [
        "/path/to/uiautomator2-mcp/src/server.py"
      ],
      "env": {
        "PYTHONPATH": "/path/to/uiautomator2-mcp",
        "ANDROID_HOME": "/path/to/android-sdk"
      }
    }
  }
}

3. 多服务器配置

你可以在同一配置文件中定义多个MCP服务器:

json
{
  "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中直接使用所有可用的工具:

python
# 初始化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": "登录"
})

开发

  1. 安装开发依赖
bash
pip install -e ".[dev]"
  1. 运行测试
bash
pytest

贡献

欢迎提交Issue和Pull Request。

许可证

MIT License

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "yourusername-uiautomator2-mcp": {
      "command": "",
      "args": []
    }
  }
}

Use UIAutomator2 MCP 服务器 MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once UIAutomator2 MCP 服务器 is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add UIAutomator2 MCP 服务器 as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the UIAutomator2 MCP 服务器 MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "yourusername-uiautomator2-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "uiautomator2-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the UIAutomator2 MCP 服务器 MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the UIAutomator2 MCP 服务器 MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use UIAutomator2 MCP 服务器 to help me with this task?
UIAutomator2 MCP 服务器
Sure. I read it.
Here is what I found using UIAutomator2 MCP 服务器.

Frequently asked questions

What is the UIAutomator2 MCP 服务器 MCP server used for?

UIAutomator2 MCP 服务器 is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use UIAutomator2 MCP 服务器 MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use UIAutomator2 MCP 服务器 with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use UIAutomator2 MCP 服务器 MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With UIAutomator2 MCP 服务器 connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect UIAutomator2 MCP 服务器 MCP to TypingMind?

UIAutomator2 MCP 服务器 runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does UIAutomator2 MCP 服务器 MCP provide in TypingMind?

UIAutomator2 MCP 服务器 exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use UIAutomator2 MCP 服务器 MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If UIAutomator2 MCP 服务器 requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇