Skip to main content
Glama

android-mcp

Android MCP Server

A lightweight MCP (Model Context Protocol) server for Android operating system automation. This server provides tools to interact directly with Android devices, enabling automated testing, app interaction, and device control.

Features

  • Device Control: Click, long click, swipe, drag, and type on Android devices
  • State Management: Get device state with optional visual screenshots
  • Navigation: Press hardware buttons and access notifications
  • Automation: Wait functionality for timing control
  • Emulator Support: Works with both physical devices and Android emulators

Prerequisites

  • Python 3.13 or higher
  • uv package manager
  • Android device or emulator with USB debugging enabled
  • ADB (Android Debug Bridge) installed and accessible

Installation

1. Install uv (if not already installed)

# macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh # Windows powershell -c "irm https://astral.sh/uv/install.ps1 | iex" # Alternative: using pip pip install uv

2. Set up the project

# Navigate to the android MCP directory cd mcp/android # Install dependencies uv sync # Activate the virtual environment (optional, uv run handles this automatically) source .venv/bin/activate

3. Verify installation

# Test the server uv run main.py --help

Usage

Running the server

For physical devices:
uv run main.py
For Android emulator:
uv run main.py --emulator

Device Setup

  1. Enable Developer Options on your Android device:
    • Go to Settings > About phone
    • Tap "Build number" 7 times
  2. Enable USB Debugging:
    • Go to Settings > Developer options
    • Enable "USB debugging"
  3. Connect device and verify ADB connection:
    adb devices

MCP Server Configuration

Add the following configuration to your MCP client settings (e.g., Claude Desktop, Cline, etc.):

{ "mcpServers": { "android-mcp": { "type": "stdio", "command": "bash", "args": [ "-c", "cd /path/to/agent/mcp/android && source .venv/bin/activate && uv run main.py --emulator" ], "alwaysAllow": [ "State-Tool", "Click-Tool", "Type-Tool", "Swipe-Tool" ] } } }

Note: Update the path in the configuration to match your actual project location.

Configuration Options

  • For physical devices: Remove the --emulator flag from the args
  • Custom device: Add --device <device_id> to specify a particular device
  • alwaysAllow: Pre-approve specific tools to avoid repeated permission prompts

Available Tools

ToolDescriptionParameters
Click-ToolClick on specific coordinatesx: int, y: int
State-ToolGet device state with optional screenshotuse_vision: bool = false
Long-Click-ToolLong press on coordinatesx: int, y: int, duration: int
Swipe-ToolSwipe between coordinatesx1: int, y1: int, x2: int, y2: int
Type-ToolType text at coordinatestext: str, x: int, y: int, clear: bool = false
Drag-ToolDrag and drop between coordinatesx1: int, y1: int, x2: int, y2: int
Press-ToolPress hardware buttonsbutton: str
Notification-ToolAccess notification panelNone
Wait-ToolWait for specified durationduration: int

Troubleshooting

Common Issues

  1. Device not found:
    • Ensure USB debugging is enabled
    • Check adb devices output
    • Try different USB cables/ports
  2. Permission denied:
    • Allow USB debugging permission on device
    • Check device authorization in adb devices
  3. Connection timeout:
    • Restart ADB: adb kill-server && adb start-server
    • Reconnect device
  4. Python version issues:
    • Ensure Python 3.13+ is installed
    • Use uv python install 3.13 if needed

Emulator Setup

If using Android emulator:

  1. Start Android emulator (usually accessible as emulator-5554)
  2. Verify connection: adb connect emulator-5554
  3. Use --emulator flag when running the server

Development

Project Structure

mcp/android/ ├── README.md ├── pyproject.toml ├── main.py # MCP server entry point ├── src/ │ ├── mobile/ # Device interaction logic │ └── tree/ # UI tree parsing and state management └── .venv/ # Virtual environment

Dependencies

  • mcp: Model Context Protocol framework
  • uiautomator2: Android device automation
  • pillow: Image processing for screenshots
  • ipykernel: Jupyter kernel support
-
security - not tested
F
license - not found
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

A lightweight MCP server for Android operating system automation. This server provides tools to interact directly with Android devices and app interaction with control

  1. Features
    1. Prerequisites
      1. Installation
        1. 1. Install uv (if not already installed)
        2. 2. Set up the project
        3. 3. Verify installation
      2. Usage
        1. Running the server
        2. Device Setup
      3. MCP Server Configuration
        1. Configuration Options
      4. Available Tools
        1. Troubleshooting
          1. Common Issues
          2. Emulator Setup
        2. Development
          1. Project Structure
          2. Dependencies

        Related MCP Servers

        • -
          security
          A
          license
          -
          quality
          A server enabling programmatic control over Android devices through ADB, providing capabilities like screenshot capture, UI layout analysis, and package management that can be accessed by MCP clients like Claude Desktop.
          Last updated -
          503
          Apache 2.0
          • Apple
        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol (MCP) server that enables AI assistants to control and interact with Android devices, allowing for device management, app debugging, system analysis, and UI automation through natural language commands.
          Last updated -
          8
          207
          Apache 2.0
          • Linux
          • Apple
        • -
          security
          F
          license
          -
          quality
          A FastMCP framework-based server providing Android device automation control capabilities, enabling UI interactions, device management, and application control through natural language.
          Last updated -
          7
          • Linux
          • Apple
        • A
          security
          A
          license
          A
          quality
          An MCP server that integrates with Apktool to provide live reverse engineering support for Android applications using Claude and other LLMs through the Model Context Protocol.
          Last updated -
          13
          195
          Apache 2.0
          • Linux

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/tomdwipo/agent'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server