DroidRun MCP Server

DroidRun MCP Server

Enables text-based control of Android devices through Claude Code using accessibility tree automation. Supports UI interaction, app launching, text input, gestures, and navigation without requiring screenshots.

Category
访问服务器

README

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)

sudo apt update
sudo apt install adb

macOS

brew install android-platform-tools

Windows

Download from Android SDK Platform Tools and add to PATH.


Step 2: Enable USB Debugging on Android

  1. Go to Settings > About Phone
  2. Tap Build Number 7 times to enable Developer Options
  3. Go back to Settings > System > Developer Options
  4. Enable USB Debugging
  5. Connect your device via USB
  6. Accept the "Allow USB debugging" prompt on your phone

Verify connection:

adb devices

You should see your device listed.


Step 3: Install DroidRun

pip install droidrun

Install DroidRun Portal App on Device

Run the setup command to install the Portal app on your Android device:

droidrun setup

This will:

  1. Download the DroidRun Portal APK
  2. Install it on your connected device
  3. Open the Accessibility Settings

Enable Accessibility Service

After droidrun setup, you need to manually enable the accessibility service:

  1. The Accessibility Settings will open automatically
  2. Find DroidRun Portal in the list
  3. Tap on it and enable the service
  4. Confirm any permission dialogs

You can verify the setup worked:

droidrun test

Step 4: Install This MCP Server

Clone the repository

git clone https://github.com/chukfinley/droidrun-mcp-server.git
cd droidrun-mcp-server

Install dependencies

pip install droidrun mcp

Step 5: Configure Claude Code

Add the MCP server to your Claude Code configuration.

Edit ~/.claude.json and add under mcpServers:

{
  "mcpServers": {
    "droidrun": {
      "type": "stdio",
      "command": "python3",
      "args": ["/full/path/to/droidrun-mcp-server/server.py"],
      "env": {}
    }
  }
}

Important: Use the full absolute path to server.py!

Example:

{
  "mcpServers": {
    "droidrun": {
      "type": "stdio",
      "command": "python3",
      "args": ["/home/youruser/droidrun-mcp-server/server.py"],
      "env": {}
    }
  }
}

Restart Claude Code

claude

Available Tools

Tool Description
device_info() Get device model, Android version, and serial
ui() Get current screen UI elements as indexed list
tap(index) Tap element by index number from ui() output
tap_xy(x, y) Tap screen at specific coordinates
swipe(direction) Swipe up/down/left/right
text(content) Input text (optionally tap element first)
back() Press Android back button
home() Press Android home button
enter() Press Enter key
app(package) Open app by package name
apps() List installed apps (non-system)

Usage Example

Once configured, you can ask Claude Code to control your Android device:

> Open the Settings app and go to About Phone

Claude will:
1. Call app("com.android.settings")
2. Call ui() to see the screen
3. Call tap() on the appropriate elements
4. Navigate to About Phone

Example ui() output:

APP: Settings (com.android.settings)
KEYBOARD: hidden
FOCUS: none

1. TextView: "Network & internet" - (0,200,1080,300)
2. TextView: "Connected devices" - (0,300,1080,400)
3. TextView: "Apps" - (0,400,1080,500)
4. TextView: "About phone" - (0,900,1080,1000)

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"

# Check if device is connected
adb devices

# If not listed, try:
adb kill-server
adb start-server
adb devices

"Portal is not installed"

droidrun setup

"Accessibility service not enabled"

  1. Go to Settings > Accessibility
  2. Find DroidRun Portal
  3. Enable the service

Or run droidrun setup again - it will open the settings for you.

MCP server not showing in Claude Code

  1. Check your ~/.claude.json configuration
  2. Ensure the path to server.py is absolute (starts with /)
  3. Restart Claude Code completely after config changes

"Permission denied" errors

Make sure server.py is executable:

chmod +x server.py

Quick Start Summary

# 1. Install ADB
sudo apt install adb  # Linux

# 2. Enable USB debugging on your Android device

# 3. Connect device and verify
adb devices

# 4. Install DroidRun
pip install droidrun

# 5. Setup Portal app on device
droidrun setup

# 6. Enable accessibility service on device (manual step!)

# 7. Clone this repo
git clone https://github.com/chukfinley/droidrun-mcp-server.git

# 8. Install dependencies
pip install droidrun mcp

# 9. Add to ~/.claude.json (see Step 5 above)

# 10. Restart Claude Code
claude

License

MIT

Credits

  • DroidRun - Android automation framework
  • MCP - Model Context Protocol by Anthropic

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选