Skip to main content
Glama

Android MCP Server

A production-grade MCP (Model Context Protocol) server that gives any AI agent full control over Android devices via ADB, UIAutomator, Accessibility, and Vision (screenshots).

Features

  • 30+ MCP Tools — Device control, app management, UI automation, vision, testing

  • Multi-Device Support — Control multiple Android devices simultaneously

  • Smart Execution — UIAutomator → Accessibility → Vision → Coordinates fallback

  • Security — Input sanitization, rate limiting, device allowlisting, destructive op protection

  • Automation — Action recording/replay, test scenarios, state tracking

  • Observability — Structured JSON logs, per-tool metrics, action history

Related MCP server: android-mcp

Prerequisites

Verify ADB is working:

adb devices

Setup

# Install dependencies
npm install

# Build TypeScript
npm run build

# Run the server
npm start

MCP Client Configuration

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "android": {
      "command": "node",
      "args": ["repo_path/dist/mcp/server.js"],
      "env": {
        "ADB_PATH": "adb"
      }
    }
  }
}

Cursor

Add to your Cursor MCP settings:

{
  "mcpServers": {
    "android": {
      "command": "node",
      "args": ["repo_path/dist/mcp/server.js"]
    }
  }
}

Generic MCP Client (stdio)

node dist/mcp/server.js

The server communicates via stdin/stdout using the MCP JSON-RPC protocol.

Configuration

Create android-mcp.config.json in the project root (optional):

{
  "adbPath": "adb",
  "allowedDevices": [],
  "maxActionsPerMinute": 120,
  "commandTimeoutMs": 30000,
  "maxRetries": 3,
  "debug": false,
  "screenshotDir": "./screenshots",
  "recordingsDir": "./recordings",
  "allowDestructiveOps": false
}

Or use environment variables:

Variable

Description

ADB_PATH

Path to adb binary

ALLOWED_DEVICES

Comma-separated device IDs

MAX_ACTIONS_PER_MINUTE

Rate limit per device

COMMAND_TIMEOUT_MS

ADB command timeout

MAX_RETRIES

Auto-retry count

DEBUG

Enable debug logging

ALLOW_DESTRUCTIVE_OPS

Allow uninstall etc.

Available Tools

Device Management

Tool

Description

list_devices

List connected Android devices

get_device_info

Get device model, OS, screen size

get_screen_size

Get screen resolution

Input Controls

Tool

Description

tap

Tap at coordinates

swipe

Swipe between points

long_press

Long press at coordinates

double_tap

Double tap at coordinates

input_text

Type text into focused field

press_key

Press hardware/software key

App Management

Tool

Description

list_apps

List installed applications

open_app

Launch an app by package name

close_app

Force-stop an app

install_apk

Install an APK file

uninstall_app

Uninstall an app (requires config)

get_current_app

Get foreground app package

File System

Tool

Description

list_files

List files on device

pull_file

Download file from device

push_file

Upload file to device

UI Automation (UIAutomator)

Tool

Description

get_ui_tree

Capture UI hierarchy

find_element

Find element by selector

click_element

Find and click element

wait_for_element

Wait for element to appear

assert_element_exists

Check if element exists

Vision

Tool

Description

capture_screenshot

Capture device screenshot

analyze_screen

Screenshot + UI tree analysis

detect_elements_visually

Detect interactive elements

compare_screenshots

Detect screen changes

Automation & Testing

Tool

Description

smart_click

Multi-strategy element click

run_test_scenario

Execute test steps

start_recording

Start recording actions

stop_recording

Stop and save recording

replay_recording

Replay recorded actions

list_recordings

List saved recordings

get_device_state

Get device state summary

get_metrics

Get performance metrics

Architecture

src/
├── mcp/
│   └── server.ts           # MCP server entry point
├── controllers/
│   ├── device-tools.ts      # Device MCP tools
│   ├── input-tools.ts       # Input MCP tools
│   ├── app-tools.ts         # App management MCP tools
│   ├── file-tools.ts        # File system MCP tools
│   ├── ui-tools.ts          # UIAutomator MCP tools
│   ├── vision-tools.ts      # Vision MCP tools
│   └── automation-tools.ts  # Automation MCP tools
├── adb/
│   ├── adb-executor.ts      # Safe ADB command execution
│   ├── device-manager.ts    # Device discovery & sessions
│   ├── input-controller.ts  # Touch/key input
│   ├── app-manager.ts       # App lifecycle
│   └── file-manager.ts      # File operations
├── uiautomator/
│   ├── ui-tree-parser.ts    # XML → JSON conversion
│   ├── element-finder.ts    # Element search & interaction
│   └── element-cache.ts     # LRU element cache
├── vision/
│   ├── screenshot.ts        # Screenshot capture
│   ├── screen-diff.ts       # Screenshot comparison
│   └── visual-analyzer.ts   # AI-ready screen analysis
├── accessibility/
│   ├── accessibility-bridge.ts  # Accessibility fallback
│   └── smart-executor.ts       # Multi-strategy executor
├── automation/
│   ├── action-recorder.ts   # Action recording
│   ├── action-replayer.ts   # Action replay
│   ├── test-runner.ts       # Test scenarios
│   └── state-tracker.ts     # Device state memory
├── security/
│   ├── validator.ts         # Input sanitization
│   └── rate-limiter.ts      # Rate limiting
└── utils/
    ├── logger.ts            # Structured logging
    ├── config.ts            # Configuration
    ├── errors.ts            # Error hierarchy
    ├── retry.ts             # Retry logic
    └── metrics.ts           # Performance tracking

Testing

npm test
npm run test:coverage

Development

# Run in development mode (ts-node)
npm run dev

# Test with MCP Inspector
npx @modelcontextprotocol/inspector node dist/mcp/server.js

License

MIT

Available Tools

37 tools
analyze_screenA

Capture a screenshot and analyze the screen content. Returns both the visual screenshot and a text summary of the UI tree for comprehensive screen understanding. Use this when you need to understand the full screen context.

Inputs: device_id.

assert_element_existsA

Check whether a UI element exists on the current screen. Returns true/false without throwing an error. Useful for test assertions and conditional logic.

Inputs: selector (required), device_id.

capture_screenshotA

Capture a screenshot of the current Android device screen. Returns a base64-encoded PNG image that can be displayed or analyzed visually. Use this to see what is currently on screen.

Inputs: save_to_disk, device_id.

click_elementA

Find a UI element matching the selector and tap its center. This is the preferred way to interact with UI elements rather than using raw coordinates.

Inputs: selector (required), device_id.

close_appB

Force-stop an Android application by its package name.

Inputs: package_name (required), device_id.

compare_screenshotsA

Compare the current screen with the previously captured screenshot to detect changes. Returns the percentage of pixels that changed and whether the screen has significantly changed. Useful for verifying that an action had an effect.

Inputs: threshold, device_id.

detect_elements_visuallyA

Detect interactive elements on the screen using a combination of screenshots and UI tree analysis. Returns a list of all clickable/focusable elements with their coordinates and descriptions. Use this when you need to find elements to interact with.

Inputs: device_id.

double_tapA

Double tap at specific coordinates on the Android screen. Useful for zooming or selecting text.

Inputs: x (required), y (required), device_id.

find_elementA

Find a UI element on the Android screen matching the given selector criteria. Returns the first matching element with its properties and bounds. Use this to locate buttons, text fields, or any UI component before interacting with it.

Inputs: selector (required), device_id.

get_current_appA

Get the package name of the currently focused/foreground Android application.

Inputs: device_id.

get_device_infoA

Get detailed information about a connected Android device including model, Android version, SDK version, screen size, brand, and manufacturer

Inputs: device_id.

get_device_stateA

Get the current tracked state of a device including current app, screen history, and recent actions. Useful for understanding context.

Inputs: device_id.

get_metricsA

Get performance metrics and action history for the MCP server. Shows per-tool latency, success/failure counts.

Inputs: no named parameters.

get_screen_sizeA

Get the screen resolution (width x height in pixels) of the connected Android device

Inputs: device_id.

get_ui_treeA

Capture the current UI hierarchy from the Android screen. Returns a structured representation of all visible UI elements with their properties, text, bounds, and states. This is the primary way to understand what is currently on screen.

Inputs: format, device_id.

health_checkA

Check the health status of the MCP server and ADB connectivity. Returns server uptime, ADB availability, connected device count, and configuration summary.

Inputs: no named parameters.

input_textA

Type text into the currently focused input field on the Android device. The field must already be focused (tapped).

Inputs: text (required), device_id.

install_apkC

Install an APK file onto the Android device from a local file path.

Inputs: local_path (required), device_id.

list_appsA

List installed applications on the Android device. By default shows third-party apps only.

Inputs: include_system, device_id.

list_devicesA

List all connected Android devices with their status and model information

Inputs: no named parameters.

list_filesA

List files and directories at a given path on the Android device. Returns file names, types, sizes, and permissions.

Inputs: path (required), device_id.

list_pluginsA

List all loaded MCP server plugins and their versions.

Inputs: no named parameters.

list_recordingsB

List all saved action recordings/macros.

Inputs: no named parameters.

long_pressA

Long press at specific coordinates on the Android screen. Useful for context menus, drag initiation, or selection.

Inputs: x (required), y (required), duration, device_id.

open_appA

Launch an Android application by its package name (e.g. com.google.android.youtube). The app must be installed.

Inputs: package_name (required), device_id.

press_keyA

Press a hardware/software key on the Android device. Common keycodes: HOME, BACK, MENU, ENTER, VOLUME_UP, VOLUME_DOWN, POWER, DEL, TAB, SPACE, APP_SWITCH, SEARCH, CAMERA.

Inputs: keycode (required), device_id.

pull_fileA

Download a file from the Android device to the local machine.

Inputs: remote_path (required), local_path (required), device_id.

push_fileB

Upload a file from the local machine to the Android device.

Inputs: local_path (required), remote_path (required), device_id.

replay_recordingC

Replay a previously recorded action sequence.

Inputs: recording_path (required), delay_between_actions, stop_on_error, device_id.

run_test_scenarioA

Execute an ordered test scenario with multiple steps and assertions. Each step performs an action and optionally verifies the result. Returns detailed pass/fail results per step.

Inputs: name (required), steps (required), stop_on_failure, device_id.

smart_clickA

Intelligently click an element using multiple strategies: UIAutomator → Accessibility → Vision → Coordinates fallback. This is the most reliable way to click elements.

Inputs: selector (required), fallback_x, fallback_y, device_id.

start_recordingA

Start recording actions to create a macro. All subsequent tool calls will be recorded. Use stop_recording to save.

Inputs: name (required), device_id.

stop_recordingA

Stop the active recording and save it to disk.

Inputs: recording_id (required).

swipeA

Swipe from one point to another on the Android screen. Useful for scrolling, swiping between pages, or drag gestures.

Inputs: x1 (required), y1 (required), x2 (required), y2 (required), +2 more.

tapA

Tap at specific coordinates on the Android screen. Coordinates can be absolute pixels or normalized (0-1 range, will be scaled to screen size).

Inputs: x (required), y (required), device_id.

uninstall_appA

Uninstall an application from the Android device. Requires allowDestructiveOps to be enabled in server configuration.

Inputs: package_name (required), device_id.

wait_for_elementA

Wait for a UI element to appear on screen within a timeout period. Useful after navigation, loading screens, or animations. Polls the UI tree at regular intervals until the element is found.

Inputs: selector (required), timeout_ms, device_id.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 37 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there is some overlap that could cause confusion. For example, 'analyze_screen', 'capture_screenshot', and 'get_ui_tree' all involve screen capture and analysis, with 'analyze_screen' combining both visual and UI tree aspects, potentially making it ambiguous when to use each. Similarly, 'click_element' and 'smart_click' both handle clicking, though 'smart_click' is described as more reliable with fallback strategies, which helps differentiate them. Overall, the tools are well-defined, but a few overlaps exist.

    Naming Consistency5/5

    Tool names follow a highly consistent snake_case pattern with clear verb_noun structures throughout, such as 'analyze_screen', 'click_element', 'get_device_info', and 'list_apps'. There are no deviations in naming conventions, making it easy to predict and understand tool purposes based on their names.

    Tool Count3/5

    With 37 tools, the count is borderline high for an Android automation server. While it covers a wide range of functionalities from UI interaction to file management and testing, it may feel heavy and overwhelming for agents to navigate efficiently. A more focused set of 15-25 tools might improve usability without sacrificing core capabilities.

    Completeness5/5

    The tool set provides comprehensive coverage for Android automation, including UI interaction (e.g., click, swipe, input), device management (e.g., install, uninstall, get info), file operations (e.g., push, pull, list), testing support (e.g., run_test_scenario, assert_element_exists), and recording features. There are no obvious gaps; it supports full lifecycle operations from app installation to UI testing and performance monitoring.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      Enables AI agents to control Android devices and emulators through direct UI interaction, allowing app navigation, automated testing, and real-world task execution via ADB without computer vision or scripts.
      18
      2
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to visually perceive and directly control Android devices via ADB and screen-control tooling, including screenshots, taps, swipes, typing, app management, UI inspection, file transfer, shell commands, and audio/video streaming.
      357 npm
      MIT