# Chrome DevTools MCP: Setup and First-Call Error Fixes

> Chrome DevTools MCP setup for Claude Code and Codex, with reproduced first-call errors, profile fixes, connection choices, and measured schema tokens.

Chrome DevTools MCP can initialize successfully and still fail when your agent first opens a page. I reproduced that with a profile collision and a refused connection on November 19, 2026, using chrome-devtools-mcp 1.13.0 and Chrome 157.0.8103.79. A server showing up in your client is only the first checkpoint.

**The short answer:** Let the server launch Chrome unless you need a particular existing browser. Use `--isolated` for independent sessions that can start without saved logins. Use an explicit debugging endpoint only after starting a debuggable Chrome yourself; then verify a page snapshot before asking the agent to debug your app.

## How do I set up Chrome DevTools MCP in Claude Code or Codex?

Install Chrome DevTools MCP by registering a local stdio server, then choose its browser arguments. The client starts the server as a subprocess; that doesn't mean Chrome is already running.

The project requires Node.js LTS, npm, and current stable Chrome or newer. My measurement environment used Node v22.22.2 on macOS 26.7.2, with codex-cli 0.170.0. ([Chrome DevTools README, checked November 2026](https://github.com/ChromeDevTools/chrome-devtools-mcp))

For Claude Code registration, I ran this exact command in a scratch project on November 19. It created project-scoped `.mcp.json`; it did not establish that Claude completed a browser task:

```bash
claude mcp add --scope project chrome-devtools -- npx -y chrome-devtools-mcp@latest
```

I ran the corresponding Codex registration command with a separate scratch configuration home:

```bash
codex mcp add chrome-devtools -- npx -y chrome-devtools-mcp@latest
```

That command normally adds the server to your own Codex configuration. The scratch home was a test precaution, not a required installation step. The project's [client configuration guide, checked November 2026](https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/docs/client-configurations.md) also documents CLI registration for both clients.

For a repeatable starting configuration, replace the generated Claude entry with the following **docs-only composition**: the measured registration structure, pinned package version, and documented flags. This combined configuration was not run through Claude Code:

```json
{
	"mcpServers": {
		"chrome-devtools": {
			"type": "stdio",
			"command": "npx",
			"args": ["-y", "chrome-devtools-mcp@1.13.0", "--isolated", "--no-usage-statistics"]
		}
	}
}
```

In an interactive session, review and approve the project server when Claude asks. Project scope stores configuration in `.mcp.json`; user scope applies across projects. ([Claude Code MCP docs, checked November 2026](https://code.claude.com/docs/en/mcp))

For Chrome DevTools MCP in Codex, the equivalent **docs-only composition** goes in `~/.codex/config.toml`. Edit the existing table if registration already created it:

```toml
[mcp_servers.chrome-devtools]
command = "npx"
args = ["-y", "chrome-devtools-mcp@1.13.0", "--isolated", "--no-usage-statistics"]
```

The table name and `command`/`args` keys follow the [OpenAI MCP configuration docs, checked November 2026](https://developers.openai.com/codex/mcp). Pinning makes this article's version explicit; `@latest` follows later releases.

One setup caveat from the measurement log: `npx -y chrome-devtools-mcp@latest --version` produced no output before I stopped it after about 60 seconds. Installing 1.13.0 directly worked, and subsequent browser measurements used that installed binary with usage statistics disabled. The cause of the stalled invocation was not established. Don't assume a client timeout proves a browser problem.

## Which Chrome connection mode should I use?

Choose based on whether you need saved state and who starts Chrome. The default server-managed profile is separate from your everyday Chrome profile; attaching to your everyday browser is a deliberate choice.

| Your job                                 | Mode                             | What you give up or must arrange                               |
| ---------------------------------------- | -------------------------------- | -------------------------------------------------------------- |
| Reuse state across one server's runs     | Default MCP-managed profile      | Only one browser can own that profile at a time                |
| Run independent sessions                 | `--isolated`                     | Temporary profile is removed when the browser closes           |
| Use your already-open local Chrome       | `--autoConnect`                  | Enable remote debugging in Chrome and authorize the connection |
| Attach to Chrome you started             | `--browserUrl` / `--browser-url` | Start Chrome with a debugging port first                       |
| Attach using a browser WebSocket address | `--wsEndpoint` / `--ws-endpoint` | Supply the actual endpoint of a running browser                |

The measured help confirms these flags. The [configuration reference, checked November 2026](https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/docs/configuration.md) confirms the camel-case and hyphenated aliases. Its auto-connect mode requires Chrome 144 or newer and enabling remote debugging at `chrome://inspect/#remote-debugging`; that mode was not exercised in my local run.

![Choose existing Chrome, an isolated browser, a persistent MCP profile, or an explicit endpoint, with the failure each choice addresses](/blog/chrome-devtools-mcp/connection-modes.svg)

_Source: Chrome DevTools MCP documentation and author’s November 19 measurement log, checked November 19, 2026._

For the default stable channel, the MCP-managed profile lives at `~/.cache/chrome-devtools-mcp/chrome-profile` on macOS and Linux. It survives runs. The [advanced usage guide, checked November 2026](https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/docs/advanced-usage.md) explains that separate server instances need isolated or distinct profiles to avoid sharing that directory.

Pick `--isolated` when a fresh login is acceptable. Keep a dedicated persistent profile when retained authentication matters, and serialize access to it. Issue [#3020, checked November 2026](https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/3020) reports precisely that tradeoff: isolation avoids the collision but starts without the saved authentication. It is a reported workflow limitation, not evidence that copying a locked profile is a supported fix.

## Why is Chrome DevTools MCP not working on the first call?

First identify whether the failure names a profile or an endpoint. Both failures below occurred after successful initialization in my November 19 run; restarting the client without changing the conflicting resource would leave the cause in place.

### “The browser is already running” means the profile is occupied

I started two servers with `--headless` and the default profile. The second server's `new_page` returned this exact error:

```text
The browser is already running for ~/.cache/chrome-devtools-mcp/chrome-profile. Use --isolated to run multiple browser instances.
Cause: The browser is already running for ~/.cache/chrome-devtools-mcp/chrome-profile. Use a different `userDataDir` or stop the running browser first.
```

Running both servers with `--headless --isolated` made both `new_page` calls succeed. That's a reproduced fix for this collision. If you need saved state, stop the browser owning that dedicated profile or assign distinct `--userDataDir` directories instead. Don't delete the profile to resolve ownership. The same ready-looking-server/failed-action pattern appears in issue [#224, checked November 2026](https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/224).

### `ECONNREFUSED` means the configured endpoint did not accept a connection

With nothing listening on the configured local port, `--browserUrl http://127.0.0.1:9222` initialized, but `list_pages` returned:

```text
Could not connect to Chrome. Check if Chrome is running.
Cause: Failed to fetch browser webSocket URL from http://127.0.0.1:9222/json/version: fetch failed
Cause: connect ECONNREFUSED 127.0.0.1:9222
```

If you don't need to attach, remove `--browserUrl` and let the server launch Chrome. If you do need attachment, start a debugging-enabled browser first. This exact macOS command worked in the November 19 measurement:

```bash
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --remote-debugging-port=9222 --user-data-dir=/tmp/cdmcp-profile --no-first-run about:blank
```

With that browser running, the server using `--browserUrl http://127.0.0.1:9222` successfully listed pages, opened `https://example.com`, and took a snapshot. This was a separate browser with a separate profile, not my everyday Chrome.

Don't drop `--user-data-dir` from that launch recipe. Chrome changed the remote-debugging switches so they no longer operate against its default data directory. My run deliberately skipped testing that unsafe-to-disturb profile; this requirement comes from [Chrome's remote debugging announcement, checked November 2026](https://developer.chrome.com/blog/remote-debugging-port).

The HTTP `/json/version` response supplies `webSocketDebuggerUrl`. Use that actual value with `--wsEndpoint` if you need direct WebSocket attachment. Changing HTTP to WebSocket doesn't start a missing Chrome process.

### A `pageId` validation error means the tool arguments need fixing

After connecting, an empty `take_snapshot` call failed with:

```text
Input validation error: Invalid arguments for tool take_snapshot: pageId: Invalid input: expected number, received undefined
```

In the working run, `new_page` listed page `2`, and `take_snapshot` with `{"pageId":2}` succeeded. Use the ID returned by your own `new_page` or `list_pages` call. The snapshot is an accessibility tree with element `uid` values, not HTML. The [tool reference, checked November 2026](https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/docs/tool-reference.md) documents the required page ID and snapshot format.

## Chrome DevTools MCP vs Playwright MCP: which fits the job?

Pick DevTools MCP for a Chrome debugging investigation; pick Playwright MCP when browser choice or its session-state workflow decides the job. If you can do the investigation yourself, Chrome's DevTools interface avoids configuring an MCP server altogether.

| Option                   | Fits                                                       | Cost or limitation to consider                                                        |
| ------------------------ | ---------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| Chrome DevTools MCP      | Agent-driven Chrome traces, network and console inspection | Full measured default schema was 7,175 tokens; profile ownership still needs planning |
| Playwright MCP           | Agent automation across Chrome, Firefox or WebKit          | Its persistent profiles also conflict when browser instances share them               |
| Chrome DevTools manually | You can inspect and reproduce the bug yourself             | You carry findings back to the coding agent                                           |

The [DevTools project README, checked November 2026](https://github.com/ChromeDevTools/chrome-devtools-mcp) documents traces, console and network inspection. The [Playwright MCP README, checked November 2026](https://github.com/microsoft/playwright-mcp) documents its browser choices, isolated sessions, saved-state options and persistent-profile collision constraint. Switching servers alone doesn't solve shared browser state.

I measured **33 default tools**, with a `tools/list` result of **32,312 characters and 7,175 tokens**, using `o200k_base` through `js-tiktoken` on November 19. That is the serialized discovery result for DevTools MCP 1.13.0, not a measured bill, per-call charge, or proof that either client sends every definition on every model request. Opt-in categories were excluded.

In my October 2 comparison, Playwright MCP 0.0.83, Playwright CLI 0.1.22 and DevTools MCP 1.10.1 produced nearly identical Hacker News front-page snapshots. The schema differences did not establish an accuracy winner. That older experiment is covered in [the measured Playwright CLI and MCP comparison](/blog/playwright-mcp-vs-cli).

For basic navigation, JavaScript execution and screenshots, consider the documented `--slim` mode. It exposes only those tool families, so it's the wrong choice when the job needs the full debugging tools. I did not measure its schema token count. Confirm the tradeoff in the [configuration reference, checked November 2026](https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/docs/configuration.md) before enabling it.

## How do I verify the setup before debugging my app?

Require a browser result, not just a connected-server indicator. Ask the agent to perform this acceptance sequence:

1. Call `list_pages` and report the available page IDs.
2. Call `new_page` with `{"url":"https://example.com"}`.
3. Call `take_snapshot` with the returned `pageId` and report the page title and a visible link.

That's the shape of the successful local run. Only then replace the example URL with your development site and ask for the console or network evidence relevant to your bug.

If tools never appear, diagnose server startup first with [the MCP Inspector procedure](/blog/mcp-inspector). The project's [troubleshooting guide, checked November 2026](https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/docs/troubleshooting.md) recommends checking that the client uses the same Node/npm runtime as the terminal. For sandbox-related launch failures, it also documents attachment to a Chrome started outside the client sandbox; that still requires a reachable debugging endpoint.

Treat an attached browser as data the agent can inspect and modify. Usage-statistics opt-out and trace-URL opt-out are separate: `--no-usage-statistics` disables the former, while `--no-performance-crux` disables the latter. Both are documented in the [project README, checked November 2026](https://github.com/ChromeDevTools/chrome-devtools-mcp).

Choose the profile now, complete the snapshot sequence, and keep the returned page ID with your next debugging request.

Related reading: [Playwright MCP vs CLI](/blog/playwright-mcp-vs-cli) · [MCP Inspector troubleshooting](/blog/mcp-inspector) · [MCP servers by measured token cost](/blog/best-mcp-servers)
