Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

ultimate-android-mcp

MCP.Pizza Chef: oddlyspaced

Ultimate Android MCP is a comprehensive Model Context Protocol server that enables LLMs to automate and interact with connected Android devices and emulators. It offers extensive capabilities including application management, UI interaction, device information retrieval, and more, facilitating seamless control and automation of Android environments through standardized MCP interfaces.

Use This MCP server To

Manage installed Android applications via LLM commands Launch or uninstall apps on connected Android devices Install APK files remotely through LLM-driven workflows Retrieve detailed device and application information Automate UI interactions on Android devices for testing Control Android emulators for development and QA tasks Integrate Android device management into AI-enhanced workflows

README

Ultimate Android MCP ๐Ÿค–

๐Ÿ“ Description

Ultimate Android MCP is a powerful and versatile MCP (Model Context Protocol) server designed to interact with connected Android devices. It provides a wide range of tools and functionalities to perform various tasks on Android devices, such as managing applications, interacting with the UI, retrieving device information, and more. This project aims to provide the widest set of capabilities to ensure optimal interaction via LLMs using the Model Context Protocol.

โœจ Features

The MCP server provides the following features:

๐Ÿ“ฑ Application Management

  • Retrieve a list of all installed packages (system and user-installed).
  • Retrieve a list of user-installed application package names.
  • Retrieve a list of system application package names (pre-installed apps).
  • Launch applications by package name.
  • Install an APK on the connected Android device.
  • Uninstall a specified package from the device.
  • Check if a specified package is installed on the device.

๐ŸŽฎ Input Simulation

  • Simulate input events such as key presses, taps, swipes, and text input.
  • Simulate a key event with a specified keycode.
  • Simulate a tap gesture at specified (x, y) coordinates.
  • Simulate typing text into the currently focused field.
  • Simulate a key press event with a specified keycode.
  • Simulate a rolling gesture with specified dx and dy values.
  • Simulate a swipe gesture from one coordinate to another with an optional duration.
  • Check if the virtual keyboard is currently open.
  • Simulate a back button press.
  • Simulate a home button press.

๐Ÿ“Š Device Information

  • Retrieve device-specific information, including serial number, properties, and battery level.
  • Retrieve the serial number of the connected Android device.
  • Retrieve build.prop properties of the device.
  • Retrieve device overlay configuration properties.
  • Retrieve the battery level of the device.
  • Retrieve the screen density of the device.
  • Retrieve the screen size of the device.

๐Ÿ–ฅ๏ธ System and Performance Monitoring

  • Retrieve CPU information, such as core count and load percentage.
  • Retrieve the number of CPU cores on the device.
  • Retrieve the current CPU load percentage on the device.
  • Retrieve top activities and processes.
  • Retrieve the process ID (PID) for a specified package name.
  • Retrieve the activities currently on top of the device.
  • Retrieve the singular activity currently on top of the device.

๐Ÿ“‚ File Management

  • Manage files on the device, including pushing and pulling files.
  • Pull a file from the connected Android device to the local machine.
  • Push a file from the local machine to the connected Android device.

๐Ÿ–ฑ๏ธ UI Interaction

  • Retrieve UI elements and focused nodes from the device screen.
  • Retrieve a list of UI nodes currently visible on the device screen, focusing on text labels and content descriptions.
  • Retrieve a list of UI nodes that are currently focused on the device screen.

โš™๏ธ Advanced Operations

  • Execute raw ADB shell commands and retrieve the output.

๐ŸŽฅ Demo

Physical device (Pixel 7 Pro running Android 15) connected via USB, which is having its screen shared via scrcpy. Using Claude for Desktop (Version 0.9.2). The text provided to Claude was the following :

In the connected android device, play the song 'mask off' by future on spotify.

Claude then figured out how to launch the app, which button to click and what text to enter where. Everything in the demo is autonomous with no user interaction in between.

demo.mp4

๐Ÿ“‹ Prerequisites

To run this project, ensure you have the following:

  • Python 3.
  • ADB (Android Debug Bridge) installed and configured on your system (ensure that adb command works).
  • A connected Android device with USB debugging enabled.
  • The pure-python-adb library installed (included in the project dependencies).

โš™๏ธ Installation and Setup

Follow these steps to set up the project:

  1. Clone the repository:

    git clone https://github.com/oddlyspaced/ultimate-android-mcp.git android-mcp
    cd android-mcp
  2. Install the required libraries:

    By default this project uses uv for dependency management, however you can install the required packages via pip if you like.

    uv sync

    or

    pip install pure-python-adb
    pip install mcp
  3. Configure the project by editing the config.py file to match your ADB setup and device details. (More in next section)

  4. Run doctor.py to ensure that the setup is done correctly.

    Here is reference response from the doctor.py script :

    Checking device connection using the following configuration:
    ADB Client Host: 127.0.0.1
    ADB Client Port: 5037
    ADB Device Serial: 32241FDH3002EH
    
    Device connected: 32241FDH3002EH
    Hello from Android! Ready to use with MCP.
    

๐Ÿ› ๏ธ Configuration Overview

The config.py file contains the following configuration options:

  • adb_client_host: The host address of the ADB server (default: 127.0.0.1).
  • adb_client_port: The port of the ADB server (default: 5037).
  • adb_device_serial: The serial number or IP address of the connected device. If not specified, the first available device will be used.

๐Ÿ–ฅ๏ธ Usage via Claude MCP Config JSON

To use the MCP server, you can interact with it via Claude Desktop MCP configuration JSON.

The Claude Desktop configuration file is present at the following locations:

Windows: %APPDATA%\Claude\claude_desktop_config.json

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Here is an example configuration using uv:

{
  "mcpServers": {
    "Android MCP": {
      "command": "uv",
      "args": [
        "--directory",
        "/Users/hardik/Projects/Android-Agents/android-mcp", // Replace this with your folder path
        "run",
        "server.py"
      ]
    }
  }
}

or with python

{
  "mcpServers": {
    "Android MCP": {
      "command": "python",
      "args": [
        "/Users/hardik/Projects/Android-Agents/android-mcp/server.py", // Replace this with your folder path
      ]
    }
  }
}

Alternatively, you can run the MCP server using the following command:

python server.py

๐Ÿž Known Issues

  • Often times after continously querying the user interface, results might become unavailable temporarily unless device is restarted. This is an issue with dumping the current UI tree. Logic will be updated to fix this shortly.

๐Ÿ’ป Technologies Used

  • Python
  • MCP - Model Context Protocol
  • pure-python-adb

Contributors

๐Ÿ“œ License

This project is licensed under the GNU General Public License v3.0. You may obtain a copy of the license at:

https://www.gnu.org/licenses/gpl-3.0.en.html

This license allows you to use, modify, and distribute the software, provided that any modifications or derivative works are also licensed under the GPL. For more details, refer to the license documentation.

ultimate-android-mcp FAQ

How do I connect my Android device to the Ultimate Android MCP server?
Connect your device via USB or emulator and ensure developer mode and ADB debugging are enabled for communication.
Can Ultimate Android MCP install APKs on any Android device?
Yes, it supports installing APKs on connected devices or emulators with proper permissions.
Does this MCP server support both physical devices and emulators?
Yes, it works seamlessly with both physical Android devices and emulators.
How does Ultimate Android MCP handle application management?
It can list, launch, install, and uninstall applications by package name using standardized MCP commands.
Is it possible to automate UI interactions on Android devices using this MCP?
Yes, the server provides tools to interact with the device UI, enabling automation of user interface tasks.
What security considerations are there when using Ultimate Android MCP?
Ensure devices are connected securely, and only trusted LLM clients have access to prevent unauthorized control.
Can I retrieve system and user app lists separately?
Yes, the server distinguishes between system and user-installed applications for detailed management.
Which LLM providers can I use with Ultimate Android MCP?
It is provider-agnostic and works with OpenAI, Anthropic Claude, Google Gemini, and others supporting MCP.