zhizhuodemao/js-reverse-mcp

AI Agent-first JS 逆向 MCP Server:有头 Chrome 调试、断点、网络/WebSocket 分析、Patchright 反检测,可选 CloakBrowser。

What it is

js‑reverse‑mcp is a Node.js‑based MCP (Model‑Controlled‑Program) server that lets large‑language‑model agents (Claude Code, Cursor, GitHub Copilot, etc.) interact with a real Chrome browser as a debugging assistant. It reorganises DevTools data—scripts, breakpoints, network traffic, WebSocket messages, browser storage and local files—into concise, AI‑friendly primitives so an agent can reason step‑by‑step about JavaScript behaviour on a page.

Core idea

The goal isn’t to expose the full Chrome DevTools UI to the model. Instead the server provides a small set of well‑defined tools (e.g., list_scripts, set_breakpoint_on_text, evaluate_script, list_network_requests) that return short, structured outputs or write large blobs to files. An LLM can then decide the next action, read the exported files, and continue its analysis without being flooded with raw source or binary data.

Main capabilities

Category Tools (examples) What they do
Page & navigation new_page, navigate_page, select_page, click_element, take_screenshot Open pages, move around, interact with elements, capture screenshots.
Script analysis list_scripts, get_script_source, save_script_source, search_in_sources Enumerate all loaded JS, fetch source (including minified/WASM), search text, export to disk.
Breakpoints & execution set_breakpoint_on_text, break_on_xhr, list_breakpoints, get_paused_info, step, evaluate_script Set breakpoints (by text or URL pattern), pause execution, inspect call‑frames, step, run arbitrary JS in the page or in a paused frame.
Network & WebSocket list_network_requests, clear_network_requests, get_request_initiator, get_websocket_messages Capture HTTP/XHR/fetch requests, export headers/body, trace the JS call‑stack that triggered a request, inspect WS traffic.
Browser state clear_site_data Reset cookies, storage, cache for the current site (useful for replaying anti‑bot flows).
Utility list_console_messages Pull console logs for additional context.

Anti‑detection / stealth

  • Protocol‑level stealth – a custom fork of Patchright disables the usual CDP flags that reveal automation and runs evaluate calls in an isolated world.
  • Optional binary layer – with --cloak the server swaps Chrome for CloakBrowser, a patched Chromium binary that masks fingerprints such as navigator.webdriver, canvas, WebGL, audio, GPU, fonts, screen size, WebRTC and TLS details.
  • Profile handling – persistent profile keeps login state; --isolated creates a fresh temporary profile; --cloak uses a separate profile directory.
  • Silent navigation – CDP network/debugger domains stay disabled until a tool explicitly needs them, reducing early detection.

How to run

  • Zero‑install – add the server to an AI‑assistant’s MCP config:
{ "mcpServers": { "js-reverse": { "command": "npx", "args": ["js-reverse-mcp"] } } }
  • Local install – git clone … && npm install && npm run build, then point the MCP to the built index.js.
  • Optional flags –
    • --cloak – enable CloakBrowser (downloads ~200 MiB binary on first run).
    • --isolated – start with a fresh user‑data‑dir each session.
    • --browserUrl <CDP‑endpoint> – attach to an already‑running Chrome (or a fingerprint browser like AdsPower).
    • --allowedRoots <path> – restrict which host directories the agent may read/write.

Typical workflow for an AI agent

  1. new_page → open target URL.
  2. list_scripts → locate a function of interest (e.g., search for encrypt).
  3. set_breakpoint_on_text → place a breakpoint at the function entry.
  4. Trigger the page action; when paused, use get_paused_info and evaluate_script to inspect arguments.
  5. Export relevant network requests with list_network_requests … outputFile=….
  6. Optionally clear_site_data and repeat to replay anti‑bot flows.

Safety notes

  • The server can read/write any file on the host unless --allowedRoots is set, so it should be run in a controlled environment.
  • It exposes full browser state (cookies, localStorage, console output) to the attached AI model – avoid using it on pages containing sensitive data.

License

Apache‑2.0


In short: js‑reverse‑mcp is an “AI‑first” debugging bridge that turns Chrome DevTools data into a concise toolbox for LLM agents, with built‑in stealth features for navigating anti‑scraping sites. It’s a genuine software project aimed at AI‑assisted JavaScript reverse engineering and automated web analysis.

Related

  • Project
  • Project
  • Project
  • Project
  • Project