scrcpy-mcp
scrcpy-mcp
Part of the HeLa MCP Ecosystem — This server is HeLa Receptor (
hela-receptor) — the Mobile component of the HeLa cellular architecture. See the ecosystem docs for profiles, workflows, and multi-client setup.
MCP server for Android device control via ADB and scrcpy. Gives AI agents vision and control over Android devices.

Requirements
Node.js >= 22
ADB on PATH (or set
ADB_PATH)scrcpy-server.jar (v3.x or v4.x) — ships with scrcpy
ffmpeg — for H.264 decode and screenshots (optional,
ffmpeg-staticnpm dep available)ffplay — for live video viewer (optional)
Install
npm install
npm run buildRun
node dist/server.jsOr with npx:
npx @modelcontextprotocol/inspector node dist/server.jsMCP Configuration
Add to your MCP client config:
{
"mcpServers": {
"scrcpy": {
"command": "node",
"args": ["/path/to/scrcpy-mcp/dist/server.js"],
"env": {
"SCRCPY_SERVER_PATH": "/usr/local/lib/scrcpy-v4.0/scrcpy-server"
}
}
}
}Tools
Session
Tool | Action |
| Start scrcpy session for fast input/screenshots (10-50x faster). Pushes server, sets up ADB forward tunnel, connects video+control sockets. Idempotent. |
| Stop session, fall back to ADB commands |
| Report scrcpy version and resolution source (env/binary/default) |
Device
Tool | Action |
| List connected devices with state and model |
| Model, Android version, SDK, screen size, battery |
| Wake screen (scrcpy power message or KEYCODE_WAKEUP) |
| Turn screen off |
| Enable Wi-Fi ADB and connect wirelessly |
| Disconnect wireless ADB |
| Rotate screen (needs active session) |
| Expand notification panel |
| Expand quick settings |
| Collapse all panels |
Vision
Tool | Action |
| Capture screen. Returns scrcpy frame (JPEG) when session active, |
| Start |
| Stop and optionally pull recording to host |
Input

Coordinate tools accept native display coordinates matching ui_dump bounds.
Tool | Action |
| Tap at (x, y). scrcpy fast path -> ADB fallback. |
| Swipe from (x1,y1) to (x2,y2) with duration |
| Long press at (x, y) with duration |
| Drag from (x1,y1) to (x2,y2). Uses |
| Type text. Reports screen state, current app, session status. Auto-wakes screen if off. Auto-focuses input field. When |
| Send key event by name (HOME, BACK, ENTER, etc.) or keycode |
| Scroll at position with dx/dy delta |
App Management
Tool | Action |
| Launch app by package name. Prefix with |
| Force-stop app |
| Install APK from host path |
| Uninstall by package name |
| List installed packages with optional |
| Get foreground app package and activity |
Clipboard
Tool | Action |
| Read clipboard. scrcpy GET_CLIPBOARD (Android 10+) -> ADB with multiple parsing strategies. |
| Set clipboard text. Optional |
UI

All UI tools use uiautomator dump --compressed under the hood.
Tool | Action |
| Raw UI hierarchy XML |
| Find elements by text, resource-id, class, or content-desc. |
| Find element and tap it |
| Token-efficient Markdown-like tree showing clickable elements and text |
| Poll UI until element appears or timeout (default 15s) |
| Find element -> tap -> type text -> optional ENTER in one call |
Shell
Tool | Action |
| Run arbitrary ADB shell command |
File
Tool | Action |
| Copy file from host to device |
| Copy file from device to host |
| List directory with permissions, owner, size, date |
Video Streaming
Tool | Action |
| Start HTTP MJPEG stream at |
| Stop stream and close viewer |
Environment Variables
Variable | Default | Purpose |
|
| ADB executable path |
| — | Default device serial |
|
| Override scrcpy server version |
| auto-detect | Path to scrcpy-server.jar |
| ffmpeg-static or system | ffmpeg binary |
|
| ffplay binary |
Architecture
src/
server.ts — MCP server init, StdioServerTransport
core/
adb.ts — ADB abstraction layer
constants.ts — Protocol constants, defaults
scrcpy.ts — Session lifecycle, control messages, video pipeline
mjpeg.ts — HTTP MJPEG stream server
tools/
session.ts — start_session, stop_session, version
device.ts — device info, screen, rotation, panels, Wi-Fi
vision.ts — screenshot, screen recording
input.ts — tap, swipe, input_text, key_event, scroll, drag
apps.ts — app lifecycle and listing
clipboard.ts — clipboard get/set
ui.ts — UI hierarchy dump and element search
shell.ts — arbitrary ADB shell
files.ts — file push/pull/list
video.ts — MJPEG stream controlScrcpy sessions
Two sockets per session: video (raw H.264 from device encoder) and control (binary control messages). ffmpeg decodes H.264 to MJPEG frames in memory for screenshots and the HTTP stream. When video is unavailable (no encoder), control tools and ADB fallback still work.
Coordinate spaces
Callers use native display coordinates (matches wm size and ui_dump bounds). The input system scales these into the downscaled encoder frame size before sending over scrcpy. Without a session, coordinates pass directly to adb shell input tap.
Device Requirements
USB debugging enabled
ADB authorized (one-time screen tap)
Screen can be dead/broken after authorization
Wireless:
connect_wifienables TCP mode and connects
License
MIT