home / mcp / uiautomator2 mcp server
Android automator mcp
Configuration
View docs{
"mcpServers": {
"gitdzreal93-uiautomator2-mcp": {
"command": "uv",
"args": [
"--directory",
"/path/to/uiautomator2-mcp",
"run",
"src/server.py"
],
"env": {
"PYTHONPATH": "/path/to/uiautomator2-mcp",
"ANDROID_HOME": "/path/to/android-sdk"
}
}
}
}You can remotely control and automate Android devices using the UIAutomator2 MCP Server. Built on the FastMCP framework, it exposes Android device management and UI automation capabilities through an MCP client, letting you run ADB commands, manage apps, capture screenshots, and perform UI actions from your automation workflows.
You interact with the server through an MCP client. First, initialize the UIAutomator2 environment so the client can discover and use the available endpoints. Then you can start apps, simulate taps, input text, scroll, and wait for UI elements just like you would on a device.
Prerequisites you need before installing the server: Python 3.10 or newer, the ADB tool, and a connected Android device or emulator.
Install steps you should follow in order:
Clone the project and enter the directory.
A MCP server configuration lets you run the server locally or via a script. The setup includes command line options and optional environment variables to tailor the runtime to your environment.
{
"mcpServers": {
"uiautomator2": {
"command": "uv",
"args": [
"--directory",
"/path/to/uiautomator2-mcp",
"run",
"src/server.py"
],
"env": {
"PYTHONPATH": "/path/to/uiautomator2-mcp",
"ANDROID_HOME": "/path/to/android-sdk"
}
},
"uiautomator2_py": {
"command": "python",
"args": [
"/path/to/uiautomator2-mcp/src/server.py"
]
}
}
}The following examples show how to run the MCP server via different approaches. You can choose the one that best fits your environment.
{
"mcpServers": {
"uiautomator2": {
"command": "uv",
"args": [
"--directory",
"/path/to/uiautomator2-mcp",
"run",
"src/server.py"
],
"env": {
"PYTHONPATH": "/path/to/uiautomator2-mcp",
"ANDROID_HOME": "/path/to/android-sdk"
}
},
"uiautomator2_py": {
"command": "python",
"args": [
"/path/to/uiautomator2-mcp/src/server.py"
]
}
}
}Initialize the UIAutomator2 MCP client environment and prepare the server for interactions.
Launch an application on the connected Android device using its package name.
Click a UI element identified by text, description, or other properties.