Skip to main content
Glama

wx-mp-mcp

微信小程序逆向 MCP

把小程序接口的签名 / 加密参数,还原成一个本地 Node.js 就能直接跑的脚本

MCP Node WeChat Platform NonInvasive

一个 MCP(Model Context Protocol)Server,装进你的 AI 编码工具(Claude Code / Cursor / Codex),让 AI 自动完成微信小程序的解包 → 抓包 → 签名分析 → 本地复现。


实时解包

Mac + Windows

直接读磁盘上的加密包(.wxapkg)离线解密成可读 js 源码,主包 / 分包 / 插件全解。微信开不开都行。

数据抓包

mitmproxy 拦截

HTTPS 代理拦下小程序真实请求,自动存成结构化样本——每条带 url、参数、sign 签名字段。

AI 离线分析

还原本地 Node 黑盒

AI 读 js 定位签名算法 → 穷举反推 / 沙箱实跑复现 → 导出脱离微信的独立签名脚本。

🛡️ 不碰微信进程:全程只做「读磁盘加密包 · 走代理被动抓流量 · Node 跑解包出的代码副本」三件事,不 attach 微信、不改内存、不开调试端口——不会让微信环境异常或触发风控。(传统 Frida / WMPFDebugger 要注入微信进程改内存,有封号风险,本工具刻意避开。)


多数无混淆小程序,mp_analyze 一步就能定位签名并生成复现代码(走得出 → 直接导出);只有签名被运行时加密 / JSVMP 混淆、静态读不出时,才走 抓包 → 破解 / 沙箱 那条支线。


1. 安装

方式一(推荐) —— 直接对你的 AI 编码工具说:

帮我安装下这个 mcp 工具:wx-mp-mcp
项目地址:https://github.com/WhiteNightShadow/wx-mp-mcp

AI 会自动克隆、装依赖、构建、写好 MCP 配置。

方式二 —— 手动:

git clone https://github.com/WhiteNightShadow/wx-mp-mcp.git
cd wx-mp-mcp && npm install && npm run build

2. 配置到客户端

{
  "mcpServers": {
    "wx-mp-mcp": {
      "command": "node",
      "args": ["/绝对路径/wx-mp-mcp/dist/index.js"]
    }
  }
}
claude mcp add wx-mp-mcp -- node /绝对路径/wx-mp-mcp/dist/index.js

抓包额外准备:抓包属于可选能力,需在本机安装 mitmproxy(pip install mitmproxy 或 brew install mitmproxy)。代理接入与证书配置由用户根据自己的采集环境完成;其余工具无额外外部依赖。

⚠️ macOS 提示「容器目录受权限保护」/ 找不到缓存 / 解包阻塞:微信缓存在沙盒容器里,受 macOS TCC 保护。MCP 是被你的 AI 工具拉起的 node 子进程,继承上层程序的权限。若报「受保护」「找不到缓存」,二选一:

  • 推荐:系统设置 → 隐私与安全性 → 完全磁盘访问权限 → 添加运行 MCP 的程序(Terminal / iTerm / Cursor / Claude)→ 完全退出再重开。

  • 兜底:用访达把 .../radium/Applet/packages 复制到项目下的 wxapkg-cache/(或 ~/Desktop/wxapkg-cache),会被自动发现;也可复制到任意目录后设 WXAPKG_ROOT 指向它。

多账号 / 不同微信版本下缓存可能落在 .../radium/users/<账号哈希>/... 等层级,现已自动递归探测并合并,无需手配。

Windows:新版微信 4.0(xwechat) 的小程序包在 %APPDATA%\Tencent\xwechat\radium\Applet,旧版 3.x 在 Documents\WeChat Files\Applet,两者均自动探测。注意 Documents\xwechat_files\ 是聊天文件存储、通常不含 wxapkg。

3. 上手示例

把目标告诉 AI,它会自动走上面的工作流:

分析小程序 wxXXXXXXXXXXXXXXXX 的接口 POST https://api.xxx.com/order/create,定位其 sign 签名算法,导出一个本地可独立运行的 Node 签名脚本。

完成后你本地:

node signer.mjs '{"ts":"1719000000","orderId":"123"}'
# → 输出 sign,脱离微信直接复现接口请求

工具

作用

解包分析

mp_list_apps

列出本机微信缓存的所有小程序(appid / 版本 / 包数量)

mp_decrypt

解密提取单个 .wxapkg(传 appid 自动找最新,或传文件路径)

mp_analyze

一键分析:解密解包(主包+分包+插件) → 签名/加密定位 → API 抽取 → 复现代码生成 → 报告(含 crackHint:候选密钥+算法+参数序)

mp_analyze_all

批量分析本机全部缓存小程序

抓包

mp_capture_start

启动 mitmproxy 代理抓包,请求自动存成结构化 JSONL(默认 :8080,可按 URL 过滤)

mp_capture_list

查看抓到的请求,自动标出 sign / token 等签名字段

mp_capture_stop

停止抓包,返回文件路径与请求数

mp_capture_import

导入已有抓包 → 归一成 JSONL(HAR / cURL / JSON 体 / JSONL,自己抓的包直接用,免走代理)

签名破解

mp_sign_crack

签名穷举:抓包样本 → 枚举参数子集 × 算法(HMAC/MD5/SHA/AES/DES/3DES) → 反推精确公式并生成复现代码(传 report 直接吃 mp_analyze 的候选密钥+算法,免手动搬运)

离线沙箱

mp_sandbox_modules

列出 bundle 里的所有模块,定位 SDK 签名模块位置

mp_sandbox_run

在离线 Node 沙箱加载 app-service.js,执行任意 js(直调签名函数验证)

mp_sandbox_export

导出独立签名脚本:追踪依赖、提取最小模块子集,生成不依赖 sandbox / bundle 的自包含 .mjs

分析产物(落在 static/out/<appid>/):可读源码树 app/、报告 report.json + REPORT.md、复现代码 repro.node.mjs + repro.python.py、独立签名脚本 signer.mjs。


使用中遇到问题、想反馈 bug、或交流逆向思路,欢迎加微信:

微信号:han8888v8888(加好友请备注「wx-mp-mcp」)


v0.1.3 — 缓存探测兼容性 + macOS 权限诊断

  • 缓存目录递归自动探测:不再写死单一路径,从微信缓存锚点递归发现所有含 <appid>/<版本>/*.wxapkg 的「包根」。修复多账号 / 不同微信版本下缓存落在 .../radium/users/<账号哈希>/... 等非默认层级时 mp_list_apps 返回 0、mp_analyze 报「未找到缓存包」的问题;多账号自动合并去重。

  • Windows 新版微信 4.0(xwechat) 支持:补 %APPDATA%\Tencent\xwechat\radium\Applet 路径(旧版 WeChat Files\Applet 仍兼容);递归时跳过聊天/媒体/缓存等重目录,避免扫 xwechat_files 的大体积归档拖慢。

  • macOS 权限保护可诊断:扫描遇到 TCC 容器保护(EPERM/EACCES)时不再静默吞掉,明确提示「授予完全磁盘访问权限」或「复制副本」两条解法;副本放进 wxapkg-cache/ 等位置自动发现。WXAPKG_ROOT 支持多路径(: / ;)覆盖。

  • mp_decrypt 传裸 appid 可自动定位最新缓存,输出落到项目内安全目录而非受保护容器。

v0.1.2 — 沙箱通用加固(实战打磨)

  • realm 自洽:沙箱不再注入外层内建,[].push === Array.prototype.push,JSVMP/字节码解释器不再崩。

  • webpack 惰性取模块:覆盖全局 jsonp 与内嵌 {id:fn} 两种形态,只实例化目标模块子树、不引导 app。

  • 多 bundle 协同:分包签名 SDK 依赖主包 runtime 时,bundle_paths 拼接单次载入。

  • JSVMP 友好:runInContext(code, ms) 带超时执行(同步死循环可中断)、调用后清退心跳定时器;补齐 wx.getRandomValues/getLogManager、performance/atob/btoa、可配 UA。

  • 网关签名检测:识别 hmac-auth / x-hmac-digest / mtgsig / wsgsig / __NS_sig 等签名协议,消除「重度签名却报无签名」假阴性。

  • 解包↔沙箱路径统一 + 报错清噪(不再回吐整包源码/命令行)。

v0.1.1

  • 新增 mp_capture_import:已有抓包(HAR / cURL / JSON 体 / JSONL)一键归一,自己抓的包直接喂破解,免走代理。

  • analyze→crack 自动桥:mp_analyze 报告多吐 crackHint(候选密钥 + 算法 + 参数序),mp_sign_crack 传 report 直接消费,少一次人工搬运。

v0.1.0

  • 11 个工具打通完整链路:实时解包 → mitmproxy 抓包 → AI 离线分析 → 导出本地 Node 黑盒脚本,经 MCP 暴露给任意 AI Agent。

  • Mac + Windows 缓存目录自动探测(WXAPKG_ROOT 可手动指定)。

  • 不碰微信进程:磁盘加密包离线解密(V1MMWX)+ 被动抓包 + Node vm 沙箱,无内存改写、无进程注入。

  • 签名多信号判定:拦截器 / 安全 SDK / 签名头 / 响应解密联合判定,避免「误报无签名」。


⚠️ 仅用于对自有 / 已授权小程序的安全分析与接口对接。不得用于未授权访问、绕过他人系统安全机制或违反服务条款的行为。

Available Tools

12 tools
mp_analyzeOne-click static analysisB

一键静态分析:解密解包(主包+分包+插件) → 签名/加密定位 → API 抽取 → 复现代码生成 → 结构化报告。输入 appid 或 '--active' 自动检测运行中的小程序。产出 report.json + REPORT.md + repro.node.mjs + repro.python.py。

Inputs: appid (required).

mp_analyze_allBatch analyze all cached mini programsA

批量分析本机缓存的所有小程序。耗时较长,适合全面扫描。

Inputs: no named parameters.

mp_capture_importImport existing captureA

把已有抓包归一成 sign-crack 兼容的 JSONL —— 用户自己用任意工具抓的包可直接导入,无需再走 mp_capture_* 代理。支持 HAR(Charles/Fiddler/DevTools)、cURL(DevTools 复制)、JSON 请求体、JSONL。自动扁平化 JSON 体、折入 GET query 参数,并标出带 sign 字段的请求。

Inputs: out, input, format, api_url, +2 more.

mp_capture_listList captured requestsB

查看当前抓包文件内容。返回最近的请求概览(URL/method/sign字段)。可指定 capture_file 路径,默认读取最新的抓包文件。

Inputs: limit, url_filter, capture_file.

mp_capture_startStart traffic captureB

启动 mitmdump 代理抓包。手机配置代理后,小程序请求自动记录为 sign-crack 兼容的 JSONL。默认监听 8080 端口。可选 url_filter 只抓包含指定关键词的 URL。

Inputs: port, url_filter.

mp_capture_stopStop traffic captureA

停止 mitmdump 抓包进程,返回捕获的文件路径和请求数。

Inputs: no named parameters.

mp_decryptDecrypt and extract wxapkgA

解密并提取 wxapkg 包。可传 appid(自动找最新缓存)或 wxapkg 文件路径。输出解包后的文件列表。

Inputs: target (required).

mp_list_appsList cached mini programsA

列出本机微信缓存的所有小程序 appid、版本号、包数量。无副作用,用来决定分析哪个 appid。

Inputs: no named parameters.

mp_sandbox_exportExport standalone signerA

从沙箱导出独立 Node.js 签名脚本。追踪签名函数的依赖模块,提取最小子集,生成不依赖 wx-sandbox / app-service.js 的自包含 .mjs 文件。流程:加载 bundle → 运行 verify 验证签名能跑通 → 追踪依赖 → 生成独立脚本。需要先 mp_analyze 解包 + mp_sandbox_run 确认签名函数路径。

Inputs: appid (required), entry (required), fn, output, +2 more.

mp_sandbox_modulesList sandbox modulesA

列出小程序 bundle 中注册的所有模块路径。用于发现 SDK 签名模块位置。需要先 mp_analyze 解包。分包签名 SDK 依赖主包 runtime 时用 bundle_paths 传[主包,分包]协同加载。

Inputs: appid (required), bundle_path, bundle_paths.

mp_sandbox_runRun code in mini-program sandboxA

在离线沙箱中加载小程序 bundle (app-service.js),执行任意 JS 代码。用于调用 SDK 签名函数、分析加密逻辑、提取运行时数据。需要先 mp_analyze 解包。 【eval 作用域契约】代码运行在 ESM AsyncFunction 里,注入 5 个参数: · ctx —— 沙箱上下文 (ctx.sandbox / ctx.requireMod / ctx.wpRequire / ctx.setTimestamp 等) · requireMod(path) —— 按 WeChat 模块路径取模块;wpRequire(id) —— 按 webpack 数字 id 取模块(惰性、不引导 app) · sandbox —— 沙箱全局对象:微信全局走 sandbox.wx / sandbox.getApp(),模块工厂里 self===sandbox · runInContext(code, ms=8000) —— 在沙箱 realm 内【带超时】执行(同步死循环会抛 timeout 而非拖死);JSVMP/VMP 签名调用建议用它 注意:这是 ESM 上下文,没有 node 的 require;要用 globalThis.crypto / Buffer。 分包里的签名 SDK(依赖主包 runtime)用 bundle_paths 传[主包,分包]协同加载。

Inputs: code (required), appid (required), ua, device, +4 more.

mp_sign_crackBrute-force sign parametersA

签名参数穷举破解:给定抓包样本(JSONL) + 密钥,自动枚举参数子集 × 算法(HMAC/MD5/SHA/AES/DES),找到产生该 sign 的精确公式并生成复现代码。传 report 可直接吃 mp_analyze 的 report.json(自动载入候选密钥+算法+参数序,免手动 key/source);也可传 source_dir 从源码提取密钥。

Inputs: key, inline, report, sign_field, +3 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 12 tools

    Disambiguation4/5

    The tools map to fairly distinct pipeline stages: discovery, decryption, static analysis, sandbox inspection/execution/export, signature cracking, and traffic capture. There is some overlap—mp_analyze subsumes mp_decrypt and also generates repro code that overlaps with mp_sandbox_export and mp_sign_crack—but the descriptions and stated prerequisites make the intended boundaries reasonably clear.

    Naming Consistency4/5

    All tools share the mp_ prefix and most follow a predictable mp_<domain>_<action> pattern (mp_capture_start, mp_sandbox_run, mp_sign_crack). A few early tools omit the domain segment (mp_list_apps, mp_analyze, mp_decrypt), which is a minor inconsistency but still readable and predictable.

    Tool Count5/5

    With 12 tools, the set is well within a healthy range and each tool appears to earn its place in the reverse-engineering workflow. There are no obvious redundant tools purely for count padding; batch analysis, capture lifecycle, and sandbox steps are all purposeful.

    Completeness4/5

    The surface covers the full lifecycle from app discovery and traffic capture through decryption, static analysis, sandbox execution, signature cracking, and standalone script export. Minor gaps remain: there is no tool to read back generated report.json/REPORT.md artifacts or to manage/clean up analysis outputs and capture sessions.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables AI coding assistants to debug and analyze WeChat MiniApp JavaScript code via Chrome DevTools Protocol. Supports network interception, breakpoint debugging, script analysis, and runtime inspection for reverse engineering purposes.
      19
      253
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Exposes reverse engineering capabilities via MCP protocol, enabling AI agents to automatically detect, analyze, trace, and deobfuscate JSVMP protected JavaScript code.
      1
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to conduct authorized mobile banking reverse engineering and security research through 50+ MCP tools spanning APK analysis, Frida instrumentation, malware detection, Play Integrity bypass detection, no-root traffic interception, and evidence reporting.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables dynamic reverse engineering and debugging of WeChat MiniProgram JavaScript through the Chrome DevTools Protocol, letting AI agents enumerate and search scripts, set breakpoints, step through paused frames, trace function calls, hook miniprogram APIs such as wx.request, and capture network requests to analyze encryption, signing, and anti-scraping logic. It also works against Chrome, Node.js, and Electron runtimes, with tools for extracting code bundles and page business logic.
      11 npm
      1
      MIT