New advertisers: 50% off your first month with code FIRSTMONTHSee slots

Drives a Chrome browser over CDP to reuse existing login sessions for automation and token extraction.

skills.sh installs
11.8K
GitHub stars
8.8K
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers launching Chrome in debug mode, opening URLs, waiting for page load, evaluating JavaScript, taking snapshots, and extracting auth tokens
  • Runs the setup-cdp-chrome.js script with detect-only, reset, profile, and dry-run options, with exit codes for consent handling
  • Requires explicit user consent before ending running Chrome processes, with a dry-run step and a NEEDS_CONSENT exit code for non-interactive calls
  • Built on the agent-browser CLI and intended for tasks that need an already-logged-in browser session on macOS, Linux, or Windows

Install

$ npx -y skills add zenstory-ai/oh-story-claudecode --skill browser-cdp -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Browser CDP 操作工具

通过 CDP(Chrome DevTools Protocol)连接 Chrome,复用登录态并执行浏览器操作。

前置条件

  • macOS / Linux / Windows(实验性),已安装并使用过 Google Chrome,来源 profile 已存在
  • Node.js 20+
  • agent-browser 已安装:npm install -g agent-browser

启动或重建时,若需结束 Chrome 进程,先按下方流程征得同意;未保存的标签页或草稿可能丢失。


启动流程(每次都按这个顺序)

下文 {SKILL_DIR} 指本 skill(browser-cdp)的目录。

第一步:探测当前状态(无副作用)

node {SKILL_DIR}/scripts/setup-cdp-chrome.js 9222 --detect-only

输出形如:

CDP_STATUS=ready                        # 已就绪,可直接复用
CDP_URL=http://127.0.0.1:9222/json/version
BROWSER=Chrome/148.0.7778.168

或:

CDP_STATUS=needs-setup
CHROME_RUNNING=yes                      # 用户有 Chrome 在跑,启动会杀掉
CHROME_PID_COUNT=3

第二步:根据探测结果分支

  • CDP_STATUS=needs-setup 且 CHROME_INSTALLED=no → 本机没找到 Chrome,告诉用户先安装并用它登录一次需要的网站,不要运行 setup。
  • CDP_STATUS=ready 且本次只需连接 → 直接使用 agent-browser --cdp 9222 ...,不要运行 setup。
  • 明确请求 --reset / --profile → 即使 ready 也走重建,按下方「需要结束 Chrome 时」处理。
  • CDP_STATUS=needs-setup 且 CHROME_RUNNING=no → 安全启动:
    node {SKILL_DIR}/scripts/setup-cdp-chrome.js 9222 --yes
    
  • CDP_STATUS=needs-setup 且 CHROME_RUNNING=yes → 按下方「需要结束 Chrome 时」处理。

Details

Repository
github.com/zenstory-ai/oh-story-claudecode
Category
Browser Automation & Scraping
First seen
May 16, 2026

More from zenstory-ai/oh-story-claudecode

All 13