UIAutomator2
A MCP (Model Context Protocol) server that provides tools for controlling and interacting with Android devices using uiautomator2.
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
Maintainer
Works with
Installation
Manual Installation
npx uiautomator2Configuration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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
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 devicesInstall 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 stdioInitialize uiautomator2 on your device
Install the uiautomator2 server APK on your connected Android device. This is a one-time setup step.
python -m uiautomator2 initVerify available tools
List all available MCP tools and their categories to understand what operations are supported.
u2mcp tools
u2mcp tagsConfigure 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.
UIAutomator2 Alternatives — Similar Browser Automation Servers
Looking for alternatives to UIAutomator2? Here are other popular browser automation servers you can use with Claude, Cursor, and VS Code.
Chrome DevTools MCP
★ 40.6kAI-powered Chrome automation server with natural language element detection. Control Chrome browser through MCP protocol for testing, debugging, and performance analysis. Features 91% accuracy in element location, works with free AI models, and suppo
UI TARS Desktop
★ 34.9k📇 🏠 - Browser automation capabilities using Puppeteer, both support local and remote browser connection.
Playwright
★ 32.8kA production-ready browser automation server that enables AI assistants to interact with web pages using tools for navigation, element interaction, and data extraction. It features a built-in Inspector UI and robust crash recovery for reliable automa
Page Agent
★ 18.0kJavaScript in-page GUI agent. Control web interfaces with natural language.
Chrome
★ 11.7kAn extension-based MCP server that enables AI assistants to control your browser, leveraging existing sessions and login states for automation and content analysis. It provides over 20 tools for semantic tab search, interactive element manipulation,
LAMDA
★ 7.8kThe most powerful Android RPA agent framework, next generation mobile automation.
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.
Set Up UIAutomator2 in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.