Skip to content

Instantly share code, notes, and snippets.

@syntaxhacker
Created August 3, 2026 11:31
Show Gist options
  • Select an option

  • Save syntaxhacker/33298ebb306ebfddd3d0c85f61b42edb to your computer and use it in GitHub Desktop.

Select an option

Save syntaxhacker/33298ebb306ebfddd3d0c85f61b42edb to your computer and use it in GitHub Desktop.
chrome-devtools-mcp --autoConnect fails when launched via bunx: Puppeteer doesn't support Bun (#1234). Fix: use Node npx with absolute path.

chrome-devtools-mcp fails with --autoConnect when launched via bunx (Bun)

Symptom

The chrome-devtools MCP server is configured with:

bunx chrome-devtools-mcp@latest --autoConnect --user-data-dir <chrome-profile-dir>

Every tool call (list_pages, navigate_page, …) fails with:

Could not connect to Chrome. Check if Chrome is running.
Cause: Could not find DevToolsActivePort for chrome at <chrome-profile-dir>/DevToolsActivePort

or, after adding --user-data-dir so the port is found:

Cause: Unexpected server response: 101

At the same time, the DevTools endpoint is verifiably live:

  • curl http://127.0.0.1:9222/json/version returns JSON (or the port responds)
  • Connecting directly with Puppeteer over the same WebSocket endpoint works fine:
const browser = await puppeteer.connect({
  browserWSEndpoint: 'ws://127.0.0.1:9222/devtools/browser/<id>'
}); // works

So Chrome is fine. The MCP server is the problem.

Root cause

chrome-devtools-mcp runs Puppeteer under the hood, and Puppeteer does not support running under Bun. When the MCP server is launched via bunx, Puppeteer's connect() fails to handshake with Chrome — even though the endpoint is reachable and the browser is running with remote debugging enabled.

The maintainers confirmed this in upstream issue #1234 ("Bug: chrome-devtools-mcp fails to connect to Chrome when run via Bun (bunx)"), which was closed with "we currently do not support bun".

Fix

Launch the MCP server with Node's npx instead of bunx.

Because the MCP subprocess may not inherit your shell's PATH (e.g. when Node is installed via nvm), use the absolute path to npx:

// opencode.json (or your MCP client config)
{
  "mcp": {
    "chrome-devtools": {
      "type": "local",
      "command": [
        "/home/<user>/.nvm/versions/node/v22.23.2/bin/npx",
        "-y",
        "chrome-devtools-mcp@latest",
        "--autoConnect",
        "--user-data-dir",
        "/home/<user>/.config/google-chrome"
      ],
      "enabled": true,
      "timeout": 10000
    }
  }
}

Notes:

  • --autoConnect on Chrome 144+ requires remote debugging enabled in the running Chrome via chrome://inspect/#remote-debugging, and the user must click Allow on the permission dialog when the MCP first connects.
  • Passing --user-data-dir explicitly makes --autoConnect take the connect path (it reads DevToolsActivePort and builds the WS endpoint) instead of falling into Puppeteer's launch path.
  • Restart your MCP client so the server respawns under Node.

Verification

# server must run under Node, not Bun
npx -y chrome-devtools-mcp@latest --autoConnect --user-data-dir <profile-dir>

# then, from your agent:
list_pages   # -> returns the open tabs (e.g. your real Chrome tabs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment