ADB MCP Server
Allows AI assistants to control Android devices via ADB, providing capabilities for device information, screen control, input simulation, app management, shell execution, file transfer, and UI parsing.
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., "@ADB MCP Server check device info"
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.
English · 简体中文
ADB MCP Server
通过 MCP 协议控制 Android 设备
20 个工具 · MCP 标准协议 · Node ≥ 18 · MIT
为 AI 助手(如 Claude)提供完整的 ADB 操作能力:设备信息、屏幕、输入、应用、Shell、文件、UI 解析,七大类一应俱全。
功能特性
设备信息 — 获取型号、Android 版本、屏幕分辨率、电池状态、IP、序列号
屏幕控制 — 截图、获取屏幕尺寸
输入模拟 — 点击、滑动、输入文本、按键事件(HOME/BACK/音量等)
应用管理 — 列出/查看/启动/停止应用、获取前台应用
Shell 执行 — 执行任意 ADB Shell 命令、Termux 命令(需确认)
文件传输 — 从设备拉取文件到本地
UI 解析 — 获取界面元素树、按文本定位并点击
Related MCP server: scrcpy-mcp
⌨️ 快速开始
# 1. 安装依赖
npm install
# 2. 构建
npm run build
# 3. 配置 MCP
# 将 opencode.json 中的 mcpServers.adb 配置添加到你的 MCP 客户端
# 4. 运行
npm start日常手感:npm install → npm run build → npm start
⚙️ 配置
在 MCP 客户端中添加以下配置(以 opencode 为例):
{
"mcpServers": {
"adb": {
"command": "node",
"args": ["path/to/adb-mcp-server/dist/index.js"],
"env": {
"ADB_PATH": "C:\\Users\\<username>\\AppData\\Local\\Android\\platform-tools\\adb.exe",
"ADB_SCREENSHOT_DIR": "path/to/screenshots"
}
}
}
}环境变量
变量 | 说明 | 默认值 |
|
| 自动检测 |
| 截图文件保存目录 |
|
🧰 工具列表
设备信息
工具 | 描述 |
| 获取设备信息:型号、Android 版本、屏幕、电池、IP、序列号 |
| 获取电池电量、充电状态、温度、健康度 |
| 读取剪贴板内容(Android 10+) |
屏幕
工具 | 描述 |
| 截图,支持返回文件路径或 base64 |
| 获取屏幕分辨率 |
输入
工具 | 描述 |
| 在指定坐标点击 |
| 从 (x1,y1) 滑动到 (x2,y2),支持设置持续时间 |
| 输入文本(自动选择 ASCII 直输或 Unicode 剪贴板方案) |
| 发送按键事件(HOME、BACK、ENTER、音量等 60+ 按键) |
应用管理
工具 | 描述 |
| 列出已安装应用,支持按关键字、类型(用户/系统/全部)筛选 |
| 获取应用详情:版本、SDK 目标、安装时间、权限列表 |
| 启动应用,可指定 Activity |
| 强制停止应用 |
| 获取当前前台应用包名和 Activity |
Shell
工具 | 描述 | 需确认 |
| 执行 Android Shell 命令 | ✅ |
| 在 Termux bash 中执行命令 | ✅ |
文件
工具 | 描述 |
| 从设备拉取文件到本地 |
UI
工具 | 描述 |
| 获取界面无障碍元素树(含位置、可点击状态等) |
| 截图 + UI 树一站式观察屏幕 |
| 按文本查找 UI 元素并点击 |
使用示例
查看设备信息:
调用 adb_device_info 即可获取设备型号、Android 版本、屏幕参数、电池状态等。
输出示例:
- Model: Google Pixel 7
- Android: 14 (SDK 34)
- Screen: 1080x2400
- Battery: 85% (charging, 32.5°C)观察屏幕并点击:
1. 调用 adb_observe 获取当前屏幕截图(base64)+ UI 元素列表
2. AI 根据 UI 元素坐标,调用 adb_tap 或 adb_tap_text 进行操作截图:
调用 adb_screenshot,截图自动保存到 ADB_SCREENSHOT_DIR🧱 环境依赖
运行时
依赖 | 版本 | 说明 |
>= 18 | JavaScript 运行环境 | |
| ^1.6.1 | MCP 协议服务端 SDK |
| ^3.23.8 | 输入参数模式校验 |
开发
依赖 | 版本 | 说明 |
| ^5.7.2 | TypeScript 编译器 |
| ^4.19.2 | TypeScript 开发热重载 |
| ^22.10.0 | Node.js 类型定义 |
系统
需求 | 说明 |
ADB | Android Debug Bridge,详见安装 ADB |
Android 设备 | 通过 USB 连接,开启开发者选项和 USB 调试;或使用 Android 模拟器 |
Termux(可选) | 用于 |
安装 ADB
Windows 用户可直接运行项目根目录的 setup-adb.ps1 脚本一键安装:
.\setup-adb.ps1该脚本会依次尝试 winget 安装和手动下载安装。
其他方式:
Android Developer 官网 下载 Platform Tools
macOS:
brew install android-platform-toolsLinux:
apt install adb或pacman -S android-tools
🗂 仓库地图
src/
├── index.ts 服务器入口
├── services/
│ ├── adb.ts ADB 命令执行核心
│ └── ui-parser.ts 界面元素树解析
└── tools/
├── device.ts 设备信息
├── screen.ts 截图与屏幕
├── input.ts 输入模拟
├── app.ts 应用管理
├── shell.ts Shell 执行
├── file.ts 文件传输
└── ui.ts UI 观察🔒 安全说明
Shell 需确认 —— adb_shell 和 adb_termux_exec 必须显式设置 confirm=true 才能执行,防止误操作。
按键白名单 —— 按键事件走白名单机制,仅允许安全的系统按键(无电源键、重启等危险按键)。
长度限制 —— 文本输入限制 500 字符。
许可证
MIT
Available Tools
20 toolsadb_app_infoGet App InfoARead-onlyIdempotent
Get version, SDK, install date, permissions for an installed app.
Inputs: package_name (required), response_format.
adb_app_launchLaunch AppA
Launch an app by package name. Optionally specify an activity.
Inputs: package_name (required), activity.
adb_app_stopStop AppA
Force-stop an app by package name.
Inputs: package_name (required).
adb_batteryGet Battery StatusARead-onlyIdempotent
Get battery level, charging status, and temperature.
Inputs: response_format.
adb_clipboardGet Device Clipboard ContentARead-onlyIdempotent
Get clipboard text (Android 10+).
Inputs: no named parameters.
adb_current_appGet Current Foreground AppARead-onlyIdempotent
Get the package name and activity of the foreground app.
Inputs: no named parameters.
adb_device_infoGet Android Device InfoBRead-onlyIdempotent
Get device model, Android version, screen, battery, IP, and serial.
Inputs: response_format.
adb_keyeventSend Key EventA
Send a safe key event (HOME, BACK, ENTER, etc.). Allowed: navigation, editing, media, alphanumeric keys.
Inputs: key (required).
adb_list_packagesList Installed PackagesARead-onlyIdempotent
List installed packages, filterable by keyword and type (user/system/all).
Inputs: filter, type, limit, response_format.
adb_observeObserve Screen (Screenshot + UI Tree)ARead-only
Take screenshot (base64) + UI tree in one call. Recommended for "looking" at the screen.
Inputs: max_elements.
adb_pullPull File from DeviceARead-only
Copy a file from device to local computer.
Inputs: remote_path (required), local_dir.
adb_screenshotTake ScreenshotARead-only
Take screenshot, returns file path or base64.
Inputs: filename, response_format.
adb_screen_sizeGet Screen SizeARead-onlyIdempotent
Get screen resolution in pixels.
Inputs: no named parameters.
adb_shellExecute Android Shell CommandADestructive
Execute an Android shell command. ⚠️ Requires confirm=true.
Inputs: command (required), confirm (required), timeout.
adb_swipeSwipe on ScreenA
Swipe from (x1,y1) to (x2,y2) with optional duration (ms).
Inputs: x1 (required), y1 (required), x2 (required), y2 (required), +1 more.
adb_tapTap Screen at CoordinatesB
Tap screen at pixel coordinates (x, y).
Inputs: x (required), y (required).
adb_tap_textTap UI Element by TextA
Find UI element by text/ID/content-desc and tap its center. Regex partial match.
Inputs: text (required), type, wait_ms.
adb_termux_execExecute Command in TermuxADestructive
Execute a command in Termux bash. ⚠️ Requires confirm=true.
Inputs: command (required), confirm (required), timeout.
adb_textInput TextA
Type text into focused input. ASCII via key injection, Unicode via clipboard paste (Android 10+).
Inputs: text (required), method.
adb_ui_treeGet UI Element TreeARead-only
Get UI element tree (accessibility dump) with bounding boxes and positions.
Inputs: response_format, max_elements.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Each tool targets a distinct ADB operation: app lifecycle, device info, input simulation, file transfer, and UI inspection. Even similar tools like adb_tap and adb_tap_text are clearly differentiated by targeting method (coordinates vs. element search). There is no ambiguity between tools.
All tools follow the consistent pattern 'adb_' + descriptive snake_case noun or verb_noun. Examples: adb_app_info, adb_app_launch, adb_screenshot. No mixing of styles or vague prefixes.
The 20 tools cover a comprehensive but focused set of ADB capabilities for mobile automation. The count is appropriate for the domain—neither sparse nor bloated. Each tool serves a clear purpose without redundancy.
Core workflows like app info/launch/stop, UI interaction (tap, swipe, text, key events), screenshots, and device info are covered. Missing common operations like file push, app install/uninstall, and logcat, but the set is sufficient for typical UI automation tasks.
Related MCP Connectors
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP server for building and testing AI agents with multi-model experimentation and insights.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA MCP server that enables LLMs to control Android devices via ADB, supporting input, UI hierarchy, device management, and shell commands.16MIT
- AlicenseAqualityCmaintenanceMCP server that gives AI agents full vision and control over Android devices via ADB and scrcpy. Supports screenshots, input, apps, UI automation, shell, files, and clipboard.38389 npm136MIT
- FlicenseNot gradedqualityDmaintenanceA powerful MCP server that provides comprehensive Android device automation capabilities through ADB, enabling AI agents to interact with Android devices for testing, automation, and device control tasks.1-
- AlicenseNot gradedqualityDmaintenanceAn MCP server that wraps Android ADB functionality into AI assistant tools, enabling device management, shell execution, file operations, app management, media capture, and log analysis via natural language.23 npm3MIT