Skip to content

fix(browser): accept page-scoped CDP websocket endpoints #194

Closed

Description

@morluto

Problem

safeBrowserWebSocketUrl in src/browser/CdpEndpoint.ts currently rejects any webSocketDebuggerUrl path that is not browser-scoped (/devtools/browser/*).

In src/browser/CdpEndpoint.ts#L129, discovery validates with pathname.startsWith("/devtools/browser/"). If /json/version returns ws://.../devtools/page/<id>, discoverCdpEndpoint fails with invalid_endpoint_response before any targets can be listed or inspected.

tests/fixtures/fakeCdpBrowser.ts already has an invalidBrowserWebSocket path mode using /devtools/page/not-browser and the existing expectations currently treat this as a hard failure in tests/cdpBrowserProvider.test.ts.

Repro

  1. Start a CDP endpoint where /json/version returns webSocketDebuggerUrl: "ws://localhost:PORT/devtools/page/<id>".
  2. Invoke list_targets or inspect_web_page via CdpBrowserProvider or MCP.
  3. Discovery returns invalid_endpoint_response.

Expected

Accept page-scoped websocket URLs from /json/version (or provide a safe fallback) so compatible CDP providers with page-level sockets can be used.

Impact

Current behavior blocks valid CDP endpoints that expose only page socket URLs, reducing interoperability with nonstandard or proxied browser bridges.

Activity

  1. added
    bug
    area: runtime
    on Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: runtimebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions