@bsbofmusic/cdper
v1.2.2
Published
CLI for controlled remote use of a user's real Chrome/Edge through CDP Bridge
Maintainers
Readme
@bsbofmusic/cdper
CLI for controlled access to a user's real Chrome/Edge session through CDP Bridge. Powers @bsbofmusic/cdper-mcp; Playwright CDP is an internal transport, not the public API.
Install
npm install -g @bsbofmusic/cdperQuick Start
# Verify installation
cdper doctor
# Open a page
cdper open https://example.com --json
# Save tabId, workflowId, and leaseId from the JSON result.
# Get accessibility snapshot with @ref annotations
cdper snapshot <tabId> --workflow-id <workflowId> --lease-id <leaseId>
# Interact
cdper click <tabId> @5 --workflow-id <workflowId> --lease-id <leaseId>
cdper type <tabId> @5 "hello world" --workflow-id <workflowId> --lease-id <leaseId>
cdper press <tabId> Enter --workflow-id <workflowId> --lease-id <leaseId>
# List tabs
cdper tabs
# Screenshot
cdper screenshot <tabId> --out shot.png --workflow-id <workflowId> --lease-id <leaseId>
cdper screenshot <tabId> --out shot.png --lite --timeout 8000 --workflow-id <workflowId> --lease-id <leaseId>
# JSON output is path-only by default; request base64 explicitly when needed.
cdper screenshot <tabId> --json --include-data --workflow-id <workflowId> --lease-id <leaseId>
# Extract current-page links or text blocks
cdper extract <tabId> --mode links --limit 10 --workflow-id <workflowId> --lease-id <leaseId> --json
cdper extract <tabId> --mode text --selector "main" --workflow-id <workflowId> --lease-id <leaseId> --json
# Wait for content or a selector
cdper wait <tabId> --text "Example Domain" --timeout 5000 --workflow-id <workflowId> --lease-id <leaseId>
cdper wait <tabId> --selector "h1" --timeout 5000 --workflow-id <workflowId> --lease-id <leaseId>
# Evaluate JavaScript
cdper eval <tabId> "document.title" --workflow-id <workflowId> --lease-id <leaseId>
# ChatGPT / Doubao
cdper chatgpt "explain quantum computing"
cdper doubao "解释量子计算"
# Close tab
cdper close <tabId> --workflow-id <workflowId> --lease-id <leaseId>Configuration and diagnostics
cdper doctor resolves CDP in this order: explicit --ws, CDP_WS, ~/.cdp-auth.json, then ~/.cdp-bridge/config.json plus CDP_BRIDGE_HOST.
The doctor output is token-redacted and is designed to be pasted into agent reports safely, but do not share raw ws://...token=... URLs.
After upgrading @bsbofmusic/cdper, @bsbofmusic/cdper-mcp, or official plugins, reload the already-running MCP gateway before retesting. Hermes users should run /reload-mcp; other native clients should restart/reload the MCP server from the client UI. A fresh npx version does not update an already-started MCP process.
Common cold-start states:
- no CDP configuration: ask the user for the CDP Bridge generated Tailscale IP, bridge port, and WS token/full WS URL, then write a private
~/.cdp-auth.jsonor setCDP_WS. Expected shape:ws://<TAILSCALE_IP>:<BRIDGE_PORT>/devtools/browser?token=<TOKEN>. portDriftCandidate: cdp-bridge is listening on a nearby port instead of the configured one. UpdateCDP_WS/~/.cdp-auth.json/~/.cdp-bridge/config.json, then reload the MCP client.bridgeReachable=trueandbrowserReady=false: the bridge is online but Chrome CDP is standby. Start a browser from CDP Bridge (advanced+Defaultprofile if you need the persistent replica), then retry.cdpernot found after global install: your npm global bin is not onPATH; use the MCPnpx -y @bsbofmusic/cdper-mcp@latestform or add the npm global bin directory toPATH.- Chrome/Edge built-in Remote debugging is enabled on the same local debug port: turn that browser setting off and let CDP Bridge own the debug port, then rerun
/control/startordoctor --deep.
Playwright-core policy
@bsbofmusic/cdper bundles a pinned, stable playwright-core for the official playwright-cdp transport. Users do not install full playwright, do not run npx playwright install, and do not use Playwright selectors as the cdper API. Upgrades happen by installing a newer cdper release after release gates pass.
Architecture
- Tab State: Persisted at
~/.cdper/tabs.json, 4-hour TTL - Tab Lease:
cdper open --jsonreturnsworkflowId+leaseId; leased tab actions must provide both to prevent cross-workflow mistakes - @ref System: Each
cdper snapshotassigns incrementing IDs (@1, @2...) to interactive elements - Short-lived connections: Each command attaches → executes → disconnects
Stable JSON contracts
cdper open --jsonalways includes top-leveltabId,workflowId,leaseId,leaseExpiresAt,targetId,url,title, and the legacy nestedtabobject.cdper eval --jsonalways includesok,result,type, andjsonSerializable; if JavaScript returnsundefined,resultisnullandtypeisundefined.cdper screenshot --jsonincludesmode,timeoutMs,elapsedMs,tabId,url, andtitle; it omits base64 image data unless--include-datais passed. Normal screenshots retry once in lite mode after a capture timeout unless--no-retry-liteis set.cdper extract --jsonis a generic current-page primitive (linksortext); link items include originalhrefplus best-effort unwrappedurlfor common redirect links. It is not a search-engine-specific parser.--jsonwrites machine-readable JSON to stdout; logs, warnings, and debug output go to stderr so agents can parse stdout directly.
License
MIT
