Android

io.github.us-all由 GitHub 帳號 us-all 發布v1.14.4更新於 Oct 24, 2026

Android MCP — ADB-based device, apps, UI, logcat, emulator, files, system, debug

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

讓助理透過 ADB 檢查與診斷 Android 裝置:logcat、dumpsys、應用程式套件、介面、檔案與模擬器。

可以做什麼
把 Android 偵錯橋封裝成九大類共 76 個工具:裝置資訊、應用程式、介面自動化、logcat、模擬器、檔案、系統設定、偵錯傾印,以及受閘控的 shell。另提供 device-health、analyze-app 等彙總工具、五個診斷提示(當機調查、記憶體洩漏偵測、權限稽核、應用程式啟動分析、介面元素定位),以及裝置、行程與應用程式活動的唯讀資源。以本機 stdio 行程執行,可選用 HTTP 傳輸。
適用情境
適合需要解釋 Android 應用程式為何當機、記憶體洩漏、耗電或行為異常,以及稽核權限、分析啟動耗時的情境。它偏向診斷而非操作,因此適合與驅動裝置的 MCP 伺服器搭配使用,而非取代它們。
執行需求
npm 套件需要 Node.js 22 以上版本,或使用 Docker。需安裝 ADB 並放在 PATH 中,或以 ADB_PATH 指定,且需一台開啟 USB 偵錯的 Android 裝置或模擬器。可選變數:ANDROID_HOME、ANDROID_SERIAL、ANDROID_TOOLS、ANDROID_DISABLE、MCP_TRANSPORT、MCP_HTTP_TOKEN、MCP_HTTP_PORT、MCP_HTTP_HOST、MCP_HTTP_SKIP_AUTH。
安裝前請注意
預設為唯讀;安裝、點擊、推送等寫入工具需設定 ANDROID_MCP_ALLOW_WRITE=true,任意 adb shell 需另外設定 ANDROID_MCP_ALLOW_SHELL=true。啟用 shell 後可在裝置上執行任意指令。HTTP 傳輸需要 MCP_HTTP_TOKEN,而 MCP_HTTP_SKIP_AUTH 會取消該檢查。寫入工具可安裝、解除安裝應用程式、清除應用程式資料並刪除裝置檔案。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

Android MCP Server

The Android diagnostic & forensic MCP — when an app crashes, leaks memory, drains battery, or behaves unexpectedly, this is what you point at the device.

76 tools across logcat / dumpsys / package internals / system properties / processes. 5 MCP Prompts (crash-investigation, memory-leak-detection, permission-audit, app-startup-profile, ui-element-locator) and a device-health aggregation. Pure ADB, no Appium / uiautomator2 dependency. 2-tier security (write + shell gates).

[npm] [downloads] [tools] [@us-all standard] [Glama MCP server]

What it does that others don't

  • Diagnostic depth — logcat search/crash extraction, dumpsys (mem/gfx/cpu), getprop, processes, package internals, app intents, port forwards. Cross-platform competitors hide this surface.
  • MCP Prompts (5) — crash-investigation, memory-leak-detection, ui-element-locator, app-startup-profile, permission-audit. Workflow templates the model invokes directly.
  • Aggregation tools — device-health (battery + memory + cpu + network in one call), analyze-app (package info + memory + activities).
  • 2-tier security — ANDROID_MCP_ALLOW_WRITE (gates installs/taps/pushes) and ANDROID_MCP_ALLOW_SHELL (gates arbitrary adb shell) are separate flags. Distinct trust levels.
  • Pure ADB — no Appium, no uiautomator2, no Python bridge. Just the official Android Debug Bridge wrapped over child_process.
  • Token-efficient by design — 56 schema-trim sweep, ANDROID_TOOLS/ANDROID_DISABLE 9 categories, search-tools meta.
  • Apps SDK card — device-health renders as a snapshot card on ChatGPT clients (battery, RAM, Wi-Fi + 4-section grid) via _meta["openai/outputTemplate"]. Claude clients receive the same JSON content.
  • stdio + Streamable HTTP — defaults to stdio. Set MCP_TRANSPORT=http for ChatGPT Apps SDK or remote clients (Bearer auth via MCP_HTTP_TOKEN).

Try this — 5 prompts

Connect the server to Claude Desktop or Claude Code, then paste any of these:

  1. Crash investigation — "My app com.us-all.api keeps crashing on this Pixel 6 emulator. Pull the last crash log, the offending stack frames, and any recent permission changes."
  2. Memory leak detection — "Trace memory growth for com.us-all.api over the last 5 minutes. Show heap deltas, GC pressure, and the largest allocators."
  3. Battery drain attribution — "What's draining battery on this device? Top 5 consumers, duration of each, and current battery health."
  4. Permission audit — "Audit installed 3rd-party apps for dangerous permissions (location/camera/contacts/microphone). Flag any app that hasn't been used in the last 30 days but holds these."
  5. App startup profile — "Profile the cold-start of com.us-all.api — measure activity launch time, identify the slowest fragment init, and suggest where to add tracing."

When to use this vs mobile-next/mobile-mcp

mobile-next/mobile-mcp (4.7K★) is the cross-platform action-oriented MCP. Different problem space:

mobile-mcp@us-all/android-mcp (this)
PlatformiOS + Android (cross-platform)Android only (specialist)
PostureAction-oriented ("drive the app via NL")Diagnostic ("tell me why it broke")
UI surfaceAccessibility-tree-first, action loopsUI hierarchy + screenshots + diagnostic dumps
Diagnostic depthminimallogcat / dumpsys / getprop / processes / crashes
Aggregations—device-health, analyze-app
MCP Prompts—5 (diagnostic-themed)
Security gatesbasic2-tier (write + shell separate)
Distributionbroad (12+ IDE buttons)npm + Docker

Use both — they're complementary. mobile-mcp drives the device through your QA flows; this MCP tells you why it broke when something does. Especially:

  • mobile-mcp finds the bug via UI exploration → this MCP captures the crash log + heap dump.
  • mobile-mcp can't tell you why startup is slow → this MCP gives you dumpsys gfxinfo + activity launch timing.
  • mobile-mcp can't reproduce a permission denial → this MCP shows the exact dumpsys package permission state and recent grants.

Install

Claude Desktop

json
{  "mcpServers": {    "android": {      "command": "npx",      "args": ["-y", "@us-all/android-mcp"],      "env": {        "ANDROID_MCP_ALLOW_WRITE": "true"      }    }  }}

Claude Code

bash
claude mcp add android -s user \  -e ANDROID_MCP_ALLOW_WRITE=true \  -e ANDROID_MCP_ALLOW_SHELL=true \  -- npx -y @us-all/android-mcp

Docker

bash
docker run --rm \  --device /dev/bus/usb \  -e ANDROID_MCP_ALLOW_WRITE=true \  ghcr.io/us-all/android-mcp-server:latest

Build from source

bash
git clone https://github.com/us-all/android-mcp-server.gitcd android-mcp-server && pnpm install && pnpm buildnode dist/index.js

Prerequisites

  • ADB installed and on PATH (or set ADB_PATH)
  • Android device or emulator with USB debugging enabled
  • For multi-device setups: ANDROID_SERIAL=<serial> to target a specific one

Configuration

VariableRequiredDefaultDescription
ANDROID_HOME❌auto-detectAndroid SDK path
ADB_PATH❌adb (PATH)Path to ADB binary
ANDROID_SERIAL❌auto (single device)Target device serial
ANDROID_MCP_ALLOW_WRITE❌falseEnable write operations (install, tap, push)
ANDROID_MCP_ALLOW_SHELL❌falseEnable arbitrary adb shell execution
ANDROID_TOOLS❌—Comma-sep allowlist of categories. Biggest token saver.
ANDROID_DISABLE❌—Comma-sep denylist. Ignored when ANDROID_TOOLS is set.
MCP_TRANSPORT❌stdiohttp to enable Streamable HTTP transport
MCP_HTTP_TOKENconditional—Bearer token. Required when MCP_TRANSPORT=http
MCP_HTTP_PORT❌3000HTTP listen port
MCP_HTTP_HOST❌127.0.0.1HTTP bind host (DNS rebinding protection auto-enabled for localhost)
MCP_HTTP_SKIP_AUTH❌falseSkip Bearer auth — e.g. behind a reverse proxy that handles it

Categories (9): device, apps, ui, logcat, emulator, files, system, debug, shell (always-gated by ANDROID_MCP_ALLOW_SHELL), plus always-on meta.

When MCP_TRANSPORT=http: POST /mcp (Bearer-auth JSON-RPC) + GET /health (public liveness).

Token efficiency

ScenarioToolsSchema tokensvs default
default (all categories)769,200—
typical (ANDROID_TOOLS=device,ui,apps,logcat)375,000−46%
narrow (ANDROID_TOOLS=device,ui)192,500−73%

Plus search-tools meta-tool (always enabled) for runtime tool discovery.

Read-only mode (default)

By default, only read operations are permitted. Write operations (tap, install-app, push-file, etc.) return an error unless ANDROID_MCP_ALLOW_WRITE=true. Shell command execution requires a separate ANDROID_MCP_ALLOW_SHELL=true for additional security — even with write enabled, raw shell stays blocked unless this is explicitly set.

MCP Prompts (5)

Workflow templates available via MCP prompts/list:

  • crash-investigation — pull crash logs + stack frames + recent permission changes for a target package.
  • memory-leak-detection — track heap delta over a window; cluster by allocator.
  • ui-element-locator — find a UI element by visual + accessibility hints; return tap coordinates.
  • app-startup-profile — cold-start profile: activity launch + fragment init + first frame.
  • permission-audit — flag dangerous permissions held by under-used 3rd-party apps.

MCP Resources

URI-based read-only entities:

  • android://devices — connected devices
  • android://device/{serial} — device details (model/brand/version/display)
  • android://app/{packageName}/activities — activities exposed by a package (exported/launchable flags)
  • android://device/{serial}/processes — running processes

Tools (76)

9 categories. Use search-tools to discover at runtime; full list collapsed below.

CategoryTools
System (battery / network / settings / display / orientation / port-fwd / wifi / mobile-data)19
Apps (install / launch / permissions / intents / data clear)14
UI (tap / swipe / screenshot / hierarchy / accessibility / annotated tap-by-index / screen recording)14
Emulator (AVD start/stop, snapshot mgmt)7
Device (list / info / properties / wireless connect)5
Debug (bugreport / mem / gfx / cpu / doctor)5
Logcat (capture / filter / clear / crash extract)4
Files (list / pull / push / delete)4
Shell (gated execute-shell)1
Aggregations (device-health, analyze-app)2
Meta (search-tools)1
Full tool list

Device (5)

list-devices, get-device-info, get-device-properties, connect-device, disconnect-device

Apps (14)

list-packages, get-package-info, install-app, uninstall-app, launch-app, stop-app, clear-app-data, grant-permission, revoke-permission, open-url, send-broadcast, get-current-activity, is-app-installed, get-app-intents

UI Automation (14)

take-screenshot, dump-ui-hierarchy, ui-snapshot-a11y, tap, long-press, swipe, input-text, press-key, drag-and-drop, start-screen-recording, pull-screen-recording, double-tap, take-annotated-screenshot, tap-element

Logcat (4)

get-logcat, clear-logcat, search-logcat, get-crash-logs

Emulator (7)

list-avds, start-emulator, stop-emulator, list-snapshots, load-snapshot, save-snapshot, delete-snapshot

Files (4)

list-files, pull-file, push-file, delete-file

System (19)

get-battery-info, get-network-info, change-setting, get-setting, set-display-size, set-display-density, keep-screen-on, port-forward, reverse-forward, list-forwards, remove-forward, toggle-wifi, toggle-mobile-data, open-notification, lock-device, unlock-device, get-orientation, set-orientation, list-settings

Debug (5)

bugreport, get-mem-info, get-gfx-info, get-cpu-info, doctor

Shell (1)

execute-shell — gated by ANDROID_MCP_ALLOW_SHELL

Aggregations

device-health — battery + memory + cpu + network in one call (~7KB response, 4 sub-systems with caveats). analyze-app — package info + memory + activities aggregation.

Meta

search-tools — query other tools by keyword; always enabled.

Architecture

Claude → MCP stdio → src/index.ts                      ├── adb.ts (execFile wrapper)                      ├── tools/utils.ts (wrapToolHandler, shellEscape, validation)                      └── tools/{device,apps,ui,logcat,emulator,files,system,debug,shell,aggregations}.ts                                  ↓                          ADB CLI (USB / TCP-IP / Emulator)                                  ↓                          Android Device

Built on @us-all/mcp-toolkit:

  • extractFields — token-efficient response projections (skipped for ADB flat-array endpoints)
  • aggregate(fetchers, caveats) — fan-out helper for device-health / analyze-app
  • createWrapToolHandler — WriteBlockedError/ShellBlockedError passthrough + structured ADB errors ({code, stderr})
  • wrapImageToolHandler (Android-only) — base64 PNG sanitization
  • search-tools meta-tool

Security

  • Read-only by default. Writes blocked without ANDROID_MCP_ALLOW_WRITE=true.
  • Shell gating separate. execute-shell blocked without ANDROID_MCP_ALLOW_SHELL=true even with write enabled — distinct trust levels.
  • Shell injection safe. shellEscape for single-quote-based escape; input validation via zod regex whitelists for setting keys, package names, permissions, components, broadcast actions/extras.
  • Path-traversal blocked. Device paths require absolute + no .. + no shell metachars.
  • Error sanitization. API keys, tokens, passwords redacted from all error outputs.

Tech stack

Node.js 22+ • TypeScript strict ESM • pnpm 10 • @modelcontextprotocol/sdk 1.29+ • zod v4 • fast-xml-parser • vitest (fork pool isolation).

License

MIT

來源:README.md,提交 bacd6ea

工具

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

版本歷史

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

評分

已滿足適用檢查項的 50%

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

  • 近 30 天內可連通25 分

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

  • 已宣告認證方式10 分

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

  • 已列出工具15 分

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

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