android-root-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| ADB_PATH | No | Path to the adb executable. Optional if adb is already on PATH. | |
| ANDROID_MCP_FASTPATH | No | Set to "1" to enable the persistent adb-shell accelerator. Disabled by default because it was measured slower on the reference host. | 0 |
| ANDROID_MCP_STATE_DIR | No | Directory used by android-root-mcp for persistent state. Optional; if omitted, the server uses its default state location. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
Android Root MCP v2:语义交互、可保存条件工作流、单次 ADB 批处理、Root 数据/系统管理、后台任务与 WebView DOM。 核心铁律:
严禁像传统人机一样『走一步截一张图算像素坐标』!优先调用
get_ui_tree(实际耗时依设备而定)获取屏幕控件列表、snapshot_id 与#index编号。连续操作(如:打开应用 -> 点击搜索框 -> 输入中文 -> 按回车)优先调用
run_workflow或兼容的batch_ui_actions一次性批量完成,用条件等待替代固定 sleep。tap_element、input_text、swipe_screen执行后默认自动返回最新post_ui控件树,无需在操作后重复调用get_ui_tree。在进行 Android 逆向或 LSPosed 钩子开发时,优先使用
inspect_view_hierarchy获取真实自定义 View 类名、GONE/INVISIBLE 状态与0x7f...16进制资源锚点。
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| get_device_statusA | 获取当前连接的 Android 设备状态:设备型号、Android/SDK 版本、实际 Root UID、 当前前台包名与 Activity、屏幕分辨率及 UIAutomator2 可提供的亮屏状态。 |
| get_ui_treeA | 【核心感知工具 - 替代慢速截图】通过高速 RPC 提取当前屏幕的语义化 UI 控件树。
返回每个元素的 |
| inspect_view_hierarchyA | 【仅用于已知能吐出 View 树的 ROM】通过
|
| screenshot_annotatedA | 【视觉兜底与界面审查工具】获取手机屏幕截图。安全图层/DRM 等限制仍可能导致空白或拒绝。
默认开启 Set-of-Mark ( |
| tap_elementA | 智能语义点击工具。支持按 |
| input_textA | 极速中文/Unicode 文本输入工具。 可一步完成『聚焦输入框 -> 清空旧内容 -> 注入中文字符串 -> 按回车提交 -> 返回新界面 UI 树』,并自动保护系统原输入法不被篡改。 |
| swipe_screenA | 智能滑动与滚动查找工具。
支持四向滑动、自定义坐标拖拽,或设置 |
| press_keyC | 发送系统物理/虚拟按键(返回、主页、多任务、回车、电源唤醒等),并自动返回最新界面结构。 |
| batch_ui_actionsA | 【王牌去人机感工具】单次调用连续执行多步手机操作流水线! 当能够预判接下来的 2~6 步操作时(例如:启动应用 -> 等待首页 -> 点击搜索框 -> 输入关键词 -> 按回车), 必须使用本工具一次性下发,彻底告别『点一下停几秒等下一轮』的卡顿体验! 若中途某一步失败,会自动中断并返回当前停留页面的 UI 树供纠错。 |
| root_shellB | 【Root 上帝模式直通车】通过 |
| start_activity_rootB | 【Root 页面直达工具】利用 Root 权限强行穿透拉起任意内部私有 Activity ( |
| manage_appC | 应用生命周期与权限管理工具(信息、停止、重启、清空数据、逐项尝试授予运行时权限)。 |
| inspect_app_dataA | 【零界面数据穿透工具】直接通过 Root 读取或查询 |
| query_system_providerB | 【后台零界面取证工具】无需下拉通知栏或打开短信 App,直接通过 Root 提取通知栏消息、短信验证码或读写系统剪贴板。 |
| read_logcat_smartB | 【智能 Logcat 诊断工具】支持按包名自动绑定进程 PID、一键提取闪退堆栈 ( |
| inspect_lsposedA | 【LSPosed / Xposed / KernelSU 专属调试工具】
直接通过 Root 读取 |
| deploy_and_verify_apkA | 【Android / LSPosed 开发一键联调闭环】 单次调用自动完成:
|
| file_transfer_rootB | 【Root 级跨端文件推拉】利用 |
| optimize_device_for_agentB | 【设备极速模式调优】一键将手机调校为最适合 AI Agent 高速操控与调试的状态:
|
| tool_catalogC | Discover v2 capabilities and the efficient Agent operating rules (no device connection needed). |
| device_connectionC | List/select ADB devices or connect/disconnect/pair host:port. Selection clears UI indices; no arbitrary default when multiple devices are attached. |
| device_doctorA | Probe actual Root UID, ROM/SDK, installed command/dependency capabilities. initialize_u2 starts the UIAutomator2 helper and resets a failed connection. |
| ui_snapshotC | Fresh semantic UI snapshot with stable document-order indices and snapshot_id. Supply since_snapshot_id for added/removed/changed nodes; compact omits the full element array. |
| find_elementsA | Query UI with AND-combined text/id/class/package/state/region predicates, regex and explicit nth. Does not click; returns all matches plus snapshot_id. |
| actA | One human-shaped verb: perform an interaction AND report what changed, in a single round trip. action = tap/long_click/double_click/set_text/append_text/clear/check/uncheck/read/scroll/key. Target a control with |
| learnA | Teach the agent what an app's unnamed controls DO, by probing and remembering. Many apps expose no label for their buttons (measured: 56.7% of tappable controls carry no text/description/id, and some apps report no clickable flag at all), so the only honest way to learn them is to act and observe. This taps one unknown control at a time, diffs the screen before/after, and persists the observed effect (opened a screen / dialog appeared / list scrolled / no visible change) under the current app+activity. Destructive and financial controls (delete, pay, logout, uninstall, password fields) are refused and recorded as refused, never pressed. Results appear as |
| ui_describeA | Read the screen as CONTROLS, not pixels. Each tappable/viewable element is described from what Android itself reports - view class, resource-id name, accessibility description, supported action flags - never from OCR or vision. Returns a one-line summary, an ordered control list with role/label/actions/state, screen structure (top bar, bottom nav, dialogs, scroll containers, primary action), and a coverage line telling you how much the OS actually named. Prefer this over screenshots for understanding a screen. |
| ui_queryA | Find controls by OS-derived semantics instead of coordinates or pixels. Filter by role (button/text_input/toggle/tab/nav_back/nav_close/list_item/search), by label substring, by text substring, by stable semantic_key, or by region. Returns matches with their semantic_key, which stays valid when the layout moves - use it to replay an action on the same control later without storing a tap position. |
| element_actionA | Act on exactly one matching element: tap/long_click/double_click/set_text/append_text/clear/check/uncheck/read. Ambiguous/stale/disabled targets fail explicitly. Returns a compact ack, not a tree: set return_ui=true only when the next step needs the whole page, otherwise observe with ui_snapshot(since_snapshot_id=...) and pay only for the delta. |
| wait_for_conditionB | Wait for exists/gone/foreground/shell-exit-and-output/stable UI. Missing UI transport never counts as 'gone'. Replaces blind sleep calls. |
| fill_formA | Fill several fields (including Chinese/Emoji) and optionally submit in one tool call. Stops at the first failed field. One tree dump total, not one per field. |
| run_workflowB | Execute a fully prevalidated UI/Root workflow in ONE call: launch/tap/input/key/swipe/wait/assert/shell/if/repeat/sleep/read_text. Supports per-step postconditions, on_error, bounded loops/deadline and trace. No blind retries of non-idempotent actions. |
| workflow_controlA | Inspect or cooperatively cancel an active workflow from another request. Cancellation stops subsequent steps; in-flight device/RPC calls finish or time out first. |
| saved_workflowB | Persist/reuse named workflows: list/save/load/run/delete. Save validates all steps before atomic storage; works across MCP restarts. |
| shell_executeB | Run an arbitrary Android shell command, optionally su uid=0. Returns real exit_code/stdout/stderr/timeout/truncation. Device-side timeout when supported; never invokes a host shell. |
| shell_batchA | Run 1..200 CLI commands in ONE ADB process/Root session. Per-command exit codes and output, optional fail-fast; avoids one subprocess/tool call per command. |
| adb_commandB | Raw selected-device ADB command escape hatch (e.g. bugreport, jdwp, shell am instrument). Arguments passed directly to native adb, no host shell. Prefer typed tools for timeouts and validation. |
| device_jobB | Background device processes: list/start/status/output/cancel/cleanup. Use for logcat, instrumentation, perfetto, tcpdump if installed. Persistent handles, bounded stdout/stderr, incremental byte offsets and PID-reuse checks. timeout=0 explicitly allows indefinite work. |
| device_filesA | Root file manager: list/stat/read/write/append/hash/mkdir/chmod/copy/move/delete. Text or base64, atomic replacement, preserve existing ownership/mode, backup by default, optional compare-and-swap SHA256. Use transfer for large files/trees. |
| app_actionC | List/info/paths/launch/stop/restart/clear/enable/disable/uninstall apps; install/install_multiple local APKs (base+splits), explicit downgrade/test/permission switches. clear/uninstall remove user data. |
| app_permissionsB | Inspect/grant/revoke permissions or set a named appop. grant_runtime_all intersects declared permissions with device dangerous-runtime list and reports failures individually; does not silently enable all special privileges. |
| export_apksA | Export an installed app's base APK and ALL split APKs to a host directory for development/testing. |
| send_intentB | Root/nonroot typed Intent: activity/broadcast/service/foreground_service/stop_service, internal components, DeepLinks, MIME/categories/flags, bool/int/long/float/string/null extras. Reports am errors even if exit code is zero. |
| system_settingsA | Read/list/put/delete exact Android global/system/secure settings; returns command failure rather than claiming unsupported settings succeeded. |
| agent_profileB | Apply/list/restore an Agent speed profile. Saves exact original animation/stay-awake values BEFORE changes and restores them (including absent keys) by profile_id on the same device. |
| device_controlB | Control wifi/bluetooth/mobile_data/airplane_mode, brightness, rotation, screen_size, density, volume, wake/sleep/dismiss_keyguard, notifications/quick_settings/collapse_panels, reboot/recovery/bootloader/shutdown. ROM support varies. Reboot/network changes may disconnect ADB. |
| system_propertyA | Read Android properties or set them using setprop; resetprop=true explicitly requests the installed Root resetprop utility. Does not install/assume Magisk. |
| content_providerA | Direct zero-UI ContentProvider query/insert/update/delete/call/gettype with typed bindings. update/delete require explicit where ('1' intentionally means all rows). ROM/provider authorization still applies. |
| shared_preferencesB | Read/set/delete typed private XML preferences (string/int/long/float/boolean/set). Writes stop the app, preserve ownership/mode, back up old XML and check its hash. values={key:{type:'boolean',value:true}}; leaves app stopped. |
| sqlite_databaseA | Query a private SQLite DB without a phone sqlite3 binary; copies DB+WAL+SHM, parameterized SQL, BLOB base64 and bounded rows. write=true requires package+stop_app=true; backs up sidecars and installs an atomic checkpointed DB, leaving app stopped. Live reads are best effort. SQLCipher needs its own engine/key. |
| app_data_archiveA | Backup/restore one app's CE or DE private data as tar+SHA256 manifest. Stops app. Restore validates member paths/manifest, keeps pre-restore data backup, restores UID/SELinux; replaces data, leaves app stopped. Keystore/TEE/external storage excluded. |
| port_forwardB | ADB forward/reverse list/add/remove for tcp/localabstract/localfilesystem/jdwp endpoints. tcp:0 allocates a port. No host shell; no-rebind avoids replacing another debugger's mapping. |
| device_diagnosticsB | Collect summary/memory/cpu/graphics/network/crashes/activity/services/power or bundle. Executes probes in one ADB session; optional persistent host report directory for regression evidence. |
| perform_gestureC | Perform a multi-point swipe path or pinch_in/pinch_out gesture through uiautomator2, avoiding repeated tap/swipe tool round trips. |
| webview_controlB | Fast WebView/Chrome control using exposed DevTools sockets: discover/pages/dom/click/fill/evaluate/navigate/close. Uses DOM/CSS instead of pixel clicks; only debuggable WebViews. evaluate/click/fill require optional websocket-client. |
| record_screenA | Background MP4 recording: start/status/stop/pull. Start immediately returns job_id; stop sends SIGINT for MP4 finalization, pull after completion. ROM screenrecord limits apply. |
| compare_screenshotB | Pixel regression check against a local baseline PNG/JPEG. Captures one frame, compares dimensions/changed-pixel ratio/bounds, optionally saves current/diff; useful for Canvas UI verification. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| android_development_task | A reusable plan for efficient Android development/verification. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| capabilities_resource | Android Root MCP v2 capability catalog and workflow guidance. |
TDQS
Scored across 57 tools
Multiple clusters of near-duplicate tools exist: tap_element / act / element_action / batch_ui_actions all perform interactions; ui_snapshot / get_ui_tree / ui_describe / ui_query / find_elements / inspect_view_hierarchy all read the screen; shell_execute / root_shell / adb_command / shell_batch all run commands; shared_preferences / sqlite_database / inspect_app_data / content_provider all read app data. The surface is effectively two overlapping generations of API (v1 'classic' tools plus a 'v2' agent toolkit announced by tool_catalog), so an agent must guess which of several plausible tools to use.
Most names are snake_case, but the conventions vary widely: verb_noun (get_ui_tree, run_workflow, send_intent), noun_verb (device_control, app_action, device_files, record_screen), bare verbs (act, learn), and noun-only names (tool_catalog, saved_workflow, adb_command). Individually readable, but there is no predictable pattern an agent can rely on to infer a tool's name.
57 tools is far past the 3-15 sweet spot, and much of the bulk is duplicated capability across v1 and v2 layers rather than genuinely distinct functionality. The Android-automation domain is broad enough to justify a large surface, but the overlap makes the set feel accumulated rather than curated.
Coverage is unusually thorough: UI perception and interaction, gestures, forms, workflows with persistence and cancellation, root and non-root shell, background jobs, file management and transfer, app lifecycle/permissions/APK export, intents, WebView control, screen recording, pixel regression, logcat triage, and LSPosed/KernelSU debugging. Almost every lifecycle stage has an entry point, with no obvious dead ends.