cha133/chrome-cdp

★ 0Forks 0JavaScriptGitHub ↗Compare

README

chrome-cdp

Let your AI agent see and interact with your live browser session — Chrome, Edge, or a local Tauri 2 / WebView2 app. Connect to tabs you already have open, with logged-in accounts and current page state. No Puppeteer, no separate browser instance.

Attribution: This project is a modified fork of pasky/chrome-cdp-skill, originally released under the MIT License. See NOTICE for details.

What's new in this fork

Compared to the upstream project, this version adds:

  • --browser selection — target Chrome, Edge, Tauri, or auto (backward compatible)
  • Tauri 2 / WebView2 debugging — discover DevToolsActivePort from running WebView2 processes on Windows
  • Isolated caches and daemons per browser — no cross-browser target confusion
  • Console capture — console, errors, console-watch, console-clear
  • Clearer authorization guidance in the skill for Chrome/Edge vs. in-scope Tauri apps

Why this matters

Most browser automation tools launch a fresh, isolated browser. This one connects to the browser you're already running, so your agent can:

  • Read pages you're logged into (Gmail, GitHub, internal tools, ...)
  • Interact with tabs you're actively working in
  • Debug a local Tauri desktop app over CDP
  • See the actual state of a page mid-workflow, not a clean reload

Installation

As a pi skill

pi install git:github.com/YOUR_USER/[email protected]

Replace YOUR_USER with your GitHub username after publishing.

For other agents (Amp, Claude Code, Cursor, etc.)

Clone or copy the skills/chrome-cdp/ directory wherever your agent loads skills from. Use Bun when available; Node.js 22+ is the fallback. No package install is needed.

Example for Cursor / Claude Code global skills:

git clone https://github.com/YOUR_USER/chrome-cdp-skill.git
cp -r chrome-cdp-skill/skills/chrome-cdp ~/.agents/skills/chrome-cdp
# or ~/.claude/skills/chrome-cdp, ~/.cursor/skills-cursor/chrome-cdp, etc.

Enable remote debugging

Application How to enable
Chrome chrome://inspect/#remote-debugging — toggle the switch
Edge edge://inspect/#remote-debugging — toggle the switch
Tauri 2 (Windows) Enable WebView2 remote debugging before WebView creation

For non-standard endpoints, use --port-file, --browser-url, or --ws-endpoint.

Usage

Always pass the application the user named:

bun scripts/cdp.mjs --browser chrome list
bun scripts/cdp.mjs --browser edge  list
bun scripts/cdp.mjs --browser tauri list

The examples prefer bun. Replace it with node when Bun is unavailable; the CLI supports Node.js 22 or newer.

Continue using the same --browser on every command. Without --browser, auto picks the first available desktop browser (prefers Chrome).

bun scripts/cdp.mjs --browser chrome list
bun scripts/cdp.mjs --browser chrome shot   <target>
bun scripts/cdp.mjs --browser chrome snap   <target>
bun scripts/cdp.mjs --browser chrome eval   <target> "expression"
bun scripts/cdp.mjs --browser chrome nav    <target> https://...
bun scripts/cdp.mjs --browser chrome click  <target> "selector"
bun scripts/cdp.mjs --browser chrome clickxy <target> <x> <y>
bun scripts/cdp.mjs --browser chrome type   <target> "text"
bun scripts/cdp.mjs --browser chrome console <target> [level] [limit]
bun scripts/cdp.mjs --browser chrome errors  <target> [limit]
bun scripts/cdp.mjs --browser tauri --port-file "C:\\path\\to\\DevToolsActivePort" list
bun scripts/cdp.mjs --browser chrome open   [url]
bun scripts/cdp.mjs --browser chrome stop   [target]

<target> is a unique prefix of the targetId shown by list.

Environment variables: CDP_BROWSER, CDP_PORT_FILE, CDP_BROWSER_URL, CDP_WS_ENDPOINT.

Why not chrome-devtools-mcp?

chrome-devtools-mcp reconnects on every command, so Chrome's "Allow debugging" modal can re-appear repeatedly and target enumeration times out with many tabs open. chrome-cdp holds one persistent daemon per tab — the modal fires once, and it handles 100+ tabs reliably.

How it works

Connects directly to the browser's remote debugging WebSocket — no Puppeteer, no intermediary. On first access to a tab, a lightweight background daemon holds the session open. Chrome/Edge show an "Allow debugging" modal once per tab; subsequent commands reuse the daemon silently. Daemons auto-exit after 20 minutes of inactivity.

License

MIT — see LICENSE. This fork retains the original copyright notice from pasky/chrome-cdp-skill.

Contributors

cha133

Issues