DroidMind
A Model Context Protocol (MCP) server that enables AI assistants to control and interact with Android devices, allowing for device management, app debugging, system analysis, and UI automation through natural language commands.
Tools
list_packages
List installed packages on the device. Args: serial: Device serial number include_system_apps: Whether to include system apps in the list Returns: Formatted list of installed packages
device_properties
Get detailed properties of a specific device. Args: serial: Device serial number Returns: Formatted device properties as text
install_app
Install an APK on the device. Args: serial: Device serial number apk_path: Path to the APK file (local to the server) reinstall: Whether to reinstall if app exists grant_permissions: Whether to grant all requested permissions Returns: Installation result message
uninstall_app
Uninstall an app from the device. Args: serial: Device serial number package: Package name to uninstall keep_data: Whether to keep app data and cache directories Returns: Uninstallation result message
start_app
Start an app on the device. Args: serial: Device serial number package: Package name to start activity: Optional activity name to start (if empty, launches the default activity) Returns: Result message
stop_app
Force stop an app on the device. Args: serial: Device serial number package: Package name to stop Returns: Result message
clear_app_data
Clear app data and cache for the specified package. Args: serial: Device serial number package: Package name to clear data for Returns: Result message
device_logcat
Get recent logcat output from a device. Args: serial: Device serial number lines: Number of recent lines to fetch (default: 1000, max recommended: 20000) Higher values may impact performance and context window limits. filter_expr: Optional filter expression (e.g., "ActivityManager:I *:S") Use to focus on specific tags or priority levels max_size: Maximum output size in characters (default: 100000) Set to None for unlimited (not recommended) Returns: Recent logcat entries
devicelist
List all connected Android devices. Returns: A formatted list of connected devices with their basic information.
connect_device
Connect to an Android device over TCP/IP. Args: ip_address: The IP address of the device to connect to port: The port to connect to (default: 5555) Returns: A message indicating success or failure
disconnect_device
Disconnect from an Android device. Args: serial: Device serial number Returns: Disconnection result message
reboot_device
Reboot the device. Args: serial: Device serial number mode: Reboot mode - "normal", "recovery", or "bootloader" Returns: Reboot result message
capture_bugreport
Capture a bug report from a device. Bug reports are comprehensive diagnostic information packages that include system logs, device state, running processes, and more. Args: serial: Device serial number ctx: MCP context output_path: Where to save the bug report (leave empty to return as text) include_screenshots: Whether to include screenshots in the report timeout_seconds: Maximum time to wait for the bug report to complete (in seconds) Returns: Path to the saved bug report or a summary of the report contents
dump_heap
Capture a heap dump from a running process on the device. Heap dumps are useful for diagnosing memory issues, leaks, and understanding object relationships in running applications. Args: serial: Device serial number ctx: MCP context package_or_pid: App package name or process ID to dump output_path: Where to save the heap dump (leave empty for default location) native: Whether to capture a native heap dump (vs Java heap) timeout_seconds: Maximum time to wait for the heap dump to complete (in seconds) Returns: Path to the saved heap dump or an error message
list_directory
List contents of a directory on the device. Args: serial: Device serial number path: Directory path to list Returns: Directory listing
push_file
Upload a file to the device. Args: serial: Device serial number local_path: Path to the local file device_path: Destination path on the device Returns: Upload result message
pull_file
Download a file from the device to the local machine. Args: serial: Device serial number device_path: Path to the file on the device local_path: Destination path on the local machine Returns: Download result message
delete_file
Delete a file or directory from the device. Args: serial: Device serial number path: Path to the file or directory to delete Returns: Deletion result message
create_directory
Create a directory on the device. Args: serial: Device serial number path: Path to the directory to create Returns: Result message
file_exists
Check if a file exists on the device. Args: serial: Device serial number path: Path to the file on the device Returns: True if the file exists, False otherwise
read_file
Read the contents of a file on the device. Args: serial: Device serial number device_path: Path to the file on device max_size: Maximum file size to read in bytes (default: 100KB) Files larger than this will return an error message instead Returns: File contents as text or error message
write_file
Write text content to a file on the device. Args: serial: Device serial number device_path: Path to the file on device content: Text content to write to the file Returns: Writing result message
screenshot
Get a screenshot from a device. Args: serial: Device serial number ctx: MCP context quality: JPEG quality (1-100, lower means smaller file size) Returns: The device screenshot as an image
shell_command
Run a shell command on the device. Args: serial: Device serial number command: Shell command to run max_lines: Maximum lines of output to return (default: 1000) Use positive numbers for first N lines, negative for last N lines Set to None for unlimited (not recommended for large outputs) max_size: Maximum output size in characters (default: 100000) Limits total response size regardless of line count Returns: Command output
tap
Tap on the device screen at specific coordinates. Args: serial: Device serial number x: X coordinate to tap y: Y coordinate to tap Returns: The result of the tap operation
swipe
Perform a swipe gesture from one point to another on the device screen. Args: serial: Device serial number start_x: Starting X coordinate start_y: Starting Y coordinate end_x: Ending X coordinate end_y: Ending Y coordinate ctx: Context duration_ms: Duration of the swipe in milliseconds (default: 300) Returns: The result of the swipe operation
input_text
Input text on the device. Args: serial: Device serial number text: Text to input (will be typed as if from keyboard) Returns: The result of the text input operation
press_key
Press a key on the device. Common keycodes: - 3: HOME - 4: BACK - 24: VOLUME UP - 25: VOLUME DOWN - 26: POWER - 82: MENU Args: serial: Device serial number keycode: Android keycode to press Returns: The result of the key press operation
start_intent
Start an app activity using an intent. Args: serial: Device serial number package: Package name (e.g., "com.android.settings") activity: Activity name (e.g., ".Settings") ctx: Context extras: Optional intent extras as key-value pairs Returns: The result of the intent operation
README
✨ DroidMind 🤖
<div align="center">
Control Android devices with AI through the Model Context Protocol
</div>
DroidMind is a powerful bridge between AI assistants and Android devices, enabling control, debugging, and system analysis through natural language. By implementing the Model Context Protocol (MCP), DroidMind allows AI models to directly interact with Android devices via ADB in a secure, structured way. When used as part of an agentic coding workflow, DroidMind can enable your assistant to build and debug with your device directly in the loop.
💫 Features
- 📱 Device Control - Connect to devices over USB or TCP/IP, run shell commands, reboot
- 📊 System Analysis - Inspect device properties, view hardware info, analyze system logs
- 🔍 File System Access - Browse directory contents and manage files on devices
- 📷 Visual Diagnostics - Capture device screenshots for analysis and debugging
- 📦 App Management - Install, uninstall, start, stop, and clear app data on connected devices
- 🔄 Multi-Device Support - Control and switch between multiple connected devices
- 👆 UI Automation - Interact with the device through taps, swipes, text input, and key presses
- 🔍 App Inspection - View app manifests, shared preferences, and app-specific logs
- 🔒 Security Framework - Protect devices with comprehensive command validation
- 💬 MCP Integration - Seamless connection to Claude, Cursor, Cline, and more
🚀 Installation
# Clone the repository
git clone https://github.com/hyperbliss/droidmind.git
cd droidmind
# Set up a virtual environment with UV
uv venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies with UV
uv sync
📋 Prerequisites
- Python 3.13 or higher
- Android device with USB debugging enabled
- ADB (Android Debug Bridge) installed and in PATH
- UV package manager (recommended for dependency management)
- For network control: Android device with ADB over TCP/IP enabled
🔮 Quick Start
Run the DroidMind server
Run DroidMind as a server to connect AI assistants via MCP:
# Start DroidMind as a network server
droidmind --transport sse
Using with AI Assistants
-
Start DroidMind in SSE mode:
droidmind --transport sse -
Connect your AI assistant using the MCP protocol URI:
sse://localhost:4256/sse -
The AI can now control your Android devices through natural language!
🛠️ Available MCP Resources and Tools
Resources
devices://list- List all connected devicesdevice://{serial}/properties- Get detailed device propertieslogs://{serial}/logcat- Get recent logs from the devicelogs://{serial}/anr- Get Application Not Responding (ANR) traceslogs://{serial}/crashes- Get application crash logslogs://{serial}/battery- Get battery statistics and historylogs://{serial}/app/{package}- Get application-specific logsfs://{serial}/list/{path}- List directory contents on the devicefs://{serial}/read/{path}- Read file contents from the devicefs://{serial}/stats/{path}- Get detailed file/directory statisticsapp://{serial}/{package}/manifest- Get AndroidManifest.xml contentsapp://{serial}/{package}/data- List files in the app's data directoryapp://{serial}/{package}/shared_prefs- Get app's shared preferences
Tools
devicelist- List all connected Android devicesdevice_properties- Get detailed properties of a specific devicedevice_logcat- Get recent logcat output from a devicelist_directory- List contents of a directory on the deviceconnect_device- Connect to a device over TCP/IPdisconnect_device- Disconnect from an Android deviceshell_command- Run a shell command on the deviceinstall_app- Install an APK on the deviceuninstall_app- Uninstall an app from the devicestart_app- Start an app on the devicestop_app- Force stop an app on the deviceclear_app_data- Clear app data and cachelist_packages- List installed packages on the deviceget_app_manifest- Get AndroidManifest.xml contents for an appget_app_permissions- Get permissions requested by an appget_app_activities- Get activities defined in an appget_app_info- Get detailed information about an appreboot_device- Reboot the device (normal, recovery, or bootloader)screenshot- Get a screenshot from a devicecapture_bugreport- Generate a comprehensive bug report from the devicedump_heap- Create a heap dump from a running process for memory analysispush_file- Upload a file to the devicepull_file- Download a file from the devicedelete_file- Delete a file or directory from the devicecreate_directory- Create a directory on the devicefile_exists- Check if a file exists on the deviceread_file- Read the contents of a file on the devicewrite_file- Write text content to a file on the devicefile_stats- Get detailed information about a file or directorytap- Tap on the device screen at specific coordinatesswipe- Perform a swipe gesture from one point to another on the screeninput_text- Input text on the device as if from a keyboardpress_key- Press a hardware or software key (e.g., HOME, BACK, VOLUME)start_intent- Start an app activity using an Android intent
📊 Example AI Assistant Queries
With an AI assistant connected to DroidMind, try these queries:
- "List all connected Android devices and show me their properties"
- "Connect to my phone at 192.168.1.100 and check its battery status"
- "Take a screenshot of my Pixel and show me what's currently on screen"
- "Check the available storage space on my device"
- "Show me the ANR traces and crash logs from my device"
- "Look at recent logs and tell me if there are any errors"
- "Install this APK file on my device and tell me if it was successful"
- "Show me a list of all installed apps on my phone"
- "Reboot my device into recovery mode"
- "What Android version is my phone running?"
- "Check if my device is rooted and tell me its security patch level"
- "Show me the manifest file for com.android.settings"
- "Check the shared preferences for my app"
- "Tap on the Settings icon at coordinates 500,1000"
- "Swipe down from the top of the screen to open the notification shade"
- "Input my password into the current text field"
- "Press the back button three times to return to the home screen"
- "Open the Settings app by starting the com.android.settings package"
🔒 Security Features
DroidMind includes a comprehensive security framework to protect your devices while still allowing AI assistants to be expressive:
- Command Validation: All shell commands are validated against an allowlist of safe commands
- Risk Assessment: Commands are categorized by risk level (SAFE, LOW, MEDIUM, HIGH, CRITICAL)
- Command Sanitization: Input is sanitized to prevent command injection attacks
- Protected Paths: System directories and critical paths are protected from modification
- Comprehensive Logging: All commands are logged with their risk level for auditing
- Suspicious Pattern Detection: Commands with potentially dangerous patterns are blocked
- ADB Command Security: Special handling for ADB-specific commands with proper async validation
The security system is designed to be permissive enough to allow common operations while preventing destructive actions. High-risk commands will display warnings to users before execution, and critical operations are blocked entirely without explicit override.
💻 Development
DroidMind uses UV for dependency management and development workflows. UV is a fast, reliable Python package manager and resolver.
# Update dependencies
uv sync
# Run tests
pytest
# Run linting
ruff check .
# Run type checking
mypy .
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Set up your development environment with UV
- Make your changes
- Run tests and linting
- Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📝 License
This project is licensed under the Apache License - see the LICENSE file for details.
<div align="center">
Created by Stefanie Jane 🌠
If you find DroidMind useful, buy me a Monster Ultra Violet ⚡️
</div>
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.