MCP Hub
Back to servers

Android MCP Server

Enables AI agents to fully control Android devices through over 30 tools for app management, UI automation, and vision-based analysis via ADB. It supports multi-device management, action recording, and smart execution strategies ranging from UI hierarchy parsing to coordinate-based interaction.

glama
Updated
Mar 26, 2026

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

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:

VariableDescription
ADB_PATHPath to adb binary
ALLOWED_DEVICESComma-separated device IDs
MAX_ACTIONS_PER_MINUTERate limit per device
COMMAND_TIMEOUT_MSADB command timeout
MAX_RETRIESAuto-retry count
DEBUGEnable debug logging
ALLOW_DESTRUCTIVE_OPSAllow uninstall etc.

Available Tools

Device Management

ToolDescription
list_devicesList connected Android devices
get_device_infoGet device model, OS, screen size
get_screen_sizeGet screen resolution

Input Controls

ToolDescription
tapTap at coordinates
swipeSwipe between points
long_pressLong press at coordinates
double_tapDouble tap at coordinates
input_textType text into focused field
press_keyPress hardware/software key

App Management

ToolDescription
list_appsList installed applications
open_appLaunch an app by package name
close_appForce-stop an app
install_apkInstall an APK file
uninstall_appUninstall an app (requires config)
get_current_appGet foreground app package

File System

ToolDescription
list_filesList files on device
pull_fileDownload file from device
push_fileUpload file to device

UI Automation (UIAutomator)

ToolDescription
get_ui_treeCapture UI hierarchy
find_elementFind element by selector
click_elementFind and click element
wait_for_elementWait for element to appear
assert_element_existsCheck if element exists

Vision

ToolDescription
capture_screenshotCapture device screenshot
analyze_screenScreenshot + UI tree analysis
detect_elements_visuallyDetect interactive elements
compare_screenshotsDetect screen changes

Automation & Testing

ToolDescription
smart_clickMulti-strategy element click
run_test_scenarioExecute test steps
start_recordingStart recording actions
stop_recordingStop and save recording
replay_recordingReplay recorded actions
list_recordingsList saved recordings
get_device_stateGet device state summary
get_metricsGet 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

Reviews

No reviews yet

Sign in to write a review