Skip to main content
Glama
chrome-devtools-mcp-rebrowser

chrome-devtools-mcp-rebrowser

by liqi0816

Chrome DevTools MCP with Rebrowser Anti-Detection Patches

This project wraps chrome-devtools-mcp with rebrowser-patches to make AI agents undetectable by anti-bot systems like Cloudflare and DataDome.

negative bot detection result

πŸ€– AI

Yes, I used AI. I also committed the full conversations as the real design documents (.ai-conversations/ - private submodule, ask me for access).

They're private because I haven't scrubbed my file paths and trash talk, not because I'm hiding anything.

Code is MIT. What license applies to human-AI conversation transcripts is an open question. Literally. Nobody knows yet.

Related MCP server: Chrome for AI

Quick Start

Prerequisites

  • Node.js β‰₯ 20.19.0 LTS

  • Chrome running with remote debugging enabled (go to chrome://inspect/#remote-debugging)

Usage via npx (recommended)

No cloning or manual setup needed. Just configure your MCP client:

{
  "mcpServers": {
    "chrome-devtools-mcp-rebrowser": {
      "disabled": false,
      "timeout": 60,
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@liqi0816/chrome-devtools-mcp-rebrowser@latest",
        "--auto-connect",
        "--performance-crux=false",
        "--usage-statistics=false",
        "--category-emulation=false",
        "--category-performance=false",
        "--category-network=false"
      ]
    }
  }
}

That's it. The postinstall script automatically applies all patches after npm install.

Usage from source (development)

git clone <repo-url>
cd chrome-devtools-mcp-rebrowser
npm install          # postinstall applies patches automatically

Then configure the MCP server to use the local entry point:

{
  "mcpServers": {
    "chrome-devtools-mcp-rebrowser": {
      "disabled": false,
      "timeout": 60,
      "type": "stdio",
      "command": "node",
      "args": [
        "/path/to/launch.mjs",
        "--auto-connect",
        "--performance-crux=false",
        "--usage-statistics=false",
        "--category-emulation=false",
        "--category-performance=false",
        "--category-network=false"
      ]
    }
  }
}

How It Works

chrome-devtools-mcp is Google's official MCP server for Chrome DevTools. It bundles its own copy of Puppeteer internally. This project intercepts its puppeteer.connect() and puppeteer.launch() calls and redirects them through a separately installed, rebrowser-patched version of puppeteer-core.

Architecture

launch.mjs (entry point)
  β”‚
  β”œβ”€ Imports patched puppeteer-core (node_modules/puppeteer-core)
  β”‚   └─ puppeteer-core@24.40.0 + rebrowser-patches applied
  β”‚
  β”œβ”€ Imports bundled puppeteer from chrome-devtools-mcp
  β”‚   └─ node_modules/chrome-devtools-mcp/build/src/third_party/index.js
  β”‚
  β”œβ”€ Monkey-patches bundled puppeteer's connect()/launch() methods
  β”‚   to redirect through the patched puppeteer-core
  β”‚
  └─ Delegates to chrome-devtools-mcp's main entry point

postinstall.mjs (runs after npm install)
  β”‚
  β”œβ”€ Applies rebrowser-patches to puppeteer-core (with --fuzz=10)
  β”‚
  └─ Applies DevToolsConnectionAdapter.js patch to chrome-devtools-mcp

DevToolsConnectionAdapter.js (patched)
  β”‚
  └─ Blocks Runtime.enable calls from DevTools Universe models
     to prevent CDP detection via the separate CDP session

Why the Monkey-Patching?

  • chrome-devtools-mcp bundles Puppeteer in a single rollup file (third_party/index.js), so you can't simply swap out puppeteer-core via package.json.

  • rebrowser-puppeteer (the drop-in replacement) is only available up to v24.8.1, but recent chrome-devtools-mcp releases require newer Puppeteer APIs (e.g., page.emulateFocusedPage() from v24.39+).

  • Solution: install a compatible puppeteer-core separately, apply rebrowser-patches to it, then redirect the bundled Puppeteer's calls through the patched version.

Why puppeteer-core and rebrowser-patches are pinned to exact versions

You'll see "puppeteer-core": "24.40.0" and "rebrowser-patches": "1.0.19" (no caret) in package.json. This is deliberate β€” these two must move in lockstep:

rebrowser-patches is a set of line-by-line unified diffs against puppeteer-core's compiled output. Any upstream puppeteer-core release can add/remove lines near a hunk and make the patch stop applying β€” even patch-level releases. For example, rebrowser-patches@1.0.19 was cut against puppeteer-core 24.40.x, and newer puppeteer-core (24.41+) adds fields to IsolatedWorld.js that break hunks (see issue #4). Conversely, a newer rebrowser-patches release could target a different puppeteer-core line layout and stop applying to 24.40.0.

Both pins are bumped together whenever a new rebrowser-patches release catches up to a newer puppeteer-core. The remaining dependencies (chrome-devtools-mcp, diff) still float on ^ ranges because their APIs are stable and the patches we apply use fuzzy matching.

Flags

All flags from chrome-devtools-mcp are passed transparently. Key ones:

Flag

Description

--auto-connect

Connect to a running Chrome instance (requires remote debugging enabled)

--browser-url http://127.0.0.1:9222

Connect via HTTP URL

--ws-endpoint ws://...

Connect via WebSocket

--headless

Run in headless mode (Warning: more detectable)

--no-usage-statistics

Disable telemetry

Rebrowser Patches Environment Variables

You can fine-tune the anti-detection patches:

Variable

Values

Default

REBROWSER_PATCHES_RUNTIME_FIX_MODE

addBinding, alwaysIsolated, enableDisable, 0 (disable)

addBinding

REBROWSER_PATCHES_SOURCE_URL

Any string, or 0 to disable

app.js

REBROWSER_PATCHES_UTILITY_WORLD_NAME

Any string, or 0 to disable

util

REBROWSER_PATCHES_DEBUG

1 to enable debug logging

(disabled)

What the Patches Fix

rebrowser-patches (applied to puppeteer-core)

  1. Runtime.Enable leak β€” The primary detection vector. Anti-bot systems detect that Runtime.Enable was called (used by Puppeteer/Playwright). The patch avoids calling it and uses alternative methods to manage execution contexts.

  2. sourceURL fingerprint β€” Puppeteer adds //# sourceURL=pptr:... to evaluated scripts. The patch changes it to //# sourceURL=app.js.

  3. Utility world name β€” The default __puppeteer_utility_world__ name is changed to util.

  4. Browser _connection() method β€” Exposes the CDP connection for advanced use cases (not detectable by websites).

DevToolsConnectionAdapter.js (applied to chrome-devtools-mcp)

  1. DevTools Universe Runtime.Enable leak β€” Even with rebrowser-patches applied to puppeteer-core, chrome-devtools-mcp creates a separate CDP session per page via page.createCDPSession() in DevtoolsUtils.js and feeds it to a DevTools Universe. The Universe's RuntimeModel then calls Runtime.enable on that session β€” completely bypassing the patched puppeteer-core. We patch DevToolsConnectionAdapter.js to intercept and block Runtime.enable calls in the send() method, consistent with how rebrowser-patches handles it inside Puppeteer's FrameManager.

What the DevTools Universe CDP session is used for

chrome-devtools-mcp creates a per-page DevTools Universe (a lightweight instance of Chrome DevTools' SDK) for source-map-aware stack trace symbolication and error introspection:

Feature

Model

What it does

Stack trace resolution

DebuggerModel + DebuggerWorkspaceBinding

Receives Debugger.scriptParsed events, downloads source maps, retranslates raw CDP stack frames into original source locations for get_console_message output

Exception details

RuntimeModel

Calls Runtime.getExceptionDetails to resolve full error info from RemoteObject references, including recursive .cause chain

Skip-all-pauses

DebuggerModel

Immediately calls Debugger.setSkipAllPauses({skip: true}) so the MCP session never interferes with the user's DevTools debugging

Tradeoff of blocking Runtime.enable

Blocking Runtime.enable on the Universe session means the RuntimeModel won't receive execution context events, which degrades getExceptionDetails() (error cause chain resolution in get_console_message). However:

  • Core MCP tools are unaffected β€” evaluate_script, page snapshots, navigation, clicking, typing, screenshots all use Puppeteer APIs directly, not the Universe session.

  • Console message collection is unaffected β€” PageCollector listens on Puppeteer's own CDP session (page._client()), not the Universe session.

  • Stack traces from DebuggerModel still work β€” Debugger.enable is not blocked, so source-map-aware stack traces continue to function.

  • Only error cause chains degrade β€” The recursive .cause lookup via RuntimeModel.getExceptionDetails() may fail silently, omitting cause details from console error output.

This is an acceptable tradeoff since Runtime.enable is the primary CDP detection vector used by anti-bot systems.

Troubleshooting

"Could not connect to Chrome"

  • Make sure Chrome is running

  • Enable remote debugging: go to chrome://inspect/#remote-debugging

  • Check that DevToolsActivePort file exists in Chrome's user data directory

Patch fails with "FAILED" hunks

  • The installed puppeteer-core version drifted past what rebrowser-patches knows how to patch. postinstall.mjs prints the exact installed versions and a link to issue #4 when this happens. Re-run with npx -y @liqi0816/chrome-devtools-mcp-rebrowser@latest β€” the pinned puppeteer-core and rebrowser-patches in package.json should keep the install reproducible.

"emulateFocusedPage is not a function" (or similar)

  • Version mismatch: ensure puppeteer-core in package.json is a version whose API is supported by the bundled Puppeteer inside chrome-devtools-mcp (see the Version Compatibility table below).

Version Compatibility

Package

Version

Pinned?

chrome-devtools-mcp

^0.22.0

floats (fuzzy patch)

puppeteer-core

24.40.0

exact (why)

rebrowser-patches

1.0.19

exact (why)

diff

^8.0.4

floats

Node.js

β‰₯ 20.19.0

β€”

Available Tools

29 tools
clickB

Clicks on the provided element

Inputs: uid (required), dblClick, includeSnapshot.

close_pageB

Closes the page by its index. The last open page cannot be closed.

Inputs: pageId (required).

dragB

Drag an element onto another element

Inputs: to_uid (required), from_uid (required), includeSnapshot.

emulateC

Emulates various features on the selected page.

Inputs: viewport, userAgent, colorScheme, geolocation, +2 more.

evaluate_scriptA

Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON, so returned values have to be JSON-serializable.

Inputs: function (required), args, dialogAction.

fillA

Type text into an input, text area or select an option from a element.

Inputs: uid (required), value (required), includeSnapshot.

fill_formB

Fill out multiple form elements at once

Inputs: elements (required), includeSnapshot.

get_console_messageA
Read-only

Gets a console message by its ID. You can get all messages by calling list_console_messages.

Inputs: msgid (required).

get_network_requestA

Gets a network request by an optional reqid, if omitted returns the currently selected request in the DevTools Network panel.

Inputs: reqid, requestFilePath, responseFilePath.

handle_dialogA

If a browser dialog was opened, use this command to handle it

Inputs: action (required), promptText.

hoverB

Hover over the provided element

Inputs: uid (required), includeSnapshot.

lighthouse_auditA

Get Lighthouse score and reports for accessibility, SEO and best practices. This excludes performance. For performance audits, run performance_start_trace

Inputs: mode, device, outputDirPath.

list_console_messagesA
Read-only

List all console messages for the currently selected page since the last navigation.

Inputs: types, pageIdx, pageSize, includePreservedMessages.

list_network_requestsA
Read-only

List all requests for the currently selected page since the last navigation.

Inputs: pageIdx, pageSize, resourceTypes, includePreservedRequests.

list_pagesA
Read-only

Get a list of pages open in the browser.

Inputs: no named parameters.

new_pageB

Open a new tab and load a URL. Use project URL if not specified otherwise.

Inputs: url (required), timeout, background, isolatedContext.

performance_analyze_insightA
Read-only

Provides more detailed information on a specific Performance Insight of an insight set that was highlighted in the results of a trace recording.

Inputs: insightName (required), insightSetId (required).

performance_start_traceA

Start a performance trace on the selected webpage. Use to find frontend performance issues, Core Web Vitals (LCP, INP, CLS), and improve page load speed.

Inputs: reload, autoStop, filePath.

performance_stop_traceA

Stop the active performance trace recording on the selected webpage.

Inputs: filePath.

press_keyA

Press a key or key combination. Use this when other input methods like fill() cannot be used (e.g., keyboard shortcuts, navigation keys, or special key combinations).

Inputs: key (required), includeSnapshot.

resize_pageA

Resizes the selected page's window so that the page has specified dimension

Inputs: width (required), height (required).

select_pageA
Read-only

Select a page as a context for future tool calls.

Inputs: pageId (required), bringToFront.

take_memory_snapshotA

Capture a heap snapshot of the currently selected page. Use to analyze the memory distribution of JavaScript objects and debug memory leaks.

Inputs: filePath (required).

take_screenshotB

Take a screenshot of the page or element.

Inputs: uid, format, quality, filePath, +1 more.

take_snapshotA

Take a text snapshot of the currently selected page based on the a11y tree. The snapshot lists page elements along with a unique identifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot. The snapshot indicates the element selected in the DevTools Elements panel (if any).

Inputs: verbose, filePath.

type_textA

Type text using keyboard into a previously focused input

Inputs: text (required), submitKey.

upload_fileB

Upload a file through a provided element.

Inputs: uid (required), filePath (required), includeSnapshot.

wait_forA
Read-only

Wait for the specified text to appear on the selected page.

Inputs: text (required), timeout.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 29 tools

    Disambiguation4/5

    Most tools target clearly distinct browser/devtools actions, such as page lifecycle, console/network inspection, performance tracing, and screenshots. The main ambiguity is among input tools: fill vs type_text, fill vs fill_form, and click/hover/press_key can occasionally be confused, though descriptions mostly clarify usage.

    Naming Consistency4/5

    Names are consistently snake_case and most follow an action-first pattern such as list_pages, get_console_message, and take_screenshot. There are minor deviations with bare verbs (click, hover, fill) and resource-prefixed performance tools (performance_start_trace, lighthouse_audit), but the set remains readable and predictable.

    Tool Count2/5

    At 29 tools, the surface is well above the recommended range and feels heavy, with many fine-grained operations across input, page management, network, performance, and memory. While the breadth of Chrome DevTools justifies many of them, some grouping or consolidation would make the set easier to navigate.

    Completeness4/5

    Coverage is strong across page lifecycle, navigation, element interaction, forms, screenshots/snapshots, console, network, performance tracing, Lighthouse, and memory snapshots. Minor gaps remain around storage/cookies, network manipulation, and richer waiting/assertion patterns, but core workflows are covered.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Stealth browser automation for AI agents, using source-patched Chromium to bypass bot detection systems like Cloudflare, reCAPTCHA, and FingerprintJS.
      28
      Apache 2.0
    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents and developers to automate real Chrome/Chromium browsers through the Chrome DevTools Protocol, with token-efficient snapshots, multi-action batching, shadow DOM traversal, system-page control, extension management, and network/WebSocket inspection.
      95
      1
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to drive a Chromium-based browser for web research, testing, and automation with Playwright-compatible tools, persistent profiles, proxy matching, extension loading, and humanized input across local or containerized deployments.
      297 npm
      MIT