docs/handbook/engineering/playbooks/connect-claude-to-chrome.mdx
This guide explains how to set up the Chrome DevTools MCP server so Claude Code can inspect and control your Chrome browser.
google-chrome --remote-debugging-port=4222 --user-data-dir=/tmp/chrome-debug
npm i -g @anthropic-ai/claude-code
claude mcp add chrome-devtools --scope user -- npx chrome-devtools-mcp@latest --browserUrl=http://localhost:4222
Make sure the port in
--browserUrlmatches the--remote-debugging-portyou used when launching Chrome.
Create a file called .wslconfig in your Windows user profile directory (%USERPROFILE%, e.g. C:\Users\YourName\.wslconfig) with the following content:
[wsl2]
networkingMode = mirrored
Important: The file must be named exactly
.wslconfig— not.wslconfig.txt. If you created it with Notepad, double-check that it didn't append.txtto the filename.
After creating or editing the file, restart WSL:
wsl --shutdown
Open your WSL terminal and run:
npm i -g @anthropic-ai/claude-code
claude mcp add chrome-devtools --scope user -- npx chrome-devtools-mcp@latest --browserUrl=http://localhost:4222
Open cmd or PowerShell on Windows and run:
"C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=4222 --user-data-dir="%TEMP%\chrome-debug"
The port must match the one you used in the
--browserUrlflag above.
Open your browser and navigate to:
http://localhost:4222/json/version
You should see a JSON response like this:
{
"Browser": "Chrome/147.0.7727.55",
"Protocol-Version": "1.3",
"User-Agent": "Mozilla/5.0 ...",
"V8-Version": "14.7.173.16",
"WebKit-Version": "537.36 (...)",
"webSocketDebuggerUrl": "ws://localhost:4222/devtools/browser/..."
}
If you see this, the debug protocol is active.
Inside Claude Code, run:
/mcp
You should see chrome-devtools listed as a connected MCP server. If it appears with a green status, Claude can communicate with your browser.
The devcontainer is already configured to set up the Chrome DevTools MCP automatically. The postCreateCommand in .devcontainer/devcontainer.json installs dependencies and registers the MCP server, resolving the host IP via host.docker.internal:
"postCreateCommand": "bun install && HOST_IP=$(getent ahostsv4 host.docker.internal | awk '{print $1}' | head -1) && claude mcp add chrome-devtools --scope user -- npx chrome-devtools-mcp@latest --browserUrl=http://${HOST_IP}:4222"
All you need to do is:
--remote-debugging-port=4222 (see the Linux or Windows sections above)./mcp in Claude Code.