一、基本环境搭建

  1. 打开PowerShell(如不熟悉Windows使用方法请自行搜索)
  2. 设置PowerShell执行策略:
    Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned -Force
    

1. 安装Node.js管理工具fnm

winget install Schniz.fnm

配置环境变量(每次启动PowerShell需执行):

fnm env --use-on-cd --shell powershell | Out-String | Invoke-Expression

如需持久化配置:

if (-not (Test-Path $PROFILE)) { New-Item $PROFILE -Force }
Invoke-Item $PROFILE

在打开的配置文件中粘贴上述命令。

安装并使用Node.js 24:

fnm install 24
fnm use 24
node -v  # 应返回v24.x.x

2. 安装Codex

npm install -g @openai/codex

首次运行codex命令时需要登录ChatGPT账号或输入API Key(需自行获取)。也可尝试使用Claude、Gemini或国产Qwen等替代方案。

二、MCP安装

1. 安装并构建JSReverser-MCP

git clone https://github.com/NoOne-hub/JSReverser-MCP.git
cd .\JSReverser-MCP
npm install
# 如有需要可执行:npm audit fix --force
npm run build

2. 配置Codex参数

  1. 创建目录.codex/config.toml
  2. 设置临时环境变量:
    $env:CODEX_HOME = "C:\Users\yuanrenxue\Desktop\MCP_test\.codex"
    

config.toml配置示例:

[mcp_servers.chrome-devtools]
command = "cmd"
args = [
  "/c",
  "npx",
  "-y",
  "chrome-devtools-mcp@latest",
  "--browser-url=http://127.0.0.1:9222"
]
env = { SystemRoot = "C:\\Windows", PROGRAMFILES = "C:\\Program Files" }
startup_timeout_ms = 20000

[mcp_servers.js-reverse]
command = "node"
args = [
  "C:/Users/yuanrenxue/Desktop/MCP_test/JSReverser-MCP/build/src/index.js",
  "--browserUrl",
  "http://127.0.0.1:9222"
]

# 启用JSReverser AI增强分析时取消注释
# [mcp_servers.js-reverse.env]
# DEFAULT_LLM_PROVIDER = "openai"
# OPENAI_API_KEY = "你的_OPENAI_API_KEY"
# OPENAI_MODEL = "gpt-4o"

注意:配置可能随项目更新而变化,请参考项目文档

3. 启动浏览器与MCP检查

启动调试模式浏览器:

& "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 --user-data-dir="C:\Users\yuanrenxue\Desktop\MCP_test\tmp\chrome-mcp"

访问http://127.0.0.1:9222/json/version验证是否成功。

检查MCP服务:

codex mcp list

启动Codex交互界面:

codex
# 输入/mcp进入MCP模式

三、JS逆向实战

输入提示词:

https://match2023.yuanrenxue.cn/topic/3网页中的token参数,请利用chrome-devtools-mcp和js-reverse-mcp辅助,最终在node.js中模拟该参数,实现无需浏览器即可访问https://match2023.yuanrenxue.cn/api/match2023/3并获取第一页数据。
Logo

欢迎加入DeepSeek 技术社区。在这里,你可以找到志同道合的朋友,共同探索AI技术的奥秘。

更多推荐