home / mcp / uiautomator2 mcp server

UIAutomator2 MCP Server

Android automator mcp

Installation
Add the following to your MCP client configuration file.

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.

How to use

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.

How to install

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.

Additional Configuration

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"
      ]
    }
  }
}

Configuration examples you can use

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"
      ]
    }
  }
}

Available tools

mcp_android_init_uiautomator2

Initialize the UIAutomator2 MCP client environment and prepare the server for interactions.

mcp_android_start_app

Launch an application on the connected Android device using its package name.

mcp_android_click_element

Click a UI element identified by text, description, or other properties.