wx-mp-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| WXAPKG_ROOT | No | Optional path (or multiple paths separated by `:` / `;`) pointing to a directory containing WeChat mini-program `.wxapkg` caches. Used when the default cache location cannot be detected (e.g., macOS TCC-protected containers) or when using a copied cache directory. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
wx-mp-mcp —— 微信小程序逆向分析(零侵入:只读磁盘加密包 + 走代理抓包 + Node 沙箱跑副本,绝不接触微信进程内存)。 目标:把小程序接口的 sign/加密参数还原成本地 Node.js 能独立跑的脚本。
典型流程与决策树(按此自主推进):
mp_list_apps → 选定目标 appid。
mp_analyze → 解包 + 定位签名 + 抽 API + 生成复现代码。读返回的 verdict 决定下一步: • 「无签名」→ 已生成 repro.node.mjs,可直接用,结束。 • 「有签名」且 crackHint.candidateKeys 非空 → 走【穷举破解】(第 3 步)。 • 「有签名」但 candidateKeys 为空(SDK级签名,如美团 mtgsig/滴滴 wsgsig)→ 走【沙箱复现】(第 4 步)。
穷举破解:拿一条真实请求样本 → mp_sign_crack(capture_file=样本, report=该 appid 的 report.json)。 样本来源二选一:① 已有抓包(HAR/cURL/JSON)→ mp_capture_import;② 没有 → mp_capture_start→(操作小程序)→mp_capture_list→mp_capture_stop。
沙箱复现:mp_sandbox_modules 找签名模块 → mp_sandbox_run 调用验证 → mp_sandbox_export 导出独立 signer.mjs。
产物都在 static/out//:report.json(结构化,含 crackHint) / REPORT.md / repro.node.mjs / repro.python.py / signer.mjs。
要点:mp_analyze 返回里带 reportPath 与 nextStep 建议,按它走即可;sandbox/sign_crack 需先 mp_analyze 解包。
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| mp_list_appsA | 列出本机微信缓存的所有小程序 appid、版本号、包数量。无副作用,用来决定分析哪个 appid。 |
| mp_analyzeB | 一键静态分析:解密解包(主包+分包+插件) → 签名/加密定位 → API 抽取 → 复现代码生成 → 结构化报告。输入 appid 或 '--active' 自动检测运行中的小程序。产出 report.json + REPORT.md + repro.node.mjs + repro.python.py。 |
| mp_analyze_allA | 批量分析本机缓存的所有小程序。耗时较长,适合全面扫描。 |
| mp_decryptA | 解密并提取 wxapkg 包。可传 appid(自动找最新缓存)或 wxapkg 文件路径。输出解包后的文件列表。 |
| mp_sign_crackA | 签名参数穷举破解:给定抓包样本(JSONL) + 密钥,自动枚举参数子集 × 算法(HMAC/MD5/SHA/AES/DES),找到产生该 sign 的精确公式并生成复现代码。传 report 可直接吃 mp_analyze 的 report.json(自动载入候选密钥+算法+参数序,免手动 key/source);也可传 source_dir 从源码提取密钥。 |
| mp_capture_startB | 启动 mitmdump 代理抓包。手机配置代理后,小程序请求自动记录为 sign-crack 兼容的 JSONL。默认监听 8080 端口。可选 url_filter 只抓包含指定关键词的 URL。 |
| mp_capture_stopA | 停止 mitmdump 抓包进程,返回捕获的文件路径和请求数。 |
| mp_capture_listB | 查看当前抓包文件内容。返回最近的请求概览(URL/method/sign字段)。可指定 capture_file 路径,默认读取最新的抓包文件。 |
| mp_capture_importA | 把已有抓包归一成 sign-crack 兼容的 JSONL —— 用户自己用任意工具抓的包可直接导入,无需再走 mp_capture_* 代理。支持 HAR(Charles/Fiddler/DevTools)、cURL(DevTools 复制)、JSON 请求体、JSONL。自动扁平化 JSON 体、折入 GET query 参数,并标出带 sign 字段的请求。 |
| mp_sandbox_runA | 在离线沙箱中加载小程序 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 传[主包,分包]协同加载。 |
| mp_sandbox_modulesA | 列出小程序 bundle 中注册的所有模块路径。用于发现 SDK 签名模块位置。需要先 mp_analyze 解包。分包签名 SDK 依赖主包 runtime 时用 bundle_paths 传[主包,分包]协同加载。 |
| mp_sandbox_exportA | 从沙箱导出独立 Node.js 签名脚本。追踪签名函数的依赖模块,提取最小子集,生成不依赖 wx-sandbox / app-service.js 的自包含 .mjs 文件。流程:加载 bundle → 运行 verify 验证签名能跑通 → 追踪依赖 → 生成独立脚本。需要先 mp_analyze 解包 + mp_sandbox_run 确认签名函数路径。 |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 12 tools
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.
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.
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.
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.