
Scrcpy Mcp
io.github.JuanCF由 GitHub 账号 JuanCF 发布v0.5.0更新于 Nov 10, 2026
MCP server for Android device control via ADB and scrcpy
概览
本地 MCP 服务器,让 AI 助手通过 ADB 和 scrcpy 查看并操控已连接的 Android 设备:截图、点击、输入、应用、文件和 shell。
- 可以做什么
- 查看屏幕:返回图像的截图、屏幕录制,以及可返回点击坐标的 UI 层级导出与元素查找。
- 控制输入:点击、滑动、长按、拖拽、滚动、输入文本和发送按键事件。
- 管理应用:启动、强制停止、安装、卸载、列出应用包,并查看前台应用。
- 处理设备状态:列出和查看设备、点亮或关闭屏幕、旋转、展开通知与快捷设置面板,以及连接或断开无线 ADB。
- 执行 shell 与传输文件:运行任意 ADB shell 命令,推送、拉取和列出文件,读写剪贴板。
- 流式媒体:启动 MJPEG 视频流、把设备音频串流到主机,以及录制音频片段或文件。
- 适用场景
- 适合让助手实际操作或测试真实 Android 手机或模拟器的场景:走查应用流程、查看屏幕内容、自动化重复点击与文字输入,或拉取日志和文件。启用 scrcpy 会话可显著加快输入和截图,仅用 ADB 也能使用大多数交互工具。
- 运行要求
- 通过 npx 或全局 npm 安装以 stdio 在本地运行。需要 Node.js 24+、PATH 中可用的 ADB(或用 ADB_PATH 指定),以及开启 USB 调试并已接受 RSA 指纹提示的设备。可选安装 scrcpy 以获得快速路径,以及 ffmpeg/ffplay 用于视频流和音频。多设备连接时需设置 ANDROID_SERIAL;SCRCPY_SERVER_PATH 可指向非标准位置的 scrcpy-server。
安装
在 SourceWeft 中
- 打开 控制台中的 Scrcpy Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
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
- 44 tools covering screenshots, input, apps, UI automation, shell, files, clipboard, video streaming, and audio streaming/recording
- scrcpy-first: uses scrcpy's binary control protocol for 10-50x faster input and near-instant screenshots (~33ms)
- ADB fallback: interaction tools work without scrcpy — slower but always available (the audio tools
start_audio_stream/audio_record_startand the video stream require scrcpy) - 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 - Audio streaming & recording: stream device audio to host speakers (
start_audio_stream) or capture to.wav/.opus(audio_record_start) - Clipboard that works on Android 10+: scrcpy bypasses the restrictions that break ADB-only solutions
Prerequisites
Required
Optional (for enhanced performance)
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
MCP Client Configuration
Claude Code
Or add to .mcp.json in your project root:
OpenCode
Add to .mcp.json:
Cursor
Settings → MCP → Add Server:
Claude Desktop
Edit ~/.config/Claude/claude_desktop_config.json (Linux) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
VS Code (GitHub Copilot)
Add to .vscode/mcp.json:
Customizing Environment Variables
If you need to configure custom options (such as pointing to a non-standard scrcpy-server path), you can add the "env" object to your server configuration. For example:
Note: only set SCRCPY_SERVER_VERSION if version auto-detection fails — it overrides detection, so a stale value causes the version mismatch described in Troubleshooting. Match it to your installed scrcpy (scrcpy --version).
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
start_session options:
Both screen-awake options are temporary: scrcpy restores the device's original values when the session ends, including when a tool restarts the session to turn audio on.
Video Streaming
Audio Streaming & Recording
Heads up: Audio capture is opt-in and requires Android 11+. The default source
outputusesREMOTE_SUBMIX, which mutes the device's own speakers while capturing — the audio is moved to the host, not copied. UseaudioSource: "playback"withaudioDup: true(Android 13+) to keep the device audible. Recordings are saved on the host filesystem.
Device Management
Vision
Input Control
All input tools use scrcpy (~5-10ms) when a session is active, otherwise fall back to ADB (~100-300ms).
App Management
UI Automation
Shell & Files
Clipboard
Performance
Start a session once at the beginning to unlock the fast path:
Environment Variables
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. On Windows, add the folder containing both scrcpy.exe and scrcpy-server to your PATH, or set SCRCPY_SERVER_PATH to the full path of the scrcpy-server file.
- 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: The client must send the exact version of the
scrcpy-serverfile it pushes. To guarantee that, the server and the version are never resolved separately — one scrcpy install is resolved as a pair, and the version comes from the client belonging to that same install. The install is found in this order:SCRCPY_SERVER_PATHif set (its client is then located beside the server, or one prefix step away at../../bin/scrcpy); otherwise thescrcpyon your PATH, whose server is located beside it or at../share/scrcpy/scrcpy-server; otherwise whatever your package manager reports (dpkg,pacman,rpm,apk,brew). A symlinked client is resolved to its real directory before its counterpart is derived, so a link farm such as Homebrew'sbin/scrcpypairs with the install it points at rather than with the link's own directory.SCRCPY_SERVER_VERSIONoverrides the detected version if set. So on Windows, or when a GUI app launches the MCP without your shell PATH, pointingSCRCPY_SERVER_PATHat a server inside a complete scrcpy install is enough on its own, and it wins even if a different scrcpy comes first on your PATH — note that reading the version runs that install's executable, so pointSCRCPY_SERVER_PATHonly at an install you trust (the same trust the server file itself already requires, since it gets pushed to your device and executed there). If no client can be found for the resolved server (for example a lonescrcpy-serverdownloaded from the releases page), the client falls back to the default version and the server may exit with a version-mismatch error; setSCRCPY_SERVER_VERSIONto your installed version (e.g.,"4.1"). Run theversiontool to see which version is in use and where it was resolved from. See the Environment Variables table above.
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.
The device screen keeps turning off during long automations
Start the session with stayAwake: true (plugged in only) or screenOffTimeout: <seconds>, which also works on battery. Both are restored when the session ends.
start_audio_stream says ffplay was not found
Install ffmpeg (ffplay ships with it), or set FFPLAY_PATH to the binary. The same applies to audio_record_start and FFMPEG_PATH.
Audio recording is silent
REMOTE_SUBMIX only captures what apps are actually playing — a recording made while nothing plays is digital silence, which is expected. Also check the device is not muted, and remember the default output source moves the audio to the host, so the device goes quiet while capturing. Use audioSource: "playback" with audioDup: true (Android 13+) to keep it audible.
Audio tools report audio as unavailable Audio capture needs Android 11+ (SDK 30). On older devices the session still works for video, input, and clipboard.
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
来源:README.md,提交 5f93d15
工具
0版本历史
1- v0.5.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分