Provides text-based control of Android devices through the accessibility tree, enabling UI interaction, app launching, navigation, text input, and gesture control via ADB without requiring screenshots.
DroidRun MCP Server
A text-based MCP (Model Context Protocol) server for controlling Android devices from Claude Code. Pure accessibility tree automation - no screenshots needed.
Features
Text-based UI interaction - Read and interact with Android UI elements using accessibility tree
No screenshots required - Faster and more efficient than vision-based approaches
Simple indexed tapping - Elements are numbered for easy interaction
Full device control - Navigate, type, swipe, and launch apps
Prerequisites
Android device with USB debugging enabled
Python 3.10+
ADB (Android Debug Bridge) installed on your computer
Claude Code CLI installed
Step 1: Install ADB
Linux (Ubuntu/Debian)
macOS
Windows
Download from Android SDK Platform Tools and add to PATH.
Step 2: Enable USB Debugging on Android
Go to Settings > About Phone
Tap Build Number 7 times to enable Developer Options
Go back to Settings > System > Developer Options
Enable USB Debugging
Connect your device via USB
Accept the "Allow USB debugging" prompt on your phone
Verify connection:
You should see your device listed.
Step 3: Install DroidRun
Install DroidRun Portal App on Device
Run the setup command to install the Portal app on your Android device:
This will:
Download the DroidRun Portal APK
Install it on your connected device
Open the Accessibility Settings
Enable Accessibility Service
After droidrun setup, you need to manually enable the accessibility service:
The Accessibility Settings will open automatically
Find DroidRun Portal in the list
Tap on it and enable the service
Confirm any permission dialogs
You can verify the setup worked:
Step 4: Install This MCP Server
Clone the repository
Install dependencies
Step 5: Configure Claude Code
Add the MCP server to your Claude Code configuration.
Edit ~/.claude.json and add under mcpServers:
Important: Use the full absolute path to server.py!
Example:
Restart Claude Code
Available Tools
Tool | Description |
| Get device model, Android version, and serial |
| Get current screen UI elements as indexed list |
| Tap element by index number from |
| Tap screen at specific coordinates |
| Swipe up/down/left/right |
| Input text (optionally tap element first) |
| Press Android back button |
| Press Android home button |
| Press Enter key |
| Open app by package name |
| List installed apps (non-system) |
Usage Example
Once configured, you can ask Claude Code to control your Android device:
Example ui() output:
Then Claude taps element 4: tap(4)
How It Works
This MCP server wraps the DroidRun library to provide Android device control through Claude Code. It uses the Android accessibility tree (not screenshots) for UI detection, making it fast and reliable.
The DroidRun Portal app runs on your Android device and provides:
Accessibility service for UI tree extraction
Numbered overlay for visual feedback (optional)
Input method for text entry
Troubleshooting
"No Android device connected"
"Portal is not installed"
"Accessibility service not enabled"
Go to Settings > Accessibility
Find DroidRun Portal
Enable the service
Or run droidrun setup again - it will open the settings for you.
MCP server not showing in Claude Code
Check your
~/.claude.jsonconfigurationEnsure the path to
server.pyis absolute (starts with/)Restart Claude Code completely after config changes
"Permission denied" errors
Make sure server.py is executable:
Quick Start Summary
License
MIT