Skip to content

Hardcoded CDP port 9222 prevents parallel Chrome instances #24

@gwpl

Description

@gwpl

Problem

startChrome() in chrome-ws-lib.js hardcodes --remote-debugging-port=9222. This causes:

  • Silent failures when port 9222 is already in use (another Chrome, another MCP session, or any other service)
  • No multi-instance support — running two Claude Code sessions that both use superpowers-chrome is impossible
  • No reconnection — if MCP restarts while Chrome is still alive, it cannot rediscover the running instance

The CHROME_WS_PORT env var only affects the client connection side, not the Chrome launch port.

Proposed Solution

  • Dynamic port allocation from range 9222–12111 (backward compatible: first session gets 9222 when free)
  • Per-profile meta.json at ~/.cache/superpowers/browser-profiles/{name}.meta.json storing port, PID, headless mode
  • Reconnection to existing Chrome instances via meta.json on startup
  • --port=N flag for both MCP server and CLI for advanced users
  • Stale meta.json detection via PID liveness check + /json/version probe

Implementation: #23

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions