使用 caxa 打包 REA 为 Windows 独立二进制可执行文件
简介
REA(Reverse Engineer Anything)是基于 Node+TS 的逆向 MCP 服务。使用 nvm 管理多 Node 版本时,切换版本就需要重装 REA。本文用 caxa 将整个项目打包为独立 rea.exe,内置 Node 运行时与全部资源,打包一次,脱离本机 Node/nvm,直接给 Cursor/Claude MCP 调用。
caxa 原理:生成自解压 exe,首次启动解压项目文件到缓存目录;后续复用缓存。优势:自动打包 skill、子脚本等静态资源,规避 pkg/SEA 资源丢失问题;缺点:包体积较大,冷启动需要解压。
环境准备
- Windows、Git、nvm-windows
- Node.js 22.19.0(REA 硬性要求)
git clone https://github.com/morluto/rea.git
cd rea
nvm use 22.19.0
npm ci
node scripts/rea.mjs --help
必须确保
node scripts/rea.mjs --help正常输出,打包产物才可用。
打包命令(CMD)
npx @appthreat/caxa --input "." --output "rea.exe" --exclude ".git,.github,node_modules/.cache" -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/scripts/rea.mjs"
一键打包批处理 build-rea.bat
@echo off
D:
cd D:\Project\Git\rea
nvm use 22.19.0
npm ci
node scripts/rea.mjs --help
npx @appthreat/caxa --input "." --output "rea.exe" --exclude ".git,.github,node_modules/.cache" -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/scripts/rea.mjs"
echo 打包完成,生成 rea.exe
pause
测试运行
rea.exe --help
MCP 配置(Cursor / Claude Desktop)
{
"mcpServers": {
"rea": {
"command": "D:\\Project\\Git\\rea\\rea.exe",
"args": ["mcp"]
}
}
}
缓存优化(避免占用 C 盘)
默认解压缓存路径:%TEMP%\caxa。设置环境变量迁移到 D 盘。 CMD 单次生效:
set CAXA_TEMP_DIR=D:\caxa_cache
rea.exe mcp
永久配置:系统环境变量新增 CAXA_TEMP_DIR=D:\caxa_cache。
清理缓存:
rmdir /s /q %TEMP%\caxa
REA 升级方案
caxa 属于静态打包,无增量更新,更新需要重新打包。
git pull
nvm use 22.19.0
npm ci
node scripts/rea.mjs --help
npx @appthreat/caxa --input "." --output "rea.exe" --exclude ".git,.github,node_modules/.cache" -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/scripts/rea.mjs"
⚠️升级后必须重启 Cursor/Claude 客户端,并建议清空旧缓存,防止版本冲突。
升级批处理 upgrade-rea.bat
@echo off
D:
cd D:\Project\Git\rea
git pull
nvm use 22.19.0
npm ci
node scripts/rea.mjs --help
rmdir /s /q %TEMP%\caxa
npx @appthreat/caxa --input "." --output "rea.exe" --exclude ".git,.github,node_modules/.cache" -- "{{caxa}}/node_modules/.bin/node" "{{caxa}}/scripts/rea.mjs"
echo ✅升级打包完成,请重启MCP客户端
pause
标题:使用 caxa 打包 REA 为 Windows 独立二进制可执行文件
作者:zytops
地址:https://www.zytops.com/articles/2026/10/15/1792049995414.html