Skip to content

multiple MCP processes on same debug port cause Network.enable timeout #1763

@yuvrajangadsingh

Description

@yuvrajangadsingh

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

  1. Configure chrome-devtools-mcp with --browserUrl=http://127.0.0.1:9222
  2. Start an MCP session (connect from Claude Code, Gemini CLI, etc.)
  3. Reconnect the MCP session (e.g. /mcp in Claude Code)
  4. Repeat 2-3 times
  5. Run lsof -i :9222 | grep node and observe multiple processes
  6. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions