droidsight

io.github.edgecasehuman由 GitHub 帳號 edgecasehuman 發布v1.0.0更新於 Oct 25, 2026

Drives a real Android device over ADB and attaches the resulting screen to every action.

已驗證STDIO僅桌面瀏覽器自動化開發者工具

概覽

AI 產生的概覽

一個本機 MCP 伺服器,透過 ADB 操控真實 Android 裝置,並在每次操作後回傳螢幕畫面。

可以做什麼
檢視螢幕:截圖、無障礙階層、OCR、元素與範本搜尋、背景 H.264 串流、等待元素出現。操控裝置:點擊、輸入、按鍵、滑動、依文字點擊、執行預先驗證的動作流程、錄製與重放手勢。管理應用程式:啟動、停止、列出、安裝、讀取當機日誌、檢查活動與程序狀態、開啟網址與 Intent。控制系統與裝置狀態:剪貼簿、電池、鎖定與解鎖、旋轉、無障礙服務、Wi-Fi、代理、通話、簡訊、模擬感測器、健康檢查。讀取診斷與資料:logcat、緩衝事件、日誌過濾、通知、檔案推送與拉取、裝置內 SQLite 查詢、檔案雜湊。錄製與在場:螢幕錄影、向持機者發送通知或訊息、註冊受監控的應用程式。
適用情境
適合需要讓助理操作或測試真實 Android 手機或模擬器的情境:介面自動化、應用程式冒煙測試、重現缺陷、查看日誌與通知、錄製螢幕。較適合本機可信環境,而非共用或不受信任的用戶端。
執行需求
以本機程序執行(npx 套件或編譯的 Rust 二進位檔),需在桌面機器上透過 PATH、ANDROID_SDK_ROOT、ANDROID_HOME 或 DROIDSIGHT_ADB_PATH 找到 ADB,並連接已授權的 USB 或無線裝置。多台裝置時需設定 DROIDSIGHT_DEVICE_SERIAL。OCR 可選用 Tesseract;從原始碼編譯需要 NASM。
安裝前請注意
這是強大的本機控制器,不是沙箱。清除資料、解除安裝、權限變更等破壞性操作需 confirm_destructive,但這只是防誤觸護欄,不是安全邊界。設定 DROIDSIGHT_ALLOW_SHELL=1 會發布無過濾的 shell 與巨集工具,繞過該護欄。系統控制會授予讀螢幕與輸入注入權限;網路控制可撥打真實電話並變更代理。DROIDSIGHT_SENTINEL=1 會定時重建設備狀態,包括用 PIN 解鎖,並撤銷手動變更。DROIDSIGHT_DEVICE_PIN 應僅在執行時提供,不要寫入設定。通知內容可能未遮蔽,螢幕可能含敏感資訊。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 droidsight,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

droidsight

[CI] [Security audit] [License: MIT] [crates.io] [npm]

An MCP server that drives a real Android device over ADB — and hands the agent back the screen its action produced.

One native binary. The server has no Python, Appium, scrcpy, or ffmpeg dependency and runs no Node at all — npx below is only a convenient installer — so the runtime is the binary plus adb. A background H.264 screenrecord stream is decoded in process, so the screen that follows an action is attached to the tool result automatically instead of costing a second round trip to ask what happened.

Every image carries the coordinate space it was produced in, so a model can tap what it just looked at without guessing a scale factor. When the accessibility tree comes back empty — Flutter, React Native, canvas, games — OCR and template matching still find the target.

This is a powerful local controller, not a sandbox. Run it only against a device and an MCP client you trust.

Install

bash
npx -y @edgecasehuman/droidsight

That downloads a prebuilt binary for your platform and needs no build tools. The server is also listed in the official MCP Registry as io.github.edgecasehuman/droidsight.

To compile it instead, from crates.io:

bash
cargo install droidsight

Or from source:

bash
cargo build --locked --release --bin droidsight

Both compiling routes need NASM on the PATH. The H.264 decoder is built from C++ by openh264-sys2, which assembles its hot paths with NASM, and no platform ships it by default -- without it the build fails inside a transitive dependency rather than in this crate. Install it with apt install nasm, brew install nasm, or winget install NASM.NASM. The npx route above needs none of this.

The server is target/release/droidsight. It speaks newline-delimited JSON-RPC 2.0 over stdin and stdout.

Client configuration

json
{  "mcpServers": {    "android": {      "command": "npx",      "args": ["-y", "@edgecasehuman/droidsight"],      "env": {        "DROIDSIGHT_DEVICE_SERIAL": "<serial from `adb devices`>"      }    }  }}

ADB must be reachable through PATH, ANDROID_SDK_ROOT, ANDROID_HOME, or an explicit DROIDSIGHT_ADB_PATH. If more than one authorized device is visible the server refuses to guess; set DROIDSIGHT_DEVICE_SERIAL.

Tools

Thirty-one tools are published by default. Two more appear only when DROIDSIGHT_ALLOW_SHELL=1 is set, and are listed last.

Seeing the screen

ToolPurpose
mcp_android_vision_queryScreenshot, hierarchy, OCR, and element or template search. Its elements and tap_element actions avoid coordinate arithmetic entirely.
mcp_android_vision_streamStart, stop, or read the background H.264 stream.
mcp_android_get_view_hierarchyThe accessibility tree as structured JSON.
mcp_android_smart_waitBlock until an element appears, or time out.

Driving the device

ToolPurpose
mcp_android_input_actTap, type, key events, swipe, smart tap, and IME control.
mcp_android_tap_textScan for text and tap it the instant it appears, retrying until timeout. Avoids the miss between a screenshot and a tap.
mcp_android_run_flowRun a bounded, fully prevalidated sequence of safe actions.
mcp_android_record_gestureRecord raw touch input for a fixed duration.
mcp_android_play_gestureReplay a recorded gesture timeline.

Applications

ToolPurpose
mcp_android_app_manageLaunch, stop, list, install, and read crash logs. Uninstall, clear data, permission, enable, and disable additionally require confirm_destructive.
mcp_android_app_instrumentationDeep state inspection: activity, window, process list, stack traces.
mcp_android_open_urlOpen a URL.
mcp_android_start_intentStart an arbitrary intent.

Device and system state

ToolPurpose
mcp_android_device_controlClipboard, battery, device info, lock state, unlock, rotation.
mcp_android_system_controlAccessibility services and the draw-over-other-apps permission. Grants screen-read and input-injection authority across every app.
mcp_android_network_controlWi-Fi, mobile data, HTTP proxy, phone calls, SMS, wireless ADB pairing.
mcp_android_sensor_controlMock battery level and charging status; GPS mocking is emulator-only.
mcp_android_check_healthConnectivity and responsiveness of the selected device.
mcp_android_check_debug_exposureReport which developer settings are enabled and therefore visible to apps.

Diagnostics and data

ToolPurpose
mcp_android_diagnostic_streamRead logcat, clear it, or read buffered raw and semantic events.
mcp_android_read_recent_eventsBuffered device events from the optional monitor.
mcp_android_log_filterFilter logs by regex, tag, or priority.
mcp_android_get_notificationsDump posted notifications, including unredacted message content.
mcp_android_file_systemList, read, push, and pull files, confined to DROIDSIGHT_LOCAL_ROOT.
mcp_android_forensics_controlQuery an on-device SQLite database, hash a file, or irreversibly delete an application's data.

Capture and presence

ToolPurpose
mcp_android_start_recordingBegin a screen recording, up to 180 seconds, written to the device.
mcp_android_stop_recordingStop it. The file stays on the device.
mcp_android_companionPost a notification, show a transient message, or open a URL for whoever is holding the phone.
mcp_android_sentinel_controlRegister a watched package. See Background enforcement before using it.
mcp_android_start_session, mcp_android_stop_sessionSession markers. They acknowledge the call and hold no server state.

Only with DROIDSIGHT_ALLOW_SHELL=1

ToolPurpose
mcp_android_run_shellRun an arbitrary device shell command. No filtering of any kind.
mcp_android_run_macroRun up to 100 shell commands in sequence, stopping at the first failure.

Coordinate space

Screenshots are downscaled to 720 pixels wide by default, so a coordinate read off the returned pixels is usually not a device coordinate. Every tool that returns an image also returns a metadata.image object describing how to convert one:

json
{  "image": {    "width": 720, "height": 1600,    "device_width": 1080, "device_height": 2400,    "origin_x": 0, "origin_y": 0,    "scale": 1.5,    "coordinate_space": "image",    "note": "To convert a coordinate (x, y) read from this image into a device coordinate: device_x = 0 + x * 1.5, device_y = 0 + y * 1.5."  }}

When coordinate_space is device, the image is already 1:1 and coordinates can be used directly. Request max_width: 1440 to reduce or remove downscaling. Crops additionally report a non-zero origin_x/origin_y that must be added after scaling.

Taps, uiautomator hierarchy bounds, OCR boxes, and template matches are all in device coordinates. The background stream runs screenrecord without --size, so decoded frames are native resolution and share that one space.

You can avoid the arithmetic entirely. The mcp_android_vision_query tool's elements action returns an indexed snapshot with a precomputed center per element, and its tap_element action takes that snapshot_id and an index.

Environment variables

VariableEffect
DROIDSIGHT_DEVICE_SERIALThe only Android target the process may use. Mandatory when ADB reports multiple authorized devices.
DROIDSIGHT_ADB_PATHExplicit path to the ADB executable.
DROIDSIGHT_LOCAL_ROOTConfines host paths used by APK installation and file push/pull. Defaults to the process working directory.
DROIDSIGHT_DEVICE_PINNumeric PIN for UI actions that need automatic unlock. Supply at runtime only; never in source or a checked-in MCP configuration.
DROIDSIGHT_ALLOW_SHELL=1Publishes the arbitrary shell and macro tools. This grants authority equivalent to broad ADB shell access. Off by default.
DROIDSIGHT_DEBUG_LOGPath to a persistent debug log. Logging to a file is strictly opt-in; without this, warnings go to stderr and no file is written.
DROIDSIGHT_LOGTracing filter. Defaults to warn, or debug when a debug log path is set.
DROIDSIGHT_EVENTS=1Starts the long-running device event monitor. Requires DROIDSIGHT_DEVICE_SERIAL.
DROIDSIGHT_SENTINEL=1Starts the background enforcement loop described under Background enforcement. Off by default: it re-applies device state on a timer, including unlocking the screen.

Continuous vision cache

One background H.264 screenrecord stream starts at process startup and the latest decoded RGB frame is kept in memory. Screenshot tools and input observations read that cache, so a snapshot is available immediately once the first frame decodes. A static screen's last frame stays valid while the stream runs; it does not expire merely because the encoder stopped emitting unchanged pixels.

The stream allows 20 seconds for the first decodable frame before reconnecting. After that, silence is treated as a static screen, while EOF and read errors still reconnect. Starting or stopping a stream synchronously clears its frame cache so a previous session's image cannot be reused. The mcp_android_vision_stream stop action suspends capture until an explicit start; shutdown drops the owned ADB stream and leaves no screenrecord process behind.

Continuous capture has privacy, battery, CPU, and wireless-bandwidth costs. The device screen may contain sensitive information even though cached frames stay in process memory until a tool returns one. Use the explicit stop action when capture should be suspended.

MCP transport

Stdout carries one JSON-RPC value per line; diagnostics go to stderr. The server supports initialize, tools/list, and tools/call, plus the initialized notification and legacy mcp.* aliases. Batch arrays are handled member by member and produce one response-array line; notification-only batches produce no output and empty batches are rejected. Clients must complete the ordered initialize request and notifications/initialized notification handshake before listing or calling tools; premature calls return JSON-RPC error -32002. Input frames are limited to 16 MiB; oversized or invalid UTF-8 frames are rejected without preventing the next valid request from being processed.

Published text from logs, events, notifications, device files, hierarchy and OCR results, crash and forensic reports, instrumentation, shell/macro output, and aggregate flows is limited to 256 KiB. Truncated responses carry metadata.truncation with the strategy, original size, returned size, and configured limit; chronological feeds retain their newest tail while file-like output retains its head.

Finite ADB subprocesses drain stdout and stderr concurrently and retain at most 4 MiB from each stream while counting all observed bytes, which prevents pipe deadlocks and unbounded capture. The optional event monitor owns its ADB child and reader thread and is cancelled, killed, joined, and reaped during transport shutdown rather than being left detached.

OCR is an optional integration with an external Tesseract executable. Discovery probes are limited to five seconds and recognition to 30 seconds; timed-out children are terminated and reaped before the tool returns an error.

Smoke test:

bash
printf '%s\n' \  '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \  '{"jsonrpc":"2.0","method":"notifications/initialized"}' \  '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \  | cargo run --quiet --bin droidsight

Destructive operations

Some tools change device state irreversibly. pm clear deletes an application's databases, preferences, accounts, and credentials, and it is reachable two ways. Both refuse to run without "confirm_destructive": true:

  • mcp_android_forensics_control with "action": "clear_app_data", named for what it does rather than for a cache eviction.
  • mcp_android_app_manage with "action": "clear_data". The same tool gates uninstall, permission, enable, and disable behind the same argument, because each of them removes an application, its data, or a security control.

The guard is checked before any ADB command is issued, so a refused call does not touch the device. It is a guardrail against an unintended call, not a security boundary: a client that can invoke tools can also set the flag.

The gate covers unintended calls to those specific tools. It is not a containment boundary, and several operations of comparable impact are not behind it at all:

  • mcp_android_system_control enables an accessibility service, which grants full screen-read and input-injection access across every app on the device, and grants the draw-over-other-apps permission.
  • mcp_android_network_control sets a global HTTP proxy, forgets saved Wi-Fi networks, and places real outbound phone calls.
  • mcp_android_sensor_control overrides sensor readings such as battery level and status; its GPS location mocking uses the emulator console and applies only to emulators, not physical devices.

Arbitrary shell access

DROIDSIGHT_ALLOW_SHELL=1 publishes two tools that pass command strings to the device shell verbatim: mcp_android_run_shell, and mcp_android_run_macro for batches of up to 100 commands.

No command filtering of any kind is performed. The environment variable is the entire control. Once set, these tools are a strict superset of every gated operation above — pm clear, pm uninstall, and file deletion are all reachable without confirm_destructive, because the shell path never consults it. Leave the variable unset unless the connected MCP client is as trusted as a local shell on the device.

Background enforcement

DROIDSIGHT_SENTINEL=1 starts a loop that wakes every five seconds and, for each watched package, re-applies the state it was told to hold: waking and unlocking the screen with a PIN supplied when the watch was registered, enabling an accessibility service, granting the overlay permission, and granting a list of runtime permissions. No watches exist until a client registers one, so an enabled sentinel with an empty watch list only ticks.

Two consequences are worth stating plainly:

  • It reverses manual changes. Revoking a permission or disabling the accessibility service for a watched package is undone within five seconds. Remove the watch first.
  • It does not ask for confirm_destructive. That gate covers an operator calling mcp_android_app_manage; the loop invokes the same underlying operation directly, because re-granting is the entire purpose of a watch. Registering a watch is the consent step for everything that watch will subsequently do on its own.

The loop performs no network I/O beyond the local ADB connection and contacts no remote service.

Build and test

The repository pins its Rust toolchain and keeps device-mutating scenarios out of the default test suite.

bash
cargo fmt --all -- --checkcargo clippy --locked --all-targets -- -D warningscargo test --locked -- --test-threads=1cargo build --locked --release --bin droidsight

These gates run on Linux, macOS, and Windows and pass without warning suppressions. The compiler is pinned in rust-toolchain.toml; a separate CI job type-checks the crate against Rust 1.89, the declared minimum.

See CONTRIBUTING.md before changing device-affecting code. SECURITY.md documents private reporting, sensitive-evidence redaction, and the ADB, host, MCP, filesystem, logging, and shell trust boundaries. Participation is governed by CODE_OF_CONDUCT.md.

Maturity

The host-only suite covers protocol parsing, schemas, serialization, ADB command construction, concurrent discovery, reconnect invalidation, device selection, subprocess deadlines, JSON-RPC batches, path confinement, shell quoting, output budgets, event-monitor teardown, hierarchy parsing, flow validation, stream framing and lifecycle, static-frame cache behavior, image encoding and coordinate metadata, Samsung keyguard/window parsing, and intent failure handling.

The release binary has been exercised over wireless debugging against a single Samsung device running Android 13, covering device state, battery, apps, hierarchy and element snapshots, OCR, screenshots and sequences, continuous H.264 capture, input and navigation, intents, logs, notifications, Wi-Fi scanning, file round trips, hashing, sessions, gesture capture, recording, rotation restoration, crash listing, and cleanup. Destructive application, permission, accessibility, overlay, telephony, network-mutation, GPS, and battery-mocking operations are deliberately excluded from that matrix. Other vendors and Android releases still need their own qualification.

H.264 decoding

The vision cache decodes H.264 in process using openh264, which builds Cisco's BSD-2-Clause C++ implementation from source. Cisco's royalty coverage applies to the binaries Cisco itself publishes and does not transfer to a self-compiled build. If you redistribute binaries of this project, satisfying any applicable H.264 patent licensing is your responsibility.

License

MIT. See LICENSE.

來源:README.md,提交 acc44d9

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分