Skip to main content
Glama
android-reserve-mcp

android-reserve-mcp

by lonnnnnng

android-reserve-mcp

English

是什么

android-reserve-mcp 是一个面向 Android 逆向和产物分析的本地 MCP 服务。它通过 stdio 接入 Codex、Claude Code、OpenCode、Pi 或其他 MCP 客户端,在本机按需分析 APK、DEX、资源、Java/JNI、Native、WebView、Hermes/Flutter、Kotlin/Compose、KMP、MAUI 和 Godot 产物。

服务不把 APK 上传到云端,也不会自动选择设备、自动安装应用、静默注入第三方脚本或把静态候选说成运行事实。长任务使用有界 workspace 保存任务、日志、报告和证据图。

当前发布版是 0.5.4:

  • GitHub:v0.5.4

  • npm:android-reserve-mcp@0.5.4

  • Node.js:>=26.12.1

  • MCP 顶层工具:20 个

Related MCP server: JADX AQL

有什么能力

Android 产物和静态分析

  • 读取 APK、Manifest、签名、ABI、DEX、资源、smali 和 SHA-256。

  • 检查 APKS、AAB、split 的包名、长版本、证书、模块依赖和设备 spec 选择。

  • 查询 DEX 类、方法、引用、精确 JVM/DEX 签名和原始位置。

  • 读取 Kotlin metadata、suspend/inline、Compose 编译候选和 JavascriptInterface 声明。

  • 使用 JADX、apktool、aapt2、bundletool 等固定参数引擎,保留输入快照和预算诊断。

Java、JNI、Native 和运行时

  • 观测 Java 精确重载、Java 请求/回复对象身份、同线程父子调用和跨线程边界。

  • 读取 JNI 静态/动态注册、ELF、导出函数、RVA、函数引用、callers/callees 和伪代码。

  • 在明确设备、包名、PID 和所有权的前提下运行 Frida Java/JNI/Native 观测。

  • 使用 Mono 窄 ABI 观测 int32、bool、long、float、string,并回核 MVID、MethodDef 和 JIT 身份。

WebView、JavaScript 和框架

  • 采集已开放调试 WebView 的 DOM、脚本源码、Network、正文和有界 CDP initiator 栈。

  • 将同一 CDP scriptId 关联到脚本 SHA、AST 和网络请求。

  • 对 Hermes、Flutter、ILSpy、Godot、IL2CPP、Ark 等固定引擎执行有界分析,并保留版本/兼容警告。

  • 自有 Flutter R8 fixture 已验证 primitive/object MethodChannel 和 EventChannel sink 多回复。

  • 自有 Compose fixture 已验证点击→状态写入→重组/派生、多状态、导航和 coroutine MCP 多链。

  • 自有 RN fixture 已验证 JSI_CALL_ID → native marker → Fabric event ID → render sequence。

  • 自有 KMP business App 已完成 commonMain 到 Android UI/logcat/JADX 的回链。

证据和任务管理

  • 所有长任务返回任务 ID,通过 jobs 查询终态,再用 artifacts 分页读取报告。

  • 证据可按内容哈希、精确签名、调用 ID、JNI 对象身份、Mono 身份和 JSON pointer 关联。

  • verified、partial、candidate、unsupported 和清理未确认状态分开表达。

20 个工具

每个顶层工具内部通过 action 选择操作;action 数量不等于 MCP 工具数量。

工具

主要 action

能做什么

doctor

deep

检查路径、依赖和允许目录;深度模式实际导入 binding、编译 Java 模板、握手 REA

apk

inspect、signature、manifest

读取 APK ZIP、DEX、ABI、签名、Manifest 和哈希

decode

jadx、apktool、both

导出 Java、资源和 smali 到独立任务目录

dex

classes、class、method、references、kotlin

查询 DEX、引用、Kotlin metadata、Compose 候选和注解

packages

inspect、validate、decode、aab-manifests、select

检查 APKS/AAB/split 一致性、依赖和设备选择

managed

inspect、extract

读取 .NET assembly store、ELF payload、LZ4/Zstd 等有界容器

evidence

merge、query

合并任务证据,按哈希、签名和调用 ID 查询

webview

discover、open、scripts、source、dom、network、body、close

采集已开放调试 WebView 的页面、脚本、网络和正文

search

无

在已导出的源码目录中搜索文本或正则

resources

strings、view-events

分页读取字符串和 XML android:onClick 候选

native

elf、jni、open、functions、function、references、callers、callees、providers

分析 ELF/JNI、Native 函数和调用关系

artifact

inspect、extract

识别产物、嵌套包、ABI、框架候选并定向提取

script

index、format、map

静态索引 JS/TS/JSX/Flow 函数、调用点和 source map

framework

engines、probe、analyze、channels

调用固定 Hermes、Flutter、ILSpy、Godot 等框架分析器

device

list、inspect、packages、processes、logcat

只读访问明确 serial 的 ADB 设备

frida

devices、processes、attach、spawn、load、runtime、java-methods、trace-java、trace-java-group、trace-mono、trace-jni、trace-native、resume、status、unload、close

运行 Java/JNI/Native/Mono 和 Promise 边界观测

rebuild

build、sign

重建 apktool 工程、zipalign、签名和复验

jobs

list、status、cancel

查询、取消和回收长任务

artifacts

list、read

分页读取任务产物、日志和报告

guidance

list、read

读取允许的本地 Android 逆向 Skill 和参考资料

完整参数、常用 action 和证据字段见工具与用法参考。

快速安装

npm 安装

npm install -g android-reserve-mcp@0.5.4
node "$(npm root -g)/android-reserve-mcp/src/cli.js" --version

启动时必须明确允许读取的目录和任务 workspace:

node "$(npm root -g)/android-reserve-mcp/src/cli.js" \
  --allowedRoots /absolute/path/apk-projects \
  --workspace /absolute/path/android-reserve-workspace

从源码运行

git clone --branch v0.5.4 https://github.com/lonnnnnng/android-reserve-mcp.git
cd android-reserve-mcp
npm ci --ignore-scripts
node src/cli.js --version

接入 Agent

这是本地 stdio MCP,不是公网 HTTP 服务。Agent 和 MCP 服务应在同一台机器上运行。

  • 通用 MCP:复制 examples/mcp.json,替换 command、allowedRoots 和 workspace。

  • OpenCode:复制 examples/opencode.json,或参照当前客户端配置;OpenCode 工具通常显示为 android-reserve_*。

  • Claude Code、Codex CLI、Pi:使用 Agent 接入指南 中对应的 mcp add 命令。

  • 需要限制某个 Agent 时,在 Agent 级权限中关闭 android-reserve_*,不必删除 MCP 连接。

建议优先使用独立 workspace,并让 Agent 首先调用 doctor。GUI Agent 如果无法继承终端 PATH,应使用 Node.js 绝对路径。

怎么使用

第一次调用

按这个顺序建立最小闭环:

{"tool":"doctor","arguments":{}}
{"tool":"apk","arguments":{"action":"inspect","path":"/absolute/path/apk-projects/app.apk"}}
{"tool":"jobs","arguments":{"action":"status","jobId":"<job-id>"}}
{"tool":"artifacts","arguments":{"action":"read","jobId":"<job-id>","path":"result.json"}}

常用静态流程

  1. doctor 检查依赖和路径。

  2. apk.inspect、apk.signature 确认输入身份。

  3. packages.validate 或 packages.select 处理 APKS/AAB/split。

  4. decode、dex、resources、search 逐步缩小目标。

  5. 长任务用 jobs.status 等待终态,再用 artifacts.read 读取原始报告。

  6. 需要跨任务关系时使用 evidence.merge/query,不要按时间或 PID 猜因果。

常用动态流程

  1. 明确设备 serial、包名和 PID;服务不会自动选设备。

  2. device.inspect、device.processes 确认目标身份。

  3. Java 先用 frida.java-methods 读取实际 overload;自定义 loader 先用 frida.java-loaders。

  4. 使用 attach/spawn、load、status、resume、unload、close 完成生命周期。

  5. 动态结果必须同时检查 PID、原方法返回、事件、清理状态和 partial 标记。

本地开发命令

node src/cli.js --version
npm test
npm run check
npm run check:pack
npm run smoke:release
npm run smoke:release:full

smoke:release 验证 tarball、20 个工具和基础 doctor;smoke:release:full 还会安装两套 Frida binding、运行深度 doctor 和完整协议验收。

边界和不支持范围

  • allowedRoots 是输入路径边界,不是操作系统沙箱;workspace 可能包含敏感分析产物。

  • partial、candidate 和 unsupported 不能当成完整恢复;静态候选不等于运行因果。

  • 动态分析必须明确 serial、packageName 和 PID;不会自动安装、启动、选择设备或提升权限。

  • Flutter typed bridge、EventChannel 和 Compose 多链只在已验证的 POCO F2 Pro / Android 16 / ARM64 / Frida tuple 与自有 fixture 上成立。

  • RN 第三方 APK 只支持开放 inspector 的只读探测;未开放时返回 unsupported,不做静默 JS/Frida 注入。

  • Compose matcher 依赖显式 hooks 和自有业务 marker,不能泛化任意 Compose 应用。

  • Mono 只覆盖已加载 Mono、ARM64、非泛型窄 ABI;数组/对象、CoreCLR、NativeAOT、byref 和复杂结构不支持。

  • Hermes HBC99 需要显式实验开关;任意版本的 Hermes、完整 JS 源码恢复和 .then() 因果不保证。

  • WebView 必须已开放调试;公网网络稳定性、TWA、Service Worker 全量语义和跨会话 JS→Java 因果不保证。

  • Unity、Unreal、HarmonyOS NEXT 当前暂缓;Godot C# 和多版本矩阵仍未完成。

  • 本轮没有做跨设备/ROM 回归,不把单设备结果推广到其他环境。

更多状态、证据和限制见能力矩阵、动态关联指南、稳定性进展 和路线图。

开发接入指南

开发环境

git clone https://github.com/lonnnnnng/android-reserve-mcp.git
cd android-reserve-mcp
npm ci --ignore-scripts
npm test
npm run check
npm run check:pack

要求 Node.js >=26.12.1。完整静态链还可能需要 JDK 17+、Python、JADX、apktool、Android SDK、REA 和对应框架引擎;按能力阅读 ENVIRONMENT.md 和 ENGINE-SETUP.md。

扩展一个工具

  1. 在 src/server.js 增加公开 schema 和工具描述。

  2. 在 src/actions.js 或对应 src/core/*.js 实现 action。

  3. 给路径、预算、超时、设备/PID 所有权和清理失败加边界。

  4. 在 test/ 增加离线回归;动态能力必须保留真实事件和失败现场。

  5. 同步 docs/TOOL-REFERENCE.md、docs/CAPABILITIES.md、docs/VALIDATION.md 和 CHANGELOG。

  6. 运行 npm test、npm run check、npm run check:pack、git diff --check。

证据和安全要求

  • 不把 APK、DEX、SO、keystore、设备日志、个人路径、API Key 或私有 workspace 提交进仓库。

  • 不按时间、PID、RVA 或相似文本猜跨层因果;关系必须有哈希、精确签名、调用 ID、对象身份或来源 pointer。

  • 外部 CLI 必须固定参数、版本和预算,拒绝任意命令透传。

  • 动态观测必须区分 setup failure、unsupported、partial、真实业务事件和清理未确认。

  • 代码注释使用中文并标记作者 long;业务规则和安全边界要贴近实现代码。

发布和 CI

  • 版本统一检查 package.json、package-lock.json、src/version.js、CHANGELOG 和文档。

  • 发布前运行完整本地门禁:npm test、npm run check、npm run check:pack、npm run smoke:release:full、npm audit --omit=dev。

  • GitHub Actions 只在 release.published 时运行 Ubuntu/macOS test 和 full-install 矩阵;普通 push 和 pull request 不触发。

  • npm 发布需要有包维护权限;发布后回验 npm view android-reserve-mcp version dist-tags。

  • 发布配置、Agent 接入和回滚说明见 MAINTENANCE.md。

相关文档

安全与许可

不要把 API Key、私钥、设备凭据或个人路径提交到仓库。Frida、JADX、apktool、Android SDK 和 REA 等外部工具各自遵循其许可证;本项目代码采用 MIT。

MIT © long

Available Tools

20 tools
apkB
Read-only

APK ZIP/DEX/ABI 摘要、签名复验或 Manifest 摘要。返回任务;随后读 result.json。

Inputs: path (required), action (required).

artifactA
Destructive

按内容识别产物、嵌套包/模块/ABI与框架候选;支持文件或目录。extract按inspect返回的chain定向提取到任务目录,不覆盖原文件。

Inputs: path (required), action (required), chain.

artifactsA
Read-only

列任务产物或按字节 offset 读取文件;只读本服务任务目录,最多 32KB 一页。

Inputs: jobId (required), action (required), path, limit, +1 more.

decodeB
Destructive

JADX/apktool 解包到独立任务目录;报告部分失败,不覆盖已有工程。

Inputs: path (required), engine, timeoutSeconds.

deviceB
Read-only

ADB 设备列表或明确 serial 的 getprop/packages/processes/logcat;不安装/卸载。

Inputs: action (required), limit, serial.

dexC
Read-only

DEX类/方法/引用与Kotlin。methodId或descriptor使用原始完整签名;packageJobId复用已验证分包,members显式选择APKS。mapping只添加原名投影,重复定义保留歧义。includeSource可展示已唯一选择的类源码。

Inputs: action (required), path, query, members, +9 more.

doctorB
Read-only

默认检查路径且不启动REA;deep=true返回任务,实际导入Frida binding、编译固定Java模板并握手REA。深度检查不连接设备。

Inputs: deep, timeoutSeconds.

evidenceC
Read-only

合并已完成任务的持久证据索引,按内容哈希/签名/同脚本调用ID查询;不把时间接近、相同路径或PID当跨任务关联。

Inputs: action (required), kind, limit, query, +3 more.

frameworkB
Destructive

列引擎/探测/分析:Hermes、Blutter、ILSpy、GDRE、IL2CPP、Ark。flutter channels用APK与同工作区analysisJobId核对配对库,输出Dart/Android静态协议候选。Blutter需allowEngineBuild,HBC97–99需allowExperimental且partial。

Inputs: action (required), path, engine, mappingPath, +5 more.

fridaB
Destructive

明确设备的attach/spawn/load/resume/status/close;java-loaders枚举唯一selector,java-methods读取默认或显式唯一loader方法重载,trace-java需显式argumentTypes,可同agent nativeHooks按线程/调用范围关联JNI。trace-java-group用同agent多方法线程栈及JNI对象身份关联请求/回复,不按时间猜测;trace-mono实验解析Mono ARM64非泛型窄ABI方法(int32/bool/long/float/string、静态或显式instance)并回核JIT信息,需要显式允许运行时准备入口;trace-jni观测未来动态注册/撤销;Native选择symbolName或模块rva二选一,未加载模块等待时间有限且可缩短。unload只撤销本服务scriptId。

Inputs: action (required), pid, rva, deviceId, +22 more.

guidanceB
Read-only

列或按需分页读取本地 Android 逆向 Skill/参考文档;不自动执行其中命令。

Inputs: action (required), name, path, limit, +1 more.

jobsB
Destructive

列任务、查状态或取消长任务;长结果不直接塞进上下文。

Inputs: action (required), jobId.

managedB
Destructive

离线inspect/extract已核验的.NET assembly store或XALZ/XAZS压缩程序集;ELF按_assembly_store符号或唯一payload节定位,不执行目标。提取后用framework.ilspy分析PE/CLI。

Inputs: path (required), action (required).

nativeC
Destructive

ELF/JNI/Go/Rust;open独占后端并返回任务,结果含targetId。随后functions/function/references/callers/callees/status,最后close;providers检查引擎。

Inputs: action (required), path, provider, targetId, +3 more.

packagesC
Destructive

对显式所选APK集合校验包名/版本/全部签名证书/split依赖;APKS需members,不能混合设备变体。decode只在一致性通过后聚合DEX并按模块导出资源。

Inputs: path (required), action (required), engine, members, +1 more.

rebuildA
Destructive

重建 apktool 工程或用明确 keystore 签名并复验;密码使用环境变量名,不自动安装。

Inputs: path (required), action (required), alias, keystore, +1 more.

resourcesC
Read-only

资源字符串分页;可扫描已解码XML或APK中的View android:onClick声明,输出待DEX核对的候选,不证明运行时行为。

Inputs: path (required), limit, action, locale, +2 more.

scriptB
Read-only

离线JS/TS/JSX/Flow索引或格式化,返回函数/依赖/调用点/字符串/URL;不执行代码。map只读取显式mapPath映射位置。

Inputs: path (required), action (required), line, column, +2 more.

webviewA
Destructive

明确serial/packageName/pid的已开放调试WebView。discover/open后scripts/source/dom/network/body,最后close。只采集Network启用后事件;不用外部URL,不强制开调试。

Inputs: action (required), pid, serial, rootRead, +5 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 20 tools

    Disambiguation3/5

    Most tools carve out distinct niches (dex vs native vs managed vs framework vs webview), but the singular/plural pair `artifact` (identify/extract arbitrary files) and `artifacts` (list task outputs / read bytes) is genuinely confusing, and `packages` overlaps with `device`'s package listing while `decode` overlaps with `artifact`'s extract. Descriptions are dense and help, but several boundaries require careful reading of Chinese prose to resolve.

    Naming Consistency4/5

    All names are single lowercase tokens with a consistent style, no camelCase/snake_case mixing. However the set mixes resource nouns (dex, apk, device, webview, resources) with action verbs (rebuild, decode, search, doctor), so there is no single predictable pattern, and `artifact`/`artifacts` differ only by an 's'.

    Tool Count3/5

    20 tools sits at the heavy end for a reverse-engineering server; each has a plausible role, but the surface is large enough that an agent must juggle many entry points (doctor, jobs, artifacts, evidence) before doing real work. It is not excessive for the breadth of domains covered, but it is borderline.

    Completeness4/5

    Coverage is broad and lifecycle-aware: device enumeration, APK decode/validation, DEX/resources/search, native/IL2CPP/managed/.NET analysis, Frida tracing, WebView inspection, rebuild+sign, and evidence/job/artifact plumbing. Gaps are minor — no explicit smali/patch-and-repack editing tool and no general memory-dump or non-WebView network capture — but agents can work around these via rebuild and native.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables offline Android package analysis by loading APK, DEX, JAR, class, and XAPK files to inspect app metadata, manifests, classes, methods, resources, strings, and cross-references, and to export decompiled Java sources through CRUDE MCP-AQL tools.
      AGPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables agents to inspect Android APKs, device state, runtime behavior, resources, and native libraries locally, returning findings with supporting evidence, coverage, limitations, and unknowns.
      11
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables Codex users to query an evidence-backed Android reference atlas, inspect projects, plan APK/firmware investigations and acceptance work, check explicit contracts, and analyze supplied frame captures through thirteen local read-only tools.
      MIT