io.github.JuanCF/scrcpy-mcp
平台与服务by juancf
通过 ADB 与 scrcpy 控制 Android 设备的 MCP server,支持常见调试与交互操作。
什么是 io.github.JuanCF/scrcpy-mcp?
通过 ADB 与 scrcpy 控制 Android 设备的 MCP server,支持常见调试与交互操作。
README
scrcpy-mcp
MCP server that gives AI agents full vision and control over Android devices via ADB and scrcpy.
Connect any MCP-compatible AI assistant (Claude Code, OpenCode, Cursor, VS Code Copilot, etc.) to your Android device. The AI can see the screen, tap, swipe, type, launch apps, inspect UI elements, transfer files, and run shell commands.
Features
- 36 tools covering screenshots, input, apps, UI automation, shell, files, clipboard, and video streaming
- scrcpy-first: uses scrcpy's binary control protocol for 10-50x faster input and near-instant screenshots (~33ms)
- ADB fallback: every tool works without scrcpy — slower but always available
- Image-returning screenshots: the AI actually sees the screen, not just a file path
- UI element finding:
ui_find_elementreturns tap coordinates so the AI can act on what it sees - Clipboard that works on Android 10+: scrcpy bypasses the restrictions that break ADB-only solutions
Prerequisites
Required
| Requirement | Install | Verify |
|---|---|---|
| Node.js 22+ | nodejs.org or nvm install (uses .node_version) | node --version |
| ADB (Android Platform Tools) | developer.android.com/tools/releases/platform-tools | adb version |
| Android device with USB debugging | Settings → Developer Options → USB Debugging | adb devices |
Optional (for enhanced performance)
| Requirement | Install | Benefit |
|---|---|---|
| scrcpy | github.com/Genymobile/scrcpy | 10-50x faster input, ~33ms screenshots |
| ffmpeg | apt install ffmpeg / brew install ffmpeg | Required for scrcpy video stream decoding |
Device setup
- Enable Developer Options: Settings → About Phone → tap "Build Number" 7 times
- Enable USB Debugging: Settings → Developer Options → USB Debugging
- Connect device via USB
- Accept the RSA fingerprint prompt on the device
- Verify:
adb devicesshould show your device asdevice(notunauthorized)
Installation
# Run directly with npx (no install needed)
npx scrcpy-mcp
# Or install globally
npm install -g scrcpy-mcp
MCP Client Configuration
Claude Code
claude mcp add android -- npx scrcpy-mcp
Or add to .mcp.json in your project root:
{
"mcpServers": {
"android": {
"command": "npx",
"args": ["scrcpy-mcp"]
}
}
}
OpenCode
Add to .mcp.json:
{
"mcpServers": {
"android": {
"command": "npx",
"args": ["scrcpy-mcp"]
}
}
}
Cursor
Settings → MCP → Add Server:
{
"android": {
"command": "npx",
"args": ["scrcpy-mcp"]
}
}
Claude Desktop
Edit ~/.config/Claude/claude_desktop_config.json (Linux) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"android": {
"command": "npx",
"args": ["scrcpy-mcp"]
}
}
}
VS Code (GitHub Copilot)
Add to .vscode/mcp.json:
{
"servers": {
"android": {
"command": "npx",
"args": ["scrcpy-mcp"]
}
}
}
Customizing Environment Variables
If you need to configure custom options (such as pointing to a non-standard scrcpy-server path or forcing a specific version), you can add the "env" object to your server configuration. For example:
{
"mcpServers": {
"android": {
"command": "npx",
"args": ["scrcpy-mcp"],
"env": {
"SCRCPY_SERVER_PATH": "C:\\path\\to\\scrcpy-server",
"SCRCPY_SERVER_VERSION": "3.3.4"
}
}
}
}
Note: On Windows, remember to double-escape backslashes (\\) in your configuration paths.
OpenCode users: OpenCode uses
"environment"instead of"env"for passing environment variables to MCP servers. Replace"env"with"environment"in the example above if you're configuring scrcpy-mcp inopencode.json.
Tool Reference
Session Management
| Tool | Description |
|---|---|
start_session | Start a scrcpy session. When active, input and screenshots use the fast path (10-50x faster). |
stop_session | Stop the scrcpy session. Tools fall back to ADB. |
Video Streaming
| Tool | Description |
|---|---|
start_video_stream | Start an HTTP MJPEG video stream and open an ffplay viewer window. Auto-starts a scrcpy session if needed. |
stop_video_stream | Stop the video stream and close the viewer window. |
Device Management
| Tool | Description |
|---|---|
device_list | List all connected devices with serial, state, and model |
device_info | Get model, Android version, screen size, SDK level, battery |
screen_on | Wake the device screen |
screen_off | Turn the screen off |
rotate_device | Rotate the screen (requires active session) |
expand_notifications | Pull down the notification panel (requires active session) |
expand_settings | Pull down the quick settings panel (requires active session) |
collapse_panels | Collapse notification/settings panels (requires active session) |
Vision
| Tool | Description |
|---|---|
screenshot | Capture the screen and return it as an image. ~33ms with scrcpy, ~500ms via ADB. |
screen_record_start | Start recording the screen to a file on the device |
screen_record_stop | Stop recording and optionally pull the file to the host |
Input Control
All input tools use scrcpy (~5-10ms) when a session is active, otherwise fall back to ADB (~100-300ms).
| Tool | Description |
|---|---|
tap | Tap at screen coordinates |
swipe | Swipe from one point to another |
long_press | Long press at coordinates |
drag_drop | Drag from one point to another |
input_text | Type a text string into the focused field |
key_event | Send a key event: HOME, BACK, ENTER, VOLUME_UP, VOLUME_DOWN, POWER, etc. |
scroll | Scroll at a position (dx=horizontal, dy=vertical) |
App Management
| Tool | Description |
|---|---|
app_start | Launch an app by package name. Prefix with + to force-stop before launch. |
app_stop | Force-stop an app |
app_install | Install an APK from the host machine |
app_uninstall | Uninstall an app |
app_list | List installed packages, optionally filter by name or system/third-party |
app_current | Get the current foreground app and activity |
UI Automation
| Tool | Description |
|---|---|
ui_dump | Dump the full UI hierarchy as XML |
ui_find_element | Find elements by text, resource ID, class name, or content description. Returns tap coordinates. |
Shell & Files
| Tool | Description |
|---|---|
shell_exec | Execute an arbitrary ADB shell command and return the output |
file_push | Push a file from the host machine to the device |
file_pull | Pull a file from the device to the host machine |
file_list | List directory contents on the device |
Clipboard
| Tool | Description |
|---|---|
clipboard_get | Get clipboard content. Uses scrcpy to bypass Android 10+ restrictions. |
clipboard_set | Set clipboard content. Pass paste: true to also paste immediately. |
Performance
| Operation | scrcpy (session active) | ADB fallback |
|---|---|---|
| Screenshot | ~33ms | ~500ms |
| Tap / Swipe | ~5-10ms | ~100-300ms |
| Text input | ~5ms | ~100-300ms |
| Clipboard | ~10ms | unreliable on Android 10+ |
Start a session once at the beginning to unlock the fast path:
start_session → take screenshots → tap → swipe → ...
Environment Variables
| Variable | Default | Description |
|---|---|---|
ADB_PATH | adb | Path to the ADB binary |
ANDROID_SERIAL | (none) | Default device serial, overrides auto-detection |
SCRCPY_SERVER_PATH | (auto) | Path to the scrcpy-server binary |
SCRCPY_SERVER_VERSION | (auto) | Version of the scrcpy-server binary |
FFMPEG_PATH | ffmpeg | Path to the ffmpeg binary |
FFPLAY_PATH | ffplay | Path to the ffplay binary (for the video stream viewer) |
When only one device is connected, tools auto-detect it. With multiple devices, pass the serial parameter explicitly or set ANDROID_SERIAL.
Troubleshooting
adb devices shows unauthorized
Accept the RSA fingerprint prompt on the device. If the prompt doesn't appear, revoke USB debugging authorizations in Developer Options and reconnect.
start_session fails
Make sure scrcpy is installed and the scrcpy-server binary is accessible. Set SCRCPY_SERVER_PATH if it's in a non-standard location.
- File vs Directory: Ensure
SCRCPY_SERVER_PATHpoints directly to thescrcpy-serverfile itself (e.g.C:\path\to\scrcpy-server), NOT to its parent folder. - Android Directory Conflict: If you previously pushed a directory to the server path,
/data/local/tmp/scrcpy-server.jaron the Android device might have been created as a folder. Runadb shell rm -rf /data/local/tmp/scrcpy-server.jarto delete it. - Version Mismatch: Ensure
SCRCPY_SERVER_VERSIONmatches the exact version of thescrcpy-serverfile (e.g.,"3.3.4"). If they mismatch, the Android JVM will fail withjava.lang.ClassNotFoundException: com.genymobile.scrcpy.Server.
Screenshots are slow (~500ms)
Start a scrcpy session with start_session to enable the fast video stream path. Requires scrcpy and ffmpeg.
expand_notifications / expand_settings / collapse_panels fail
These tools require an active scrcpy session. Run start_session first.
Clipboard doesn't work on Android 10+ ADB clipboard access is restricted on Android 10+. Start a scrcpy session — the scrcpy clipboard protocol bypasses this restriction.
Multiple devices connected
Pass serial to each tool or set the ANDROID_SERIAL environment variable.
Security
This server provides full control over connected Android devices. The shell_exec tool can run arbitrary commands, and file_push/file_pull can read and write any file accessible to the shell user.
- The server runs locally over stdio — it is not exposed to the network
- ADB requires USB debugging to be explicitly enabled on the device
- The device must accept your host's RSA key on first connection
- Only connect devices you own and trust the AI agent you are using
License
MIT — see LICENSE
常见问题
io.github.JuanCF/scrcpy-mcp 是什么?
通过 ADB 与 scrcpy 控制 Android 设备的 MCP server,支持常见调试与交互操作。
相关 Skills
Slack动图
by anthropics
面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。
✎ 帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。
MCP构建
by anthropics
聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。
✎ 想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。
接口测试套件
by alirezarezvani
扫描 Next.js、Express、FastAPI、Django REST 的 API 路由,自动生成覆盖鉴权、参数校验、错误码、分页、上传与限流场景的 Vitest 或 Pytest 测试套件。
✎ 帮你把API与集成测试自动化跑顺,减少回归漏测;能力全面,尤其适合复杂接口场景的QA团队。
相关 MCP Server
Slack 消息
编辑精选by Anthropic
Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。
✎ 这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。
by netdata
io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。
✎ 这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。
by d4vinci
Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。
✎ 这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。