UIAutomator2

v1.0.0Browser Automationstable

A MCP (Model Context Protocol) server that provides tools for controlling and interacting with Android devices using uiautomator2.

adbadbutilsaiandroidartificial-intelligence
Share:
18
Stars
0
Downloads
0
Weekly
0/5

What is UIAutomator2?

UIAutomator2 is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp (model context protocol) server that provides tools for controlling and interacting with android devices using uiautomator2.

A MCP (Model Context Protocol) server that provides tools for controlling and interacting with Android devices using uiautomator2.

This server falls under the Browser Automation category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • A MCP (Model Context Protocol) server that provides tools fo

Use Cases

Android device automation
ADB and uiautomator2 control
tanbro

Maintainer

LicenseApache-2.0
Languagepython
Versionv1.0.0
UpdatedMay 18, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx uiautomator2

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use UIAutomator2

The UIAutomator2 MCP server exposes 70+ tools for controlling and automating Android devices from AI assistants using the uiautomator2 Python library over ADB. It supports touch gestures, app lifecycle management, XPath-based UI element interaction, text input, clipboard operations, screenshot capture, and screen mirroring via scrcpy. QA engineers and developers use it to drive Android test automation, perform mobile UI testing, or build AI-driven mobile agents.

Prerequisites

  • Python 3.8+ with uv, pipx, or pip package manager
  • Android Debug Bridge (ADB) installed and on your PATH
  • At least one Android device or emulator connected and authorized via ADB
  • uiautomator2 Python package and its Android server component installed on the device
  • An MCP client such as Claude Desktop or Cursor
1

Connect your Android device

Enable USB debugging on your Android device and connect it via USB or set up a TCP/ADB connection. Verify it is detected by ADB.

adb devices
2

Install the MCP server

Install uiautomator2-mcp-server using your preferred Python package manager. The uvx approach runs it without a permanent install.

pip install uiautomator2-mcp-server
# or with pipx
pipx install uiautomator2-mcp-server
# or run directly without installing
uvx uiautomator2-mcp-server stdio
3

Initialize uiautomator2 on your device

Install the uiautomator2 server APK on your connected Android device. This is a one-time setup step.

python -m uiautomator2 init
4

Verify available tools

List all available MCP tools and their categories to understand what operations are supported.

u2mcp tools
u2mcp tags
5

Configure your MCP client

Add the server to your Claude Desktop configuration file. The server communicates via stdio transport.

UIAutomator2 Examples

Client configuration

Claude Desktop configuration for the UIAutomator2 MCP server using uvx.

{
  "mcpServers": {
    "android": {
      "command": "uvx",
      "args": ["uiautomator2-mcp-server", "stdio"]
    }
  }
}

Client configuration with logging

Configuration with debug logging enabled via environment variable.

{
  "mcpServers": {
    "android": {
      "command": "uvx",
      "args": ["uiautomator2-mcp-server", "stdio"],
      "env": {
        "U2MCP_STDIO_LOG_LEVEL": "debug"
      }
    }
  }
}

Prompts to try

Example prompts for automating an Android device through Claude.

- "Take a screenshot of the current screen"
- "Open the YouTube app on my Android device"
- "Tap at coordinates 500, 1000"
- "Swipe up to scroll down the page"
- "Type 'hello world' into the search field"
- "Find the Settings button and tap it"

Troubleshooting UIAutomator2

No devices found or ADB connection fails

Run 'adb devices' to confirm your device is detected. Enable USB debugging in Developer Options on your Android device. For wireless ADB, run 'adb connect <device-ip>:5555' first.

uiautomator2 server not responding on device

Re-run 'python -m uiautomator2 init' to reinstall the server APK on your device. If the device already has an older version, uninstall it first via 'adb uninstall com.github.uiautomator'.

Tool calls fail with XPath element not found

Use the screenshot tool first to see the current screen state, then use a UI inspector (like uiautomator viewer) to find the correct XPath selectors for elements on your device.

Frequently Asked Questions about UIAutomator2

What is UIAutomator2?

UIAutomator2 is a Model Context Protocol (MCP) server that mcp (model context protocol) server that provides tools for controlling and interacting with android devices using uiautomator2. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install UIAutomator2?

Follow the installation instructions on the UIAutomator2 GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with UIAutomator2?

UIAutomator2 works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is UIAutomator2 free to use?

Yes, UIAutomator2 is open source and available under the Apache-2.0 license. You can use it freely in both personal and commercial projects.

Browse More Browser Automation MCP Servers

Explore all browser automation servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "uiautomator2": { "command": "npx", "args": ["-y", "uiautomator2"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use UIAutomator2?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides