Connects to Google Chrome browser for JavaScript debugging capabilities, supporting both launched instances and connecting to existing Chrome sessions via remote debugging protocol.
Enables reverse engineering and debugging of JavaScript code in web pages, including script analysis, breakpoint debugging, function hooking, runtime inspection, network analysis, and execution control.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@JS Reverse MCPsearch for 'encrypt' in all scripts on the current page"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
JS Reverse MCP
JavaScript 逆向工程 MCP 服务器,让你的 AI 编码助手(如 Claude、Cursor、Copilot)能够调试和分析网页中的 JavaScript 代码。
基于 Patchright 反检测引擎,内置多层反爬绕过能力,可在知乎、Google 等有风控检测的站点正常工作。
功能特点
反检测浏览器: 基于 Patchright(Playwright 反检测分支),60+ 隐身启动参数,绕过主流反爬系统
脚本分析: 列出所有加载的 JS 脚本,搜索代码,获取源码
断点调试: 设置/移除断点,支持条件断点,支持在压缩代码中精确定位
函数追踪: Hook 任意函数(包括模块内部函数),监控调用和返回值
执行控制: 暂停/恢复执行,单步调试(step over/into/out)
运行时检查: 在断点处求值表达式,检查作用域变量
网络分析: 查看请求发起的调用栈,设置 XHR 断点,WebSocket 消息分析
事件监控: 监控 DOM 事件,检查存储数据
系统要求
本地安装
# 克隆仓库
git clone https://github.com/nicecaesar/js-reverse-mcp.git
cd js-reverse-mcp
# 安装依赖
npm install
# 构建项目
npm run buildMCP 客户端配置
在你的 MCP 客户端配置文件中添加:
{
"mcpServers": {
"js-reverse": {
"command": "node",
"args": ["/你的路径/js-reverse-mcp/build/src/index.js"]
}
}
}Claude Code
claude mcp add js-reverse node /你的路径/js-reverse-mcp/build/src/index.jsCursor
进入 Cursor Settings -> MCP -> New MCP Server,使用上面的配置。
VS Code Copilot
code --add-mcp '{"name":"js-reverse","command":"node","args":["/你的路径/js-reverse-mcp/build/src/index.js"]}'反检测机制
js-reverse-mcp 内置了多层反检测措施,确保在有风控检测的站点上正常工作:
反检测架构
层级 | 说明 |
Patchright 引擎 | C++ 层反检测 patch,移除 |
60+ 隐身启动参数 | 移除自动化特征、绕过无头检测、GPU/网络/行为特征伪装 |
有害参数移除 | 排除 |
CDP 静默导航 | 导航工具执行时不激活 CDP 域,仅通过 Playwright 级监听器捕获请求,避免被反爬脚本检测到调试协议活动 |
Google Referer 伪装 | 所有导航自动带 |
持久化登录态 | 默认使用持久化 user-data-dir,登录状态跨会话保留 |
工具列表
脚本分析
工具 | 描述 |
| 列出页面中所有加载的 JavaScript 脚本 |
| 获取脚本源码,支持行范围或字符偏移(适用于压缩文件) |
| 在所有脚本中搜索字符串或正则表达式 |
断点管理
工具 | 描述 |
| 通过搜索代码文本自动设置断点(适用于压缩代码) |
| 移除断点 |
| 列出所有活动断点 |
调试控制
工具 | 描述 |
| 获取暂停状态、调用栈和作用域变量 |
| 恢复执行 |
| 暂停执行 |
| 单步跳过 |
| 单步进入 |
| 单步跳出 |
函数 Hook
工具 | 描述 |
| Hook 全局函数或对象方法,记录调用和返回值 |
| 移除函数 Hook |
| 列出所有活动的 Hook |
| 追踪任意函数调用(包括模块内部函数),使用条件断点实现 |
网络调试
工具 | 描述 |
| 列出网络请求 |
| 获取请求详情和响应内容 |
| 获取网络请求的 JavaScript 调用栈 |
| 设置 XHR/Fetch 断点 |
| 移除 XHR 断点 |
| 列出 WebSocket 连接 |
| 获取 WebSocket 消息 |
| 分析 WebSocket 消息模式 |
检查工具
工具 | 描述 |
| 在页面中执行 JavaScript |
| 深度检查 JavaScript 对象结构 |
| 获取 cookies、localStorage、sessionStorage |
| 监控元素或 window 上的 DOM 事件 |
| 停止事件监控 |
| 获取控制台消息 |
| 获取控制台消息详情 |
页面管理
工具 | 描述 |
| 列出浏览器中打开的页面 |
| 选择一个页面作为调试上下文 |
| 创建新页面并导航到 URL |
| 导航、后退、前进或刷新页面 |
| 列出页面中的所有 frame |
| 选择 frame 作为执行上下文 |
| 截取页面截图 |
使用示例
JS 逆向基本流程
打开目标页面
打开 https://example.com 并列出所有加载的 JS 脚本查找目标函数
在所有脚本中搜索包含 "encrypt" 的代码设置断点
在加密函数入口处设置断点触发并分析
在页面上触发操作,断点命中后检查参数、调用栈和作用域变量Hook 加密函数
Hook fetch 函数,记录所有 API 调用的参数和返回值追踪模块内部函数
使用 trace_function 追踪 webpack 打包的内部函数 "encryptData",
无需设置断点即可查看每次调用的参数WebSocket 协议分析
列出 WebSocket 连接,分析消息模式,查看特定类型的消息内容配置选项
选项 | 描述 | 默认值 |
| 连接到运行中的 Chrome 实例 | - |
| WebSocket 端点连接 | - |
| 无头模式运行 | false |
| 自定义 Chrome 路径 | - |
| 使用临时用户数据目录(每次全新) | false |
| Chrome 通道: stable, canary, beta, dev | stable |
| 初始视口大小,如 | 真实尺寸 |
| 启用 Canvas 指纹加噪 | false |
| 阻止 WebRTC 泄露真实 IP | false |
| 禁用 WebGL 防止 GPU 指纹 | false |
| 禁用隐身启动参数(调试用) | false |
| 代理服务器配置 | - |
| 调试日志文件路径 | - |
示例配置
基础使用(推荐):
{
"mcpServers": {
"js-reverse": {
"command": "node",
"args": [
"/你的路径/js-reverse-mcp/build/src/index.js",
"--headless=false"
]
}
}
}增强反检测(Canvas 加噪 + WebRTC 阻止):
{
"mcpServers": {
"js-reverse": {
"command": "node",
"args": [
"/你的路径/js-reverse-mcp/build/src/index.js",
"--headless=false",
"--hideCanvas",
"--blockWebrtc"
]
}
}
}临时隔离模式(不保留登录态,每次全新 profile):
{
"mcpServers": {
"js-reverse": {
"command": "node",
"args": [
"/你的路径/js-reverse-mcp/build/src/index.js",
"--headless=false",
"--isolated"
]
}
}
}连接到已运行的 Chrome
启动 Chrome(需要关闭所有 Chrome 窗口后重新启动):
macOS
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debugWindows
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="%TEMP%\chrome-debug"配置 MCP 连接:
{
"mcpServers": {
"js-reverse": {
"command": "node",
"args": [
"/你的路径/js-reverse-mcp/build/src/index.js",
"--browser-url=http://127.0.0.1:9222"
]
}
}
}故障排除
被反爬系统拦截
如果访问某些站点被拦截(如知乎返回 40362 错误):
清除污染的 profile:删除
~/.cache/chrome-devtools-mcp/chrome-profile目录使用隔离模式:添加
--isolated参数启动启用 Canvas 加噪:添加
--hideCanvas参数
安全提示
此工具会将浏览器内容暴露给 MCP 客户端,允许检查、调试和修改浏览器中的任何数据。请勿在包含敏感信息的页面上使用。
许可证
Apache-2.0