Agent SkillsHKUDS/CLI-Anything › cli-anything-browser

cli-anything-browser

GitHub

基于DOMShell MCP的浏览器自动化CLI,将Chrome无障碍树映射为虚拟文件系统,支持页面导航、元素操作及脚本交互。

browser/agent-harness/cli_anything/browser/skills/SKILL.md HKUDS/CLI-Anything

Trigger Scenarios

需要程序化控制浏览器进行网页导航 通过命令行自动化填写表单或点击元素 以文件路径方式解析和操作Web页面结构

Install

npx skills add HKUDS/CLI-Anything --skill cli-anything-browser -g -y
More Options

Non-standard path

npx skills add https://github.com/HKUDS/CLI-Anything/tree/main/browser/agent-harness/cli_anything/browser/skills -g -y

Use without installing

npx skills use HKUDS/CLI-Anything@cli-anything-browser

指定 Agent (Claude Code)

npx skills add HKUDS/CLI-Anything --skill cli-anything-browser -a claude-code -g -y

安装 repo 全部 skill

npx skills add HKUDS/CLI-Anything --all -g -y

预览 repo 内 skill

npx skills add HKUDS/CLI-Anything --list

SKILL.md

Frontmatter
{
    "name": "cli-anything-browser",
    "description": "Browser automation CLI using DOMShell MCP server. Maps Chrome's Accessibility Tree to a virtual filesystem for agent-native navigation."
}

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

  1. Node.js and npx (for DOMShell MCP server):

    # Install Node.js from https://nodejs.org/
    npx --version
    
  2. Chrome/Chromium with DOMShell extension:

    • Install extension in Chrome
    • Ensure Chrome is running before using CLI
  3. Python 3.10+

Install CLI

cd browser/agent-harness
pip install -e .

Command Groups

page — Page Navigation

  • page open <url> — Navigate to URL
  • page reload — Reload current page
  • page back — Navigate back in history
  • page forward — Navigate forward in history
  • page info — Show current page info

fs — Filesystem Commands (Accessibility Tree)

  • fs ls [path] — List elements at path
  • fs cd <path> — Change directory
  • fs cat [path] — Read element content
  • fs grep <pattern> [path] — Search for text pattern
  • fs pwd — Print working directory

act — Action Commands

  • act click <path> — Click an element
  • act type <path> <text> — Type text into input

session — Session Management

  • session status — Show session state
  • session daemon-start — Start persistent daemon mode
  • session 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:

  1. Start daemon: cli-anything-browser session daemon-start
  2. Run commands: Each command reuses the MCP connection
  3. 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:// or https:// scheme (scheme-less URLs like example.com are rejected)
  • Blocked schemes: file://, javascript://, data://, vbscript://, about://, chrome://, and browser-internal schemes
  • Allowed schemes: http:// and https:// only (configurable via CLI_ANYTHING_BROWSER_ALLOWED_SCHEMES)
  • Private network blocking: Optional via CLI_ANYTHING_BROWSER_BLOCK_PRIVATE=true (disabled by default)

DOM Content Risks

The Accessibility Tree includes all visible and hidden elements on a page. Malicious websites could:

  • Craft ARIA labels with manipulative text (e.g., "Ignore previous instructions")
  • Use aria-hidden elements to inject content not visible to users
  • Create confusing DOM structures that mislead navigation

Mitigation: When interacting with untrusted websites, consider:

  1. Using the --json flag for structured output that's easier to parse safely
  2. Sanitizing or filtering DOM content before including it in prompts
  3. Limiting navigation to trusted domains

Private Network Access

By default, the browser can access localhost and private networks (192.168.x.x, 10.x.x.x, etc.). To block:

export CLI_ANYTHING_BROWSER_BLOCK_PRIVATE=true
cli-anything-browser page open http://localhost:8080  # Will be blocked

Session Isolation

Multiple browser sessions share the same Chrome instance. Cookies and authentication state may persist across sessions. For sensitive operations, consider:

  1. Using Chrome's guest mode or incognito
  2. Clearing cookies between sessions
  3. Using separate Chrome profiles for different security contexts

Version History

  • 6f372d3 Current 2026-08-20 06:39

Same Skill Collection

3MF/agent-harness/cli_anything/threemf/skills/SKILL.md
adguardhome/agent-harness/cli_anything/adguardhome/skills/SKILL.md
anygen/agent-harness/cli_anything/anygen/skills/SKILL.md
audacity/agent-harness/cli_anything/audacity/skills/SKILL.md
blender/agent-harness/cli_anything/blender/skills/SKILL.md
calibre/agent-harness/cli_anything/calibre/skills/SKILL.md
cc-switch/agent-harness/cli_anything/ccswitch/skills/SKILL.md
chromadb/agent-harness/cli_anything/chromadb/skills/SKILL.md
cli-hub-matrix/3d-cad/SKILL.md
cli-hub-matrix/game-development/SKILL.md
cli-hub-matrix/image-design/SKILL.md
cli-hub-matrix/knowledge-research/SKILL.md
cli-hub-meta-skill/SKILL.md
cloudanalyzer/agent-harness/cli_anything/cloudanalyzer/skills/SKILL.md
cloudcompare/agent-harness/cli_anything/cloudcompare/skills/SKILL.md
codex-skill/SKILL.md
comfyui/agent-harness/cli_anything/comfyui/skills/SKILL.md
dify-workflow/agent-harness/cli_anything/dify_workflow/skills/SKILL.md
drawio/agent-harness/cli_anything/drawio/skills/SKILL.md
eez-studio/agent-harness/cli_anything/eez_studio/skills/SKILL.md
eth2-quickstart/agent-harness/cli_anything/eth2_quickstart/skills/SKILL.md
exa/agent-harness/cli_anything/exa/skills/SKILL.md
firefly-iii/agent-harness/cli_anything/firefly_iii/skills/SKILL.md
firefly-iii/agent-harness/skills/cli-anything-firefly-iii/SKILL.md
gimp/agent-harness/cli_anything/gimp/skills/SKILL.md
godot/agent-harness/cli_anything/godot/skills/SKILL.md
hermes-skill/SKILL.md
inkscape/agent-harness/cli_anything/inkscape/skills/SKILL.md
intelwatch/agent-harness/cli_anything/intelwatch/skills/SKILL.md
joplin/agent-harness/cli_anything/joplin/skills/SKILL.md
jumpserver/agent-harness/cli_anything/jumpserver/skills/SKILL.md
kdenlive/agent-harness/cli_anything/kdenlive/skills/SKILL.md
krita/agent-harness/cli_anything/krita/skills/SKILL.md
libreoffice/agent-harness/cli_anything/libreoffice/skills/SKILL.md
live2d/agent-harness/cli_anything/live2d/skills/SKILL.md
macrocli/agent-harness/cli_anything/macrocli/skills/SKILL.md
macrocli/SKILL.md
mailchimp/agent-harness/cli_anything/mailchimp/skills/SKILL.md
mermaid/agent-harness/cli_anything/mermaid/skills/SKILL.md
minimax/agent-harness/cli_anything/minimax/skills/SKILL.md
mubu/agent-harness/cli_anything/mubu/skills/SKILL.md
musescore/agent-harness/cli_anything/musescore/skills/SKILL.md
n8n/agent-harness/cli_anything/n8n/skills/SKILL.md
notebooklm/agent-harness/cli_anything/notebooklm/skills/SKILL.md
novita/agent-harness/cli_anything/novita/skills/SKILL.md
nsight-graphics/agent-harness/cli_anything/nsight_graphics/skills/SKILL.md
nslogger/agent-harness/cli_anything/nslogger/skills/SKILL.md
obs-studio/agent-harness/cli_anything/obs_studio/skills/SKILL.md
obsidian/agent-harness/cli_anything/obsidian/skills/SKILL.md

Metadata

Files
0
Version
6f372d3
Hash
1e913472
Indexed
2026-08-20 06:39

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-22 09:53
浙ICP备14020137号-1 $Map of visitor$