Make any website your CLI.
Zero risk · Reuse Chrome login · AI-powered discovery · 80+ commands · 19 sites
A CLI tool that turns any website into a command-line interface — Bilibili, Zhihu, 小红书, Twitter/X, Reddit, YouTube, and many more — powered by browser session reuse and AI-native discovery.
- Highlights
- Prerequisites
- Quick Start
- Built-in Commands
- Output Formats
- For AI Agents (Developer Guide)
- Remote Chrome (Server/Headless)
- Testing
- Troubleshooting
- Releasing New Versions
- License
- Account-safe — Reuses Chrome's logged-in state; your credentials never leave the browser.
- AI Agent ready —
explorediscovers APIs,synthesizegenerates adapters,cascadefinds auth strategies. - Self-healing setup —
opencli setupauto-discovers tokens;opencli doctordiagnoses config across 10+ tools;--fixrepairs them all. - Dynamic Loader — Simply drop
.tsor.yamladapters into theclis/folder for auto-registration. - Dual-Engine Architecture — Supports both YAML declarative data pipelines and robust browser runtime TypeScript injections.
- Node.js: >= 18.0.0
- Chrome running and logged into the target site (e.g. bilibili.com, zhihu.com, xiaohongshu.com).
⚠️ Important: Browser commands reuse your Chrome login session. You must be logged into the target website in Chrome before running commands. If you get empty data or errors, check your login status first.
OpenCLI connects to your browser through the Playwright MCP Bridge extension.
It prefers an existing local/global @playwright/mcp install and falls back to npx -y @playwright/mcp@latest automatically when no local MCP server is found.
- Install Playwright MCP Bridge extension in Chrome.
- Run
opencli setup— discovers the token, distributes it to your tools, and verifies connectivity:
opencli setupThe interactive TUI will:
- 🔍 Auto-discover
PLAYWRIGHT_MCP_EXTENSION_TOKENfrom Chrome (no manual copy needed) - ☑️ Show all detected tools (Codex, Cursor, Claude Code, Gemini CLI, etc.)
- ✏️ Update only the files you select (Space to toggle, Enter to confirm)
- 🔌 Auto-verify browser connectivity after writing configs
Tip: Use
opencli doctorfor ongoing diagnosis and maintenance:opencli doctor # Read-only token & config diagnosis opencli doctor --live # Also test live browser connectivity opencli doctor --fix # Fix mismatched configs (interactive) opencli doctor --fix -y # Fix all configs non-interactively
Alternative: CDP Mode (For Servers/Headless) If you cannot install the browser extension (e.g. running OpenCLI on a remote headless server), you can connect OpenCLI to your local Chrome via CDP using SSH tunnels or reverse proxies. See the CDP Connection Guide for detailed instructions.
Manual setup (alternative)
Add token to your MCP client config (e.g. Claude/Cursor):
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["-y", "@playwright/mcp@latest", "--extension"],
"env": {
"PLAYWRIGHT_MCP_EXTENSION_TOKEN": "<your-token-here>"
}
}
}
}Export in shell (e.g. ~/.zshrc):
export PLAYWRIGHT_MCP_EXTENSION_TOKEN="<your-token-here>"npm install -g @jackwener/opencli
opencli setup # One-time: configure Playwright MCP tokenThen use directly:
opencli list # See all commands
opencli list -f yaml # List commands as YAML
opencli hackernews top --limit 5 # Public API, no browser
opencli bilibili hot --limit 5 # Browser command
opencli zhihu hot -f json # JSON output
opencli zhihu hot -f yaml # YAML outputgit clone git@github.com:jackwener/opencli.git
cd opencli
npm install
npm run build
npm link # Link binary globally
opencli list # Now you can use it anywhere!npm install -g @jackwener/opencli@latest19 sites · 80+ commands — run opencli list for the live registry.
| Site | Commands | Count | Mode |
|---|---|---|---|
trending bookmarks profile search timeline thread following followers notifications post reply delete like article follow unfollow bookmark unbookmark |
18 | 🔐 Browser | |
hot frontpage popular search subreddit read user user-posts user-comments upvote save comment subscribe saved upvoted |
15 | 🔐 Browser | |
| bilibili | hot search me favorite history feed subtitle dynamic ranking following user-videos |
11 | 🔐 Browser |
| v2ex | hot latest topic daily me notifications |
6 | 🌐 / 🔐 |
| xueqiu | feed hot-stock hot search stock watchlist |
6 | 🔐 Browser |
| xiaohongshu | search notifications feed me user |
5 | 🔐 Browser |
| youtube | search video transcript |
3 | 🔐 Browser |
| zhihu | hot search question |
3 | 🔐 Browser |
| boss | search detail |
2 | 🔐 Browser |
| coupang | search add-to-cart |
2 | 🔐 Browser |
| bbc | news |
1 | 🌐 Public |
| ctrip | search |
1 | 🔐 Browser |
| github | search |
1 | 🌐 Public |
| hackernews | top |
1 | 🌐 Public |
search |
1 | 🔐 Browser | |
| reuters | search |
1 | 🔐 Browser |
| smzdm | search |
1 | 🔐 Browser |
hot |
1 | 🔐 Browser | |
| yahoo-finance | quote |
1 | 🔐 Browser |
All built-in commands support --format / -f with table, json, yaml, md, and csv.
The list command supports the same format options, and keeps --json for backward compatibility.
opencli list -f yaml # Command registry as YAML
opencli bilibili hot -f table # Default: rich terminal table
opencli bilibili hot -f json # JSON (pipe to jq or LLMs)
opencli bilibili hot -f yaml # YAML (human-readable structured output)
opencli bilibili hot -f md # Markdown
opencli bilibili hot -f csv # CSV
opencli bilibili hot -v # Verbose: show pipeline debug stepsIf you are an AI assistant tasked with creating a new command adapter for opencli, please follow the AI Agent workflow below:
Quick mode: To generate a single command for a specific page URL, see CLI-ONESHOT.md — just a URL + one-line goal, 4 steps done.
Full mode: Before writing any adapter code, read CLI-EXPLORER.md. It contains the complete browser exploration workflow, the 5-tier authentication strategy decision tree, and debugging guide.
# 1. Deep Explore — discover APIs, infer capabilities, detect framework
opencli explore https://example.com --site mysite
# 2. Synthesize — generate YAML adapters from explore artifacts
opencli synthesize mysite
# 3. Generate — one-shot: explore → synthesize → register
opencli generate https://example.com --goal "hot"
# 4. Strategy Cascade — auto-probe: PUBLIC → COOKIE → HEADER
opencli cascade https://api.example.com/dataExplore outputs to .opencli/explore/<site>/ (manifest.json, endpoints.json, capabilities.json, auth.json).
See TESTING.md for the full testing guide, including:
- Current test coverage (unit + E2E tests across 19 sites)
- How to run tests locally
- How to add tests when creating new adapters
- CI/CD pipeline with sharding
- Headless browser mode (
OPENCLI_HEADLESS=1)
# Quick start
npm run build
npx vitest run # All tests
npx vitest run src/ # Unit tests only
npx vitest run tests/e2e/ # E2E tests- "Failed to connect to Playwright MCP Bridge"
- Ensure the Playwright MCP extension is installed and enabled in your running Chrome.
- Restart the Chrome browser if you just installed the extension.
- Empty data returns or 'Unauthorized' error
- Your login session in Chrome might have expired. Open a normal Chrome tab, navigate to the target site, and log in or refresh the page to prove you are human.
- Node API errors
- Make sure you are using Node.js >= 18. Some dependencies require modern Node APIs.
- Token issues
- Run
opencli doctorto diagnose token configuration across all tools.
- Run
npm version patch # 0.1.0 → 0.1.1
npm version minor # 0.1.0 → 0.2.0
git push --follow-tagsThe CI will automatically build, create a GitHub release, and publish to npm.