cli-anything-browser
它能做什么
这个技能让智能体用类似文件夹的命令在 Chrome 打开的网页中移动,例如列出项目、打开各个部分和点击。适合希望通过简单命令界面让 AI 使用网站的人。
适用场景
- ✓当你想让智能体在 Chrome 打开的网页上查找并点击某个内容的时候。
- ✓当你想读取网页某一部分的文字,而不想截图的时候。
- ✓当你想在网页中搜索某个特定词语或短语的时候。
技能链接
https://github.com/HKUDS/CLI-Anything/blob/main/browser/agent-harness/cli_anything/browser/skills/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在 Chrome 中打开定价页面,并找出它在哪里列出了企业版套餐。”
每周 5 个新技能,1 分钟读完。
工作原理
该技能连接到 Chrome 中的 DOMShell 扩展,它会把网页结构转换为类似文件夹的视图。然后你的智能体使用 ls、cd、cat、grep 等命令进行浏览,需要时还可以点击或输入。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
cli-anything-browser
A command-line interface for browser automation using DOMShell's MCP server. Navigate web pages using filesystem commands: ls, cd, cat, grep, click.
Installation
Prerequisites
Node.js and npx (for DOMShell MCP server):
# Install Node.js from https://nodejs.org/ npx --versionChrome/Chromium with DOMShell extension:
- Install extension in Chrome
- Ensure Chrome is running before using CLI
Python 3.10+
Install CLI
cd browser/agent-harness
pip install -e .
Command Groups
page — Page Navigation
page open <url>— Navigate to URLpage reload— Reload current pagepage back— Navigate back in historypage forward— Navigate forward in historypage info— Show current page info
fs — Filesystem Commands (Accessibility Tree)
fs ls [path]— List elements at pathfs cd <path>— Change directoryfs cat [path]— Read element contentfs grep <pattern> [path]— Search for text patternfs pwd— Print working directory
act — Action Commands
act click <path>— Click an elementact type <path> <text>— Type text into input
session — Session Management
session status— Show session statesession daemon-start— Start persistent daemon modesession daemon-stop— Stop daemon mode
Usage Examples
Basic Navigation
# Open a page
cli-anything-browser page open https://example.com
# Explore structure
cli-anything-browser fs ls /
cli-anything-browser fs cd /main
cli-anything-browser fs ls
# Go back to root
cli-anything-browser fs cd /
Search and Click
cli-anything-browser fs grep "Login"
cli-anything-browser act click /main/button[0]
Form Fill
cli-anything-browser act type /main/input[0] "user@example.com"
cli-anything-browser act click /main/button[0]
JSON Output
cli-anything-browser --json fs ls /
Daemon Mode (Faster Interactive Use)
# Start persistent connection
cli-anything-browser session daemon-start
# Run commands (uses persistent connection)
cli-anything-browser fs ls /
cli-anything-browser fs cd /main
# Stop daemon when done
cli-anything-browser session daemon-stop
Interactive REPL
cli-anything-browser
Path Syntax
DOMShell uses a filesystem-like path for the Accessibility Tree:
/ — Root (document)
/main — Main landmark
/main/div[0] — First div in main
/main/div[0]/button[2] — Third button in first div
- Array indices are 0-based:
button[0]is the first button - Use
..to go up one level - Use
/for root
Agent-Specific Guidance
JSON Output for Parsing
All commands support --json flag for machine-readable output:
cli-anything-browser --json fs ls /
Returns:
{
"path": "/",
"entries": [
{"name": "main", "role": "landmark", "path": "/main"}
]
}
Error Handling
The CLI provides clear error messages for common issues:
- npx not found: Install Node.js from https://nodejs.org/
- DOMShell not found: Run
npx @apireno/domshell --version - MCP call failed: Install DOMShell Chrome extension
Check is_available() return value before running commands.
Daemon Mode for Efficiency
For agent workflows with multiple commands, use daemon mode:
- Start daemon:
cli-anything-browser session daemon-start - Run commands: Each command reuses the MCP connection
- Stop daemon:
cli-anything-browser session daemon-stop
This avoids the 1-3 second cold start overhead for each command.
Links
Security Considerations
IMPORTANT: When using this CLI with AI agents, be aware of the following security considerations:
URL Restrictions
The browser harness validates all URLs before navigation:
- Explicit scheme required: URLs must include
http://orhttps://scheme (scheme-less URLs likeexample.comare rejected) - Blocked schemes:
file://,javascript://,data://,vbscript://,about://,chrome://, and browser-internal schemes - **Al
常见问题
我需要安装什么?
你需要 Node.js、装有 DOMShell 扩展的 Chrome,以及 Python 3.10 或更新版本。
使用时 Chrome 必须打开吗?
是的。使用该技能前,Chrome 必须正在运行。
它能填写表单吗?
可以。它既可以点击元素,也可以在输入框中输入文字。
详情
作者的原始描述
Browser automation CLI using DOMShell MCP server. Maps Chrome's Accessibility Tree to a virtual filesystem for agent-native navigation.
repo: HKUDS/CLI-Anything
热度
- GitHub 星标
- 58k
- 排名
- #3185
- 许可证
- Apache-2.0
- 更新时间
- 2026/9/21
评论
- …
同一仓库的更多技能
cli-anything-3mf
58k帮你的智能体检查和修复 3D 打印文件,包括查找圆孔、调整孔径、修复网格,以及比较两个文件。
cli-anything-qgis
58k帮你的智能体在终端中打开、编辑和导出 QGIS 地图项目,包括图层、要素、打印布局和处理工具。
cli-anything-adguardhome
58k帮你的智能体管理 AdGuard Home,这是一款全网络广告拦截器,可管理过滤规则、DNS 重写、客户端和查询日志。
cli-anything-anygen
58k帮你的智能体借助 AnyGen 服务,根据文字提示生成幻灯片、文档、网站和图表。