Android-MCP
Enables AI agents to control Android devices and emulators through direct UI interaction, including clicking, swiping, typing, and navigation, with UI state inspection and automated testing capabilities.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Android-MCP open the notification bar and tell me what notifications are showing"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Android-MCP
Android-MCP is a lightweight, open-source tool that bridge between AI agents and Android devices. Running as an MCP server, it lets LLM agents perform real-world tasks such as app navigation, UI interaction and automated QA testing without relying on traditional computer-vision pipelines or preprogramed scripts.
Features
Direct Device Control: Click, swipe, drag, type, and press buttons on Android devices
UI State Inspection: Get device state with UI hierarchy and optional annotated screenshots
MCP Integration: Works with any MCP-compatible client (Claude Desktop, VS Code, etc.)
Emulator Support: Works with Android emulators (tested on emulator-5554)
Physical Device Support: Connect to real Android devices via ADB
Vision Capabilities: Generate annotated screenshots with numbered UI elements for vision-based AI agents
Test Recording: Record user interactions and export as executable test scripts (Python, JSON, or human-readable format)
Test Script Export: Export recorded tests as Python (ADB or uiautomator2), pytest, JSON, or human-readable format
Related MCP server: Android Mobile MCP
Requirements
An Android device or emulator with USB debugging enabled
uv (it fetches Python for you)
That's it. ADB is bundled, and the Portal helper app is installed onto the device automatically on first use.
Installation
claude mcp add android -- uvx --from git+https://github.com/HadyAhmed00/Android-MCP@main android-mcp-portal --emulatorDrop --emulator for a physical device, or pass --device <id> to pick one.
For any other MCP client, use the equivalent config:
{
"mcpServers": {
"android-mcp": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/HadyAhmed00/Android-MCP@main",
"android-mcp-portal",
"--emulator"
]
}
}
}Note: the PyPI release is not published yet, so install straight from GitHub as above. Once
android-mcp-portalis on PyPI this shortens toclaude mcp add android -- uvx android-mcp-portal@latest --emulator.
What happens on first use
ADB — uses
adbfrom your PATH, or falls back to the copy bundled with theadbutilsdependency, so no Android SDK install is required.Portal app — the fast state-reading backend needs the Portal app on the device. If it is missing, the server downloads the pinned APK, installs it, and enables its accessibility service, then verifies with a ping.
If any of that fails (some OEMs block enabling accessibility services over ADB), the server prints manual steps and keeps working on the slower UIAutomator2 backend.
Run it yourself any time with:
uvx --from git+https://github.com/HadyAhmed00/Android-MCP@main android-mcp-portal setup --device emulator-5554or ask the agent to call the Setup-Device tool.
Flags: --skip-bootstrap never touches the device, --portal-apk <path> installs a local APK.
The downloaded APK is cached per-user; set ANDROID_MCP_CACHE_DIR to move that cache.
From source (development)
git clone https://github.com/HadyAhmed00/Android-MCP.git
cd Android-MCP
uv sync
python main.py --emulator # or: python -m android_mcp --emulatorAvailable Tools
The MCP server exposes 19 tools for controlling Android devices and recording test cases:
1. State-Tool
Get the current state of the device including UI hierarchy and optional screenshot.
Parameters:
use_vision(bool, optional): Include annotated screenshot with labeled UI elements
Example:
Get device state with screenshot2. Click-Tool
Click on a specific coordinate on the screen.
Parameters:
x(int): X coordinatey(int): Y coordinate
Example:
Click on coordinates 540, 8003. Long-Click-Tool
Long press (hold) on a specific coordinate.
Parameters:
x(int): X coordinatey(int): Y coordinate
Example:
Long click on 540, 800 for 2 seconds4. Swipe-Tool
Perform a swipe gesture from one point to another.
Parameters:
x1(int): Starting X coordinatey1(int): Starting Y coordinatex2(int): Ending X coordinatey2(int): Ending Y coordinate
Example:
Swipe from top to bottom (refresh)5. Type-Tool
Type text at a specific coordinate (automatically focuses the field).
Parameters:
text(str): Text to typex(int): X coordinatey(int): Y coordinateclear(bool, optional): Clear existing text before typing
Example:
Type "hello world" into the search field6. Drag-Tool
Drag from one location and drop at another.
Parameters:
x1(int): Starting X coordinatey1(int): Starting Y coordinatex2(int): Ending X coordinatey2(int): Ending Y coordinate
Example:
Drag and drop item from position to trash7. Press-Tool
Press device buttons (home, back, power, volume, etc.).
Parameters:
button(str): Button name (back, home, power, volume_up, volume_down)
Example:
Press the back button8. Notification-Tool
Open the notification bar to access notifications.
Parameters: None
Example:
Open notification bar9. Wait-Tool
Wait for a specified duration (useful for allowing apps to load).
Parameters:
duration(int): Seconds to wait
Example:
Wait for 2 seconds9b. Click-By-Label
Tap an element by its label index from the most recent State-Tool output. Preferred over
raw coordinates. Indices are positional and only valid against the latest state — they
shift whenever the screen changes.
Parameters:
label(int): Index from the--- Interactive Elements ---list
9c. Setup-Device
Install the Portal helper app and enable its accessibility service. Use it when State-Tool
is slow or the fast backend is unavailable.
Parameters:
force(bool, optional): Reinstall even if the app already works
10. Start-Recording-Tool
Start recording test actions for later export and playback.
Parameters: None
Example:
Start recording test actions11. Stop-Recording-Tool
Stop recording test actions.
Parameters: None
Example:
Stop recording and finalize test12. Export-Test-Script
Export recorded test actions as an executable test script in multiple formats.
Parameters:
format(str): Export format - 'python', 'json', or 'readable' (default: 'python')filename(str, optional): Custom filename without extensiontest_name(str, optional): Custom test name for Python exports
Example:
Export recorded actions as a Python test script13. Clear-Recording-Tool
Clear all recorded test actions.
Parameters: None
Example:
Clear the recording14. Get-Recording-Stats-Tool
Get statistics about recorded test actions.
Parameters: None
Example:
Show recording statisticsArchitecture
The project is organized into three main modules:
main.py
Entry point that creates the FastMCP server
Defines and exposes all 14 tools
Handles command-line arguments (
--emulator)Integrates test recording functionality
src/mobile/
Mobile class: Manages device connection and state
MobileState: Data class representing device state
Captures screenshots and processes them
src/tree/
Tree class: Parses Android UI XML hierarchy
Extracts interactive elements (buttons, inputs, etc.)
Generates annotated screenshots with numbered labels
Helper utilities for coordinate extraction
src/recorder.py
TestRecorder class: Records user actions during testing
TestAction: Data class representing a single action
Supports multiple export formats (Python, JSON, Readable)
Generates fully independent ADB-based Python scripts
Exports structured test data for CI/CD integration
Available Tools
18 toolsClear-Recording-ToolA
Clear all recorded test actions
Inputs: no named parameters.
Click-By-LabelA
Tap an element by its label index from the most recent State-Tool output. Safer than Click-Tool because coordinates are resolved internally.
Inputs: label (required).
Click-ToolA
Tap at exact (x,y) pixel coordinates. Prefer Click-By-Label when you have a label index from State-Tool.
Inputs: x (required), y (required).
Drag-ToolA
Drag from (x1,y1) to (x2,y2) over 500ms. Use for reordering, moving items, or adjusting sliders.
Inputs: x1 (required), x2 (required), y1 (required), y2 (required).
Export-Test-ScriptA
Export recorded test actions as executable test script. Supported formats: python (default, simple replay script), pytest (with assertions), json, readable.
Inputs: format, filename, test_name.
Get-Recording-Stats-ToolB
Get statistics about recorded test actions
Inputs: no named parameters.
Long-Click-ToolA
Long-press at (x,y) for ~1 second. Use for context menus or elements requiring sustained touch.
Inputs: x (required), y (required).
Notification-ToolB
Access the notifications seen on the device
Inputs: no named parameters.
Press-ToolA
Press a device button: home, back, menu, power, volume_up, volume_down, enter, delete. Also accepts raw Android KEYCODE strings.
Inputs: button (required).
Report-Bug-To-AzureB
Report a bug to Azure DevOps using Azure CLI with proper bug report structure (generates command to run)
Inputs: title (required), actual_result (required), expected_result (required), steps_to_reproduce (required), +6 more.
Report-Bug-To-Azure-DirectC
[EXPERIMENTAL] Report a bug to Azure DevOps - direct execution (may hang)
Inputs: title (required), actual_result (required), expected_result (required), steps_to_reproduce (required), +6 more.
Setup-DeviceA
Install the Portal helper app on the device and enable its accessibility service. Use this when State-Tool is slow or the fast MCP Helper backend is unavailable.
Inputs: force.
Start-Recording-ToolA
Start recording test actions
Inputs: no named parameters.
State-ToolA
Get current screen state: interactive UI elements with label indices, types, names, and tap coordinates. Returns device context (current app, keyboard visibility, screen size). Set use_vision=True for annotated screenshot. Always call this first before interacting.
Inputs: use_vision.
Stop-Recording-ToolA
Stop recording test actions. After stopping, use Export-Test-Script with format="pytest" to generate a test with assertions.
Inputs: no named parameters.
Swipe-ToolA
Swipe from (x1,y1) to (x2,y2) over 300ms. To scroll DOWN, swipe from bottom to top. To scroll UP, swipe from top to bottom.
Inputs: x1 (required), x2 (required), y1 (required), y2 (required).
Type-ToolA
Tap (x,y) to focus the input field, then type the given text. Only use on input/editable elements.
Inputs: x (required), y (required), text (required), clear.
Wait-ToolC
Wait for a specific amount of time
Inputs: duration (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 18 tools
Most tools target clearly distinct actions: tapping, swiping, typing, dragging, pressing buttons, notifications, waiting, and recording. The main ambiguity is between Click-Tool and Click-By-Label, which both perform taps, and Report-Bug-To-Azure vs Report-Bug-To-Azure-Direct, which are near-duplicates.
There is a recognizable pattern of verb-noun with a -Tool suffix for many tools, but notable exceptions like Setup-Device, Export-Test-Script, Report-Bug-To-Azure, and Click-By-Label break the pattern. Notification-Tool is noun-first rather than verb-first, making the convention mixed but still generally readable.
18 tools is slightly above the ideal 3-15 range, but the count is justified by the combination of core UI automation actions, device state access, and a test recording pipeline. The two bug-report tools are somewhat redundant and could be consolidated, but overall the scope is reasonable.
The toolset covers the core Android automation lifecycle well: screen state discovery, coordinate-based and label-based interaction, gestures, device buttons, notifications, waiting, and recording/exporting tests. Minor gaps exist, such as no explicit wait-for-element or direct assertion tool, but agents can work around these using the state and export features.
Maintenance
Related MCP Connectors
Give your AI agent a real cloud Android phone: push APKs, drive it, get screenshots and logs.
Disposable cloud Android emulators for coding agents: run an APK or PR build, tap, type, screenshot.
Let AI agents control Android and iOS devices on Mobilerun Cloud: screen, input, apps, workflows.
Cloud Android phones for AI agents: create a phone, read the screen, tap, type, install APKs, park.
Related MCP Servers
- AlicenseCqualityBmaintenanceA lightweight bridge enabling AI agents to perform real-world tasks on Android devices such as app navigation, UI interaction, and automated QA testing without requiring computer-vision pipelines or preprogrammed scripts.14924MIT
- FlicenseAqualityDmaintenanceEnables AI agents to interact with Android devices through UI manipulation, screen capture, touch gestures, text input, and app management via ADB. Provides comprehensive mobile automation capabilities including element detection, navigation, and application control for Android device testing and interaction.961 PyPI2-
- AlicenseAqualityDmaintenanceEnables 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.37188 npm1MIT
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with Android devices and emulators via ADB, providing tools for screenshots, UI inspection, touch and text input, app management, and device control.42200 npm22MIT