Chrome DevTools MCP lets MCP clients connect to Chrome’s remote debugging endpoint. Because WSL2 and Windows are isolated at the network layer, you need port forwarding and a firewall rule. The commands below are split into clear steps.

Prerequisites

  • Chrome installed on Windows.
  • WSL2 set up and npx available inside WSL.
  • PowerShell running with admin privileges.

1. Configure port forwarding and firewall on Windows

From an elevated PowerShell prompt, run:

netsh interface portproxy add v4tov4 `
  listenaddress=0.0.0.0 listenport=9222 `
  connectaddress=127.0.0.1 connectport=9222

New-NetFirewallRule `
  -DisplayName "Chrome DevTools MCP 9222" `
  -Direction Inbound `
  -Protocol TCP `
  -LocalPort 9222 `
  -Action Allow

The first command forwards 0.0.0.0:9222 to 127.0.0.1:9222. The second command allows inbound TCP 9222.

2. Launch Chrome with remote debugging

Still in PowerShell, run:

& "C:\Program Files\Google\Chrome\Application\chrome.exe" `
  --user-data-dir="$env:USERPROFILE\ChromeProfiles\mcp" `
  --remote-debugging-port=9222 `
  --remote-debugging-address=127.0.0.1 `
  --no-first-run `
  --no-default-browser-check

This uses a dedicated user data directory to avoid affecting your daily browsing profile.

3. Configure the MCP client in WSL

Example for Codex in ~/.codex/config.toml:

[mcp_servers.chrome-devtools]
command = "npx"
args = ["chrome-devtools-mcp@latest", "--browserUrl=http://172.31.240.1:9222/json"]

172.31.240.1 should be taken from Windows. In PowerShell, run ipconfig and find the IPv4 address for vEthernet (WSL (Hyper-V firewall)):

Ethernet adapter vEthernet (WSL (Hyper-V firewall)):

   Connection-specific DNS suffix  . :
   Link-local IPv6 Address . . . . . : fe80::2ec3:951c:91a0:afbd%61
   IPv4 Address. . . . . . . . . . . : 172.31.240.1
   Subnet Mask . . . . . . . . . . . : 255.255.240.0
   Default Gateway . . . . . . . . . :

Use that IPv4 address in browserUrl.

4. Verify the connection

From WSL, check the endpoint directly:

curl http://172.31.240.1:9222/json

If it returns JSON entries with webSocketDebuggerUrl, the connection is working.

Troubleshooting

  • Port in use: Make sure nothing else is bound to 9222.
  • Cannot reach 9222: Confirm the port proxy and firewall rule were created.
  • Chrome didn’t launch: The command assumes C:\Program Files\Google\Chrome\Application\chrome.exe; update it if your install path differs.

Summary

The core flow is: forward and open port 9222 on Windows, launch Chrome with remote debugging, then use the WSL gateway IP to reach /json. After that, WSL-based MCP clients can connect to Chrome reliably.