Problem
When MCP clients reconnect (e.g. running /mcp in Claude Code, or restarting the client), each reconnect spawns a new chrome-devtools-mcp process without killing the previous one. Multiple CDP clients on the same debug port fight over protocol sessions, causing Network.enable timed out errors.
Root cause
There's no mechanism to prevent or clean up duplicate connections to the same browser endpoint. Running lsof -i :9222 after a few reconnects shows 3-4 node processes all connected to port 9222.
The existing in-process guard in browser.ts (if (browser?.connected)) only prevents reconnections within the same process. It does nothing for separate processes.
Reproduction
- Configure chrome-devtools-mcp with
--browserUrl=http://127.0.0.1:9222
- Start an MCP session (connect from Claude Code, Gemini CLI, etc.)
- Reconnect the MCP session (e.g.
/mcp in Claude Code)
- Repeat 2-3 times
- Run
lsof -i :9222 | grep node and observe multiple processes
- Any tool call now fails with
Network.enable timed out
Fix
Draft PR: #1761
Adds endpoint-based PID lock files. On startup, the server checks if another instance is already connected to the same endpoint, kills it, waits for it to die, then acquires the lock.
Related: #1156, #657
Problem
When MCP clients reconnect (e.g. running
/mcpin Claude Code, or restarting the client), each reconnect spawns a newchrome-devtools-mcpprocess without killing the previous one. Multiple CDP clients on the same debug port fight over protocol sessions, causingNetwork.enable timed outerrors.Root cause
There's no mechanism to prevent or clean up duplicate connections to the same browser endpoint. Running
lsof -i :9222after a few reconnects shows 3-4 node processes all connected to port 9222.The existing in-process guard in
browser.ts(if (browser?.connected)) only prevents reconnections within the same process. It does nothing for separate processes.Reproduction
--browserUrl=http://127.0.0.1:9222/mcpin Claude Code)lsof -i :9222 | grep nodeand observe multiple processesNetwork.enable timed outFix
Draft PR: #1761
Adds endpoint-based PID lock files. On startup, the server checks if another instance is already connected to the same endpoint, kills it, waits for it to die, then acquires the lock.
Related: #1156, #657