serve-droid
Enables streaming and control of Android devices via browser, with UI tree inspection, Logcat, and MCP tool integration for AI agents.
README
serve-droid
A shared browser cockpit and agent control plane for Android. Stream an emulator or physical device, control it from Chrome or Edge, inspect its semantic UI tree and Logcat, or hand the same session to an MCP-compatible coding agent.
Status: v0.1 development release. The public API is versioned, but video transport and device compatibility still need validation on the published support matrix.
npx serve-droid
# → Browser cockpit at a local authenticated URL

Deterministic documentation demo: live device stream, semantic UI tree, filtered Logcat, and human controls share the same session. This image is not real-device validation; hardware evidence is tracked separately in the release checklist.
What you get
- H.264 device streaming and control in a local browser cockpit.
- Exact semantic element targeting that stops on missing or ambiguous matches.
- Searchable, priority-filtered Logcat with pause, clear, and copy controls.
- Secure LAN token entry and bounded clipboard paste into the focused Android field.
- Drag and drop APK or file transfer with byte progress and an explicit Android processing phase.
- One bounded observation containing the screen, UI hierarchy, foreground app, device state, and incremental logs.
- The same capabilities through CLI, authenticated HTTP/WebSocket APIs, MCP, and an Agent Skill.
Why
Android Studio mirrors devices, scrcpy provides excellent native display/control, and Maestro is a strong test automation system. serve-droid focuses on a different loop: a human and an AI agent sharing one observable browser session during development and debugging.
Requirements
- Node.js 22 or newer
- Android SDK Platform Tools with
adbonPATH,ANDROID_HOME, orANDROID_SDK_ROOT - An Android 8 / API 26+ emulator or device visible in
adb devices -l - A current Chrome, Edge, Safari, or Firefox browser. Chromium uses WebCodecs; Safari and Firefox use the higher-cost TinyH264 software fallback.
Android Platform Tools are never downloaded silently or redistributed.
Quick start
npx serve-droid doctor
npx serve-droid avd list
npx serve-droid start --detach
npx serve-droid list --json
When selecting a fixed port, probe it before touching the device. Occupied ports return the stable
PORT_IN_USE code and exit status 31; --port 0 keeps safe ephemeral allocation.
npx serve-droid doctor --port 47321 --json
npx serve-droid start --port 47321
Device playback audio is opt-in and browser playback remains muted until a human enables it:
npx serve-droid start --audio
Open the printed local URL. The server listens on 127.0.0.1, generates a random token, and injects
it into the local UI. To select a device:
npx serve-droid --device emulator-5554
Installed emulators can be managed explicitly with serve-droid avd start <name> and
serve-droid avd stop <serial>. No SDK content is downloaded or licensed automatically; see the
AVD lifecycle guide.
To inspect several connected devices with independent tokens and bounded resources:
npx serve-droid grid --max-devices 4
See the multi-device grid security and isolation model.
Coordinates are normalized: (0, 0) is the logical top-left and (1, 1) is the bottom-right.
npx serve-droid tap 0.5 0.5
npx serve-droid swipe 0.5 0.8 0.5 0.2 --duration 350
npx serve-droid app deep-link 'servedroid://fixture/example'
Session capture is explicit and bounded. --record ./recordings stores the original H.264 stream
plus privacy-filtered event summaries; it never records tokens, Logcat, typed text, URLs, or file
contents. See the recording and retention guide.
MCP
{
"mcpServers": {
"serve-droid": {
"command": "npx",
"args": ["-y", "serve-droid", "mcp"]
}
}
}
The MCP surface deliberately provides explicit bounded tools instead of arbitrary shell access. See the MCP guide.
Security
- Loopback-only binding by default.
- Bearer authentication for reads, mutations, video, and control.
- Browser WebSockets carry credentials in a subprotocol header, not a URL.
- No arbitrary ADB or host shell endpoint.
- Uploads are capped at 256 MiB, written to a private temporary directory, and removed immediately.
clearanduninstallrequire explicit confirmation from non-interactive clients.
Read SECURITY.md before binding to a LAN interface.
Short-lived remote access through an existing named Cloudflare Tunnel is available only with explicit consent, HTTPS, bearer authentication, and a hard expiry. Read the tunnel threat model and setup guide before using it.
Supported and deferred
v0.1 targets macOS, Linux, Windows, Android API 26+, local emulators, USB devices, Wi-Fi ADB, Chrome, Edge, Safari, and Firefox. Installed AVD lifecycle controls, opt-in bounded local recording, the TinyH264 browser fallback, opt-in device audio for API 30+, and opt-in expiring named-tunnel support are included. Cloud device labs, accounts, multi-user roles, AVD creation/provisioning, iOS, and arbitrary shell access are deferred. See the browser support matrix.
Development
pnpm install
pnpm verify
pnpm --filter @serve-droid/cli dev -- doctor
The Android fixture source is under fixtures/android-test-app. Real-device tests run only when
SERVE_DROID_DEVICE_TEST=1 is set.
See the evidence-based release checklist for completed work and the remaining hardware, platform, and publication gates.
Project TODO
- [x] Publish the open repository with protected
main, CodeQL, Dependabot, and secret scanning. - [x] Ship the shared CLI, HTTP/WebSocket, MCP, Agent Skill, and browser cockpit foundation.
- [x] Add a reproducible, clearly labeled cockpit screenshot to this README.
- [x] Add searchable Logcat controls with priority filtering, pause, clear, and copy.
- [x] Add secure LAN token handoff and bounded browser clipboard controls.
- [ ] Complete the real-device acceptance matrix on macOS, Linux, and Windows.
- [ ] Publish and validate the npm release candidate before tagging v0.1.0.
The complete, evidence-based checklist lives in docs/TODO.md. Items stay unchecked until the repository contains the implementation or the required external evidence.
License
Apache-2.0. See THIRD_PARTY_NOTICES.md.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。