DeepADB

MCP (Model Context Protocol) server for AI agents that need to inspect, control, test, and diagnose Android devices through ADBβor directly on-device through Termux.
209 tools, 5 resources, and 4 prompts across 49 modulesβfrom UI automation and application management to logs, network capture, baseband, firmware, security, and hardware diagnostics.
Get started
DeepADB runs as a local MCP server. It uses ADB by default and automatically switches to direct execution when it detects Termux on an Android device.
git clone https://github.com/fullread/DeepADB.git
cd DeepADB
npm ci
npm run build
npm start
Add build/index.js to your MCP client configuration, then begin with these workflows:
| Goal | Start with |
|---|
| Confirm the toolchain and connected device | adb_health_check, then adb_devices |
| Inspect the current Android UI | adb_screen_state, then adb_ui_dump |
| Diagnose a device or app | adb_device_info, adb_logcat, and adb_dumpsys |
For a guided local connection, see Claude Code Configuration. Read SECURITY.md before exposing HTTP, WebSocket, or GraphQL transports beyond loopback.
Architecture
ββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MCP Client β
β (Claude Code / claude.ai) β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββ
β stdio (JSON-RPC) or HTTP/SSE or WebSocket
ββββββββββββββββββββββββΌββββββββββββββββββββββββββββ
β DeepADB Server β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββ β
β β Tool Modules (49) β β
β β device β shell β packages β files β logs β β
β β diagnostics β ui β build β health β β
β β wireless β control β logcat-watch β β
β β forwarding β screen-record β emulator β β
β β testing β multi-device β snapshot β β
β β network-capture β ci β plugins β baseband β β
β β accessibility β regression β β
β β device-farm β registry β at-commands β β
β β screenshot-diff β workflow β sensors β β
β β split-apk β mirroring β test-gen β β
β β ota-monitor β ril-intercept β β
β β device-profiles β firmware-analysis β β
β β workflow-market β selinux-audit β β
β β thermal-power β network-discovery β β
β β input-gestures β wireless-firmware β β
β β app-network β database-inspector β β
β β runtime-audit β wear β β
β βββββββββββββββββββββββββββββββββββββββββββββββ€ β
β β Resources (5) β Prompts (4) β β
β βββββββββββββββββββββ¬ββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββΌββββββββββββββββββββββββββ β
β β ToolContext (unified DI) β β
β β server β bridge β deviceManager β β
β β logger β security β config β β
β βββββββββββββββββββββ¬ββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββΌββββββββββββββββββββββββββ β
β β Middleware Layer β β
β β OutputProcessor β SecurityMiddleware β β
β β InputSanitizer β Logger (stderr-safe) β β
β βββββββββββββββββββββ¬ββββββββββββββββββββββββββ β
β β β
β βββββββββββββββββββββΌββββββββββββββββββββββββββ β
β β Bridge Layer (auto-detect) β β
β β β β
β β βββββββββββββββ ββββββββββββββββββββββ β β
β β β ADB Bridge β OR β Local Bridge β β β
β β β (PC mode) β β (on-device mode) β β β
β β β via adb.exe β β via sh/su direct β β β
β β ββββββββ¬ββββββββ ββββββββββ¬ββββββββββββ β β
β β β β β β
β β Retry β Timeout β Cache β Serial routing β β
β βββββββββββΌββββββββββββββββββββββΌββββββββββββββ β
ββββββββββββββΌββββββββββββββββββββββΌββββββββββββββββ
β β
βββββββββΌββββββββ βββββββββΌββββββββ
β ADB Binary β β sh / su β
β (USB/WiFi) β β (local) β
βββββββββ¬ββββββββ βββββββββ¬ββββββββ
β β
βββββββΌβββββββββββββββββββββΌββββββ
β Android Device β
ββββββββββββββββββββββββββββββββββ
Dual-Mode Architecture
DeepADB operates in two modes, auto-detected at startup:
ADB Mode (default) β PC-side bridge
AI Agent (PC) ββ MCP ββ DeepADB (PC) ββ ADB (USB) ββ Android Device
Standard mode: DeepADB runs on a PC/Mac/Linux host and communicates with the device over USB via ADB. The complete 209-tool surface is registered through the ADB bridge with automatic retry on transient failures; environment-specific tools report their capability requirements when a host cannot run them.
On-Device Mode β direct local execution
AI Agent (Termux) ββ MCP (stdio/HTTP) ββ DeepADB (Termux) ββ sh/su (local)
When DeepADB runs directly on the Android device (e.g., inside Termux), it auto-detects the environment and switches to LocalBridge. Commands execute directly via sh/su β no ADB server, no USB, no serialization overhead. The same 209-tool MCP surface is registered, with capability-aware guidance when an optional on-device binary such as sqlite3 is unavailable.
v1.1.4 host hardware validation: the full Pixel 6a / Android 16 regression completed with 604 passed, 0 failed, and 17 expected environment-specific skips (621 total). This includes live AT/OK validation on /dev/umts_router, a guarded read-only SQLite schema snapshot with cleanup, the unified runtime audit, per-app route context, and the single-device Wear preflight. The skips are the five on-device-only QEMU checks plus twelve Windows-host or unavailable-tcpdump security checks.
v1.1.3 hardware baseline: validated on a Pixel 6a (Android 16, Termux + Magisk + QEMU 10.2.1) across a four-cell test matrix β host (ADB) and on-device (LocalBridge), each with and without a device PIN β with 0 failures in every cell. The v1.1.3 suite contained 577 tests in the host/ADB configuration and 613 on-device; the difference is the QEMU virtualization and Alpine VM-boot suites, which run only on-device:
- ADB mode, no PIN: 556 passed / 0 failed / 21 skipped (577 total). Skips: 5 QEMU (on-device only), 7 gracefulKill unit tests (require POSIX signals, skipped on the Windows host), 3 tcpdump sanitization (tcpdump is root-only and unreachable over a non-root ADB shell), 2 host-shell round-trips (require a POSIX /bin/sh), 4 screen-state (require DA_TEST_PIN).
- ADB mode, with PIN: 560 passed / 0 failed / 17 skipped (577 total). The 4 screen-state tests unlock and run.
- On-device mode, no PIN: 606 passed / 0 failed / 7 skipped (613 total). All QEMU tests run, including Alpine Linux VM boot with KVM acceleration, big.LITTLE CPU topology detection, guest ADB connectivity error handling, and clean VM shutdown; the tcpdump and gracefulKill suites also run here (root + POSIX). Skips: 3 QEMU setup steps that no-op when the Alpine kernel/initrd/disk are already cached, 4 screen-state (require PIN).
- On-device mode, with PIN: 610 passed / 0 failed / 3 skipped (613 total). Every test enabled by the environment runs; the 3 skips are the cached-VM setup steps.
Privilege escalation: In ADB mode, all shell commands run as uid=2000 (the shell user) which has system-level permissions. In Termux, commands run as a regular app user. LocalBridge automatically elevates privileged commands through su when root (Magisk) is available:
- Command allowlist: 16 system commands (
settings, dumpsys, am, input, screencap, screenrecord, uiautomator, app_process, getenforce, setenforce, cmd, pm, wm, svc, ip, ifconfig) are routed through su -c to match ADB-mode behavior.
- Path-based elevation: Commands referencing
/sdcard, /storage, or /system/ paths are elevated to bypass Android scoped storage restrictions.
- Root detection: Cached after a single
su -c id probe at first use. Graceful degradation when root is unavailable.
- The elevation allowlist is frozen (
ReadonlySet + Object.freeze) β not configurable via environment variables or runtime API.
Auto-detection: Checks for /system/build.prop (present on all Android devices, never on hosts). Override with DA_LOCAL=true or DA_LOCAL=false.
On-device setup (Termux):
pkg install nodejs-lts git
git clone <deepadb-repo> && cd deepadb
npm install && npm run build
npm start # stdio β for local AI agents (Claude Code, OpenCode)
DA_HTTP_PORT=3000 npm start # HTTP/SSE β for remote AI access over WiFi
Claude Code Configuration
{
"mcpServers": {
"deepadb": {
"command": "node",
"args": ["/path/to/DeepADB/build/index.js"]
}
}
}
Available Tools (209)
Start with the capability area that matches your task; the complete reference remains below.