mcp-android-emulator
Provides tools for interacting with Android devices and emulators via ADB, including screen capture, UI inspection, touch gestures, text input, system key presses, app management, clipboard operations, device control, log access, and wait/assert functionalities.
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., "@mcp-android-emulator Take a screenshot of the current screen"
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.
MCP Android Emulator
A Model Context Protocol (MCP) server that enables AI assistants like Claude to interact with Android devices and emulators via ADB (Android Debug Bridge).
Features
Screenshots: Capture device screen as base64 images
UI Inspection: Get UI hierarchy (like DOM but for Android)
Touch Input: Tap, swipe, scroll, pinch zoom, multi-tap gestures
Text Input: Type, clear, select all, set text in input fields
System Keys: Press BACK, HOME, ENTER, VOLUME, etc.
App Management: Launch, install, force stop, clear data
Clipboard: Get and set clipboard content
Device Control: Rotate screen, get device info
Logs: Access logcat with filters and log levels
Wait & Assert: Wait for elements, UI stability, assertions for testing
Safe Interactions: Tap avoiding system bars, element bounds detection
Related MCP server: autoglm-mcp-server
Requirements
Node.js 18+
ADB (Android Debug Bridge) installed
One of the following:
Android Studio Emulator (AVD)
Redroid (Docker-based Android)
Genymotion
Physical Android device via USB/WiFi
Installation
From npm (Recommended)
npm install -g mcp-android-emulatorFrom source
git clone https://github.com/Anjos2/mcp-android-emulator.git
cd mcp-android-emulator
npm install
npm run buildQuick Start
1. Ensure ADB is working
adb devices
# Should show your device/emulator2. Add to Claude Code
claude mcp add android-emulator -- npx mcp-android-emulator3. Start using
Ask Claude: "Take a screenshot of the Android device"
Configuration
Environment Variables
Variable | Default | Description |
|
| Path to ADB executable |
|
| Directory for temporary screenshots |
Claude Code Integration
Option 1: CLI command
claude mcp add android-emulator -- npx mcp-android-emulatorOption 2: Manual configuration
Edit ~/.claude.json:
{
"mcpServers": {
"android-emulator": {
"command": "npx",
"args": ["mcp-android-emulator"],
"env": {
"ADB_PATH": "/path/to/adb"
}
}
}
}Claude Desktop Integration
Add to claude_desktop_config.json:
{
"mcpServers": {
"android-emulator": {
"command": "npx",
"args": ["mcp-android-emulator"],
"env": {
"ADB_PATH": "/path/to/adb"
}
}
}
}Available Tools (40 tools)
Screen Capture & UI
Tool | Description |
| Capture screen as base64 PNG image |
| Get UI element hierarchy with coordinates |
| Get all visible text elements on screen (for debugging) |
| NEW Get all clickable elements with text/id/coordinates (useful when tap_text fails) |
| Get screen dimensions and density |
| Get info about currently focused element |
| Check if element is visible on screen |
| Get exact coordinates of an element |
| Assert text is visible (for testing) |
Touch Interactions
Tool | Description |
| Tap at specific coordinates |
| Find element by text and tap it |
| Tap element by text or resource-id (more reliable) |
| Tap avoiding system navigation bars |
| Double tap at coordinates |
| Long press for context menus |
| Multiple rapid taps at same position |
| Swipe between two points |
| Scroll in a direction (up/down/left/right) |
| Scroll until text is visible |
| Drag gesture for drag & drop |
| Pinch zoom gesture (zoom in/out) |
Text Input
Tool | Description |
| Type text into focused input |
| Clear focused text field |
| Select all text in focused field |
| Clear and type new text (combines both) |
| NEW Get current text value of focused input |
| NEW Check if soft keyboard is currently visible |
System & Keys
Tool | Description |
| Press system key (BACK, HOME, ENTER, etc.) |
| Rotate to portrait or landscape |
| Set text to device clipboard |
| Get clipboard content |
App Management
Tool | Description |
| Launch app by package name |
| Install APK file |
| List installed packages |
| Clear app data |
| Force stop an app |
| Get currently focused activity |
Device Info & Logs
Tool | Description |
| Get device model, Android version, screen size |
| Get logcat logs with filters and log levels |
Wait & Sync
Tool | Description |
| Wait for element with text to appear |
| Wait for element to disappear |
| Wait for UI to stop changing (after animations) |
Emulator Setup Guides
Option 1: Android Studio Emulator (AVD)
Best for: Local development on machines with display
# List available AVDs
emulator -list-avds
# Start emulator
emulator -avd YOUR_AVD_NAME
# Verify connection
adb devicesOption 2: Redroid (Docker) - Recommended for Servers
Best for: Headless servers, CI/CD, cloud VPS
Redroid runs Android in a Docker container without requiring KVM on x86.
# Run Redroid container
docker run -d --name redroid \
--privileged \
-p 5555:5555 \
redroid/redroid:13.0.0-latest \
androidboot.redroid_width=720 \
androidboot.redroid_height=1280 \
androidboot.redroid_dpi=320
# Connect ADB
adb connect localhost:5555
# Verify
adb devicesFor apps using network (React Native, Expo, etc.):
# Forward ports from device to host
adb reverse tcp:8081 tcp:8081 # Metro bundler
adb reverse tcp:3000 tcp:3000 # API serverOption 3: Genymotion
Best for: Local development, faster than AVD
Download from genymotion.com
Create and start a virtual device
Enable ADB bridge in settings
Connect:
adb connect localhost:5555
Option 4: Physical Device
Best for: Real-world testing
USB Connection:
Enable Developer Options on device
Enable USB Debugging
Connect via USB
Run
adb devices
WiFi Connection:
# First connect via USB, then:
adb tcpip 5555
adb connect DEVICE_IP:5555
# Disconnect USBRunning on Cloud/VPS Servers
Prerequisites
Linux server (Ubuntu 20.04+ recommended)
Docker installed
At least 4GB RAM, 2 CPU cores
Step-by-Step Setup
1. Install ADB
# Ubuntu/Debian
sudo apt update
sudo apt install android-tools-adb
# Verify
adb version2. Run Redroid
docker run -d --name redroid \
--privileged \
-p 5555:5555 \
redroid/redroid:13.0.0-latest \
androidboot.redroid_width=720 \
androidboot.redroid_height=1280 \
androidboot.redroid_dpi=3203. Connect ADB
adb connect localhost:5555
adb devices # Should show "localhost:5555 device"4. Install Node.js and MCP
# Install Node.js 18+
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt install -y nodejs
# Install MCP
npm install -g mcp-android-emulator5. Configure Claude Code
claude mcp add android-emulator -- npx mcp-android-emulatorRunning AVD Headless (Alternative)
If you have KVM support:
# Install Android SDK
sudo apt install openjdk-11-jdk
wget https://dl.google.com/android/repository/commandlinetools-linux-latest.zip
# ... setup SDK ...
# Run emulator headless
emulator -avd YOUR_AVD \
-no-window \
-no-audio \
-no-boot-anim \
-gpu swiftshader_indirect \
-memory 2048 \
-cores 2Usage Examples
Once configured, ask Claude to:
"Take a screenshot of the Android device"
"Tap on the Login button"
"Type 'hello@example.com' in the email field and press Enter"
"Scroll down until you see 'Submit' and tap it"
"Launch the Chrome app and navigate to google.com"
"Get error logs from the last 100 lines"
"Wait for the loading spinner to disappear, then take a screenshot"
"Check if 'Welcome' text is visible on screen"
"Rotate the device to landscape mode"Automated Testing Example
"Test the login flow:
1. Take a screenshot of the initial state
2. Type 'testuser' in the username field
3. Type 'password123' in the password field
4. Tap the Login button
5. Wait for the UI to stabilize
6. Assert that 'Dashboard' is visible
7. Take a final screenshot"Troubleshooting
ADB not found
# Check if ADB is installed
which adb
# If not found, install it
sudo apt install android-tools-adb # Ubuntu/Debian
brew install android-platform-tools # macOS
# Or set custom path
export ADB_PATH=/path/to/android-sdk/platform-tools/adbNo devices connected
# List devices
adb devices
# If using Redroid, connect explicitly
adb connect localhost:5555
# Check if emulator is fully booted
adb shell getprop sys.boot_completed # Should return "1"Permission denied on screenshots
mkdir -p /tmp/android-screenshots
chmod 755 /tmp/android-screenshotsRedroid container won't start
# Check logs
docker logs redroid
# Ensure privileged mode
docker run --privileged ...
# Try different Android version
docker run ... redroid/redroid:11.0.0-latestApps can't reach localhost services
# Forward ports from device to host
adb reverse tcp:8081 tcp:8081
adb reverse tcp:3000 tcp:3000
# Verify
adb reverse --listChangelog
See CHANGELOG.md for the full history.
v2.0.0 (Latest) — Security release
Eliminated command injection across the MCP tool surface (issue #1). The ADB execution layer was rebuilt on
child_process.execFile, and every LLM-controlled input now passes through strict zod allowlists before reaching the device shell.Dependencies pinned to exact versions (
npm auditclean).New
SECURITY.mdwith responsible disclosure policy.Breaking: stricter allowlists reject some inputs previously accepted. See CHANGELOG.md for migration notes.
v1.4.0
New tools:
get_clickable_elements- Get all clickable elements with text, resource-id, class, and coordinates. Useful whentap_textfails to find an element.
v1.3.0
New tools:
get_all_text- Get all visible text elements on screen (useful for debugging)is_keyboard_visible- Check if soft keyboard is currently visibleget_focused_input_value- Get current text value of focused input field
Improvements:
wait_for_ui_stable- Now uses UI fingerprint instead of raw XML comparison (more reliable)get_current_activity- Multi-method approach for compatibility with different emulators (AVD, Redroid, Genymotion, etc.)is_keyboard_visible- Multiple detection methods with fallbacks
v1.2.3
Updated documentation with comprehensive setup guides
Added emulator comparison (AVD, Redroid, Genymotion, Physical)
Added cloud/VPS deployment instructions
Added troubleshooting section
v1.2.2
Fixed
set_clipboardandget_clipboardfor Redroid/Docker compatibilityUses
/data/local/tmpas fallback path
v1.2.0
Added 14 new tools:
get_screen_size,is_element_visible,get_element_boundsscroll_to_text,wait_for_ui_stable,wait_for_element_gonemulti_tap,pinch_zoom,tap_safe,tap_elementset_clipboard,get_clipboard,rotate_deviceget_focused_element,assert_screen_contains
v1.1.0
Added
double_tap,drag,set_text,select_all,clear_input
v1.0.0
Initial release with core functionality
Development
# Clone repo
git clone https://github.com/Anjos2/mcp-android-emulator.git
cd mcp-android-emulator
# Install dependencies
npm install
# Build
npm run build
# Watch mode for development
npm run devLicense
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Ideas for contributions:
Support for multiple connected devices
Screen recording
File transfer (push/pull)
Network simulation
Battery/GPS simulation
Related Projects
Available Tools
42 toolsassert_screen_containsC
Assert that specific text is visible on screen (useful for testing)
Inputs: text (required), exact.
clear_app_dataC
Clear all data for an application
Inputs: package (required).
clear_inputA
Clear the currently focused text input field
Inputs: maxChars.
device_infoC
Get information about the connected device
Inputs: no named parameters.
double_tapC
Perform a double tap at the specified coordinates
Inputs: x (required), y (required).
dragA
Perform a drag gesture from one point to another (slower than swipe, for drag & drop)
Inputs: x1 (required), x2 (required), y1 (required), y2 (required), +1 more.
force_stopB
Force stop an application
Inputs: package (required).
get_all_textA
Get all visible text elements on screen (useful for debugging and verification)
Inputs: includeEmpty.
get_clickable_elementsA
Get all clickable elements on screen with their text, resource-id, and coordinates (useful when tap_text fails)
Inputs: includeDisabled.
get_clipboardA
Get the current device clipboard content
Inputs: no named parameters.
get_current_activityB
Get the currently focused activity/screen
Inputs: no named parameters.
get_element_boundsA
Get the exact bounds and center coordinates of an element
Inputs: text, index, resourceId.
get_focused_elementB
Get information about the currently focused UI element
Inputs: no named parameters.
get_focused_input_valueA
Get the current text value of the focused input field
Inputs: no named parameters.
get_logsB
Get device logs (logcat). Filtering is applied in-process, never on the device shell.
Inputs: level, lines, filter.
get_screen_sizeA
Get the screen dimensions and density of the device
Inputs: no named parameters.
get_ui_treeA
Get the UI element tree of the device (like DOM but for Android). Returns clickable elements with their coordinates.
Inputs: no named parameters.
install_apkA
Install an APK file on the device. Path must end in .apk and contain no shell metacharacters.
Inputs: path (required).
is_element_visibleB
Check if an element with specific text or resource-id is visible on screen
Inputs: text, resourceId.
is_keyboard_visibleA
Check if the soft keyboard is currently visible on screen
Inputs: no named parameters.
launch_appA
Launch an application by its package name (e.g., com.android.chrome). Package name is validated against the Android package naming convention.
Inputs: package (required).
list_packagesA
List installed packages on the device. Optional filter is applied in-process (JavaScript), never on the device shell.
Inputs: filter.
long_pressA
Perform a long press at the specified coordinates (useful for context menus)
Inputs: x (required), y (required), duration.
multi_tapB
Perform multiple rapid taps at the same position
Inputs: x (required), y (required), taps, interval.
pinch_zoomA
Perform a pinch zoom gesture (requires Android 8+)
Inputs: x (required), y (required), scale (required), duration.
press_keyA
Press a system key (BACK, HOME, ENTER, etc)
Inputs: key (required).
rotate_deviceA
Rotate the device to portrait or landscape orientation
Inputs: orientation (required).
screenshotA
Take a screenshot of the Android device/emulator and return it as a base64 image
Inputs: no named parameters.
scrollB
Scroll the screen in a direction
Inputs: direction (required), amount.
scroll_to_textA
Scroll the screen until an element with specific text is visible
Inputs: text (required), direction, maxScrolls.
select_allA
Select all text in the currently focused input field
Inputs: no named parameters.
set_clipboardA
Set text to the device clipboard. Text is transferred via adb push (binary transfer, no shell involvement, full Unicode support).
Inputs: text (required).
set_textA
Clear the current input field and type new text. Unicode is supported via URL-encoding. Shell metacharacters are rejected.
Inputs: text (required), maxClearChars.
swipeC
Perform a swipe gesture on the screen
Inputs: x1 (required), x2 (required), y1 (required), y2 (required), +1 more.
tapB
Tap at the specified coordinates on the screen
Inputs: x (required), y (required).
tap_elementA
Find and tap an element by text or resource-id (more reliable than tap_text)
Inputs: text, exact, index, resourceId.
tap_safeA
Tap at coordinates while avoiding system navigation bars
Inputs: x (required), y (required), avoidNavBar, avoidStatusBar.
tap_textA
Find an element by its text content and tap on it
Inputs: text (required), exact.
type_textA
Type text into the currently focused input field. Unicode is supported via URL-encoding. Shell metacharacters (; & | ` $ ( ) < > \ quotes) are rejected.
Inputs: text (required).
wait_for_elementB
Wait for a UI element with specific text to appear
Inputs: text (required), timeout.
wait_for_element_goneB
Wait for an element to disappear from the screen
Inputs: text (required), timeout.
wait_for_ui_stableA
Wait for the UI to stop changing (useful after animations)
Inputs: timeout, checkInterval.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 42 tools
There is heavy overlap among tap-related tools (tap, tap_text, tap_safe, tap_element, double_tap, multi_tap, long_press) and gesture tools (swipe, scroll, drag, scroll_to_text), making it easy for an agent to select the wrong one. UI inspection tools like get_ui_tree, get_clickable_elements, and get_all_text also have unclear boundaries despite their descriptions.
The vast majority of tools follow a clear snake_case verb_noun pattern such as get_ui_tree, launch_app, and force_stop. A few exceptions like screenshot and device_info break the pattern, but the overall convention is still predictable and readable.
42 tools is well above the threshold for a cohesive tool set. Many tools are minor variations of core actions—especially taps, gestures, and UI querying—so the count feels bloated rather than carefully scoped.
The tool set covers the core Android emulator workflow well: app lifecycle management, UI interaction, waiting/assertions, clipboard, logs, orientation, and keyboard handling. It is missing a few obvious operations like uninstalling an app, but agents can generally complete common automation tasks without dead ends.
Maintenance
Related MCP Connectors
Give your AI agent a real cloud Android phone: push APKs, drive it, get screenshots and logs.
Cloud Android phones for AI agents: create a phone, read the screen, tap, type, install APKs, park.
Let AI agents control Android and iOS devices on Mobilerun Cloud: screen, input, apps, workflows.
Disposable cloud Android emulators for coding agents: run an APK or PR build, tap, type, screenshot.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Android devices and emulators through ADB, allowing control actions like tapping, text input, screenshots, UI inspection, and app launching through natural language.14 npm8ISC
- AlicenseAqualityDmaintenanceEnables AI models to control Android devices via ADB through natural language commands, supporting screen analysis and automated actions.340 npmMIT
- AlicenseBqualityCmaintenanceEnables AI assistants to observe, reason about, and control connected Android devices via ADB, providing tools for screenshots, UI hierarchy parsing, semantic element clicking, gestures, text input, and app lifecycle management.13MIT
- AlicenseAqualityCmaintenanceEnables AI agents to control, inspect, and automate Android devices, Waydroid containers, and AVD emulators over ADB. Provides tools for screenshots, UI-hierarchy text-based tapping, gestures, key presses, text input, app management, and raw shell commands.12MIT