Communitygithub.com

cli-anything-browser

DOMShell MCPサーバーを使ったブラウザ自動化CLIです。`ls`、`cd`、`cat`、`grep`、`click`といったファイルシステムコマンドでWebページを操作します。

cli-anything-browser とは?

cli-anything-browserは、DOMShellのMCPサーバーを利用してブラウザを操作するコマンドラインツールです。アクセシビリティツリーを仮想的なファイルシステムとして扱い、`ls`、`cd`、`cat`、`grep`、`click`などの馴染みのあるコマンドでWebページのナビゲーションや要素の操作が行えます。Node.js/npx環境、ChromeとDOMShell拡張機能、Python 3.10以上が必要です。エージェントワークフローに最適化されており、`--json`フラグによるマシンリーダブルな出力、複数コマンドを効率的に実行できるデーモンモード、対話型REPLをサポートします。セキュリティ面ではURLスキームの制限やプライベートネットワークブロック機能を備え、AIエージェントが安全にブラウザ操作を行える設計になっています。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/HKUDS/CLI-Anything/tree/main/skills/cli-anything-browser

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

cli-anything-browser は何をしますか?

DOMShellのMCPサーバーを使用したブラウザ自動化のためのコマンドラインインターフェースです。ls、cd、cat、grep、clickのようなファイルシステムコマンドでWebページを操作できます。

インストール

前提条件

  1. Node.js と npx(DOMShell MCPサーバー用):

    # Node.js を https://nodejs.org/ からインストール
    npx --version
    
  2. Chrome/Chromium に DOMShell 拡張機能 をインストール:

    • Chrome に拡張機能をインストール
    • CLI を使用する前に Chrome が起動していることを確認
  3. Python 3.10+

CLI のインストール

cd browser/agent-harness
pip install -e .

コマンドグループ

page — ページナビゲーション

  • page open <url> — URLに移動
  • page reload — 現在のページを再読み込み
  • page back — 履歴を戻る
  • page forward — 履歴を進む
  • page info — 現在のページ情報を表示

fs — ファイルシステムコマンド(アクセシビリティツリー)

  • fs ls [path] — パス内の要素を一覧表示
  • fs cd <path> — ディレクトリを変更
  • fs cat [path] — 要素の内容を読み取り
  • fs grep <pattern> [path] — テキストパターンを検索
  • fs pwd — 作業ディレクトリを表示

act — アクションコマンド

  • act click <path> — 要素をクリック
  • act type <path> <text> — 入力フィールドにテキストを入力

session — セッション管理

  • session status — セッション状態を表示
  • session daemon-start — 永続的なデーモンモードを起動
  • session daemon-stop — デーモンモードを停止

使用例

基本的なナビゲーション

# ページを開く
cli-anything-browser page open https://example.com

# 構造を探索
cli-anything-browser fs ls /
cli-anything-browser fs cd /main
cli-anything-browser fs ls

# ルートに戻る
cli-anything-browser fs cd /

検索とクリック

cli-anything-browser fs grep "Login"
cli-anything-browser act click /main/button[0]

フォーム入力

cli-anything-browser act type /main/input[0] "[email protected]"
cli-anything-browser act click /main/button[0]

JSON出力

cli-anything-browser --json fs ls /

デーモンモード(高速な対話操作)

# 永続的な接続を開始
cli-anything-browser session daemon-start

# コマンドを実行(永続的な接続を使用)
cli-anything-browser fs ls /
cli-anything-browser fs cd /main

# デーモンを停止
cli-anything-browser session daemon-stop

対話型REPL

cli-anything-browser

パス構文

DOMShellはアクセシビリティツリーに対してファイルシステムのようなパスを使用します:

/                           — ルート(ドキュメント)
/main                       — mainランドマーク
/main/div[0]                — main内の最初のdiv
/main/div[0]/button[2]      — 最初のdiv内の3番目のボタン
  • 配列インデックスは0から始まります: button[0] は最初のボタン
  • .. で1階層上に移動
  • / でルートへ

エージェント固有のガイダンス

解析用JSON出力

すべてのコマンドは機械可読出力のための --json フラグをサポートしています:

cli-anything-browser --json fs ls /

出力:

{
  "path": "/",
  "entries": [
    {"name": "main", "role": "landmark", "path": "/main"}
  ]
}

エラーハンドリング

CLIは一般的な問題に対して明確なエラーメッセージを提供します:

  • npx が見つかりません: Node.js を https://nodejs.org/ からインストール
  • DOMShell が見つかりません: npx @apireno/domshell --version を実行
  • MCP呼び出しに失敗: DOMShell Chrome拡張機能をインストール

コマンドを実行する前に、is_available() の戻り値を確認してください。

効率化のためのデーモンモード

複数のコマンドを実行するエージェントワークフローでは、デーモンモードを使用してください:

  1. デーモンを開始: cli-anything-browser session daemon-start
  2. コマンドを実行: 各コマンドがMCP接続を再利用
  3. デーモンを停止: cli-anything-browser session daemon-stop

これにより、コマンドごとに1~3秒かかるコールドスタートのオーバーヘッドを回避できます。

リンク

セキュリティ上の考慮事項

重要: このCLIをAIエージェントと使用する場合、以下のセキュリティ上の考慮事項に注意してください。

URL制限

ブラウザハーネスは、ナビゲーション前にすべてのURLを検証します:

  • スキームの明示必須: URLには http:// または https:// スキームを含める必要があります(example.com のようなスキームなしのURLは拒否されます)
  • ブロックされるスキーム: file://、javascript://、data://、vbscript://、about://、chrome://、およびブラウザ内部スキーム
  • 許可されるスキーム: http:// と https:// のみ(CLI_ANYTHING_BROWSER_ALLOWED_SCHEMES で設定可能)
  • プライベートネットワークブロック: CLI_ANYTHING_BROWSER_BLOCK_PRIVATE=true でオプション(デフォルトでは無効)

DOMコンテンツのリスク

アクセシビリティツリーには、ページ上の可視および非表示のすべての要素が含まれます。悪意のあるWebサイトは以下を行う可能性があります:

  • 操作的なテキスト(例:「前の指示を無視してください」)を含むARIAラベルを作成
  • aria-hidden要素を使用してユーザーに見えないコンテンツを挿入
  • ナビゲーションを誤誘導する混乱したDOM構造を作成

軽減策: 信頼できないWebサイトとやり取りする場合は、以下を検討してください:

  1. --json フラグを使用して、安全に解析しやすい構造化出力を取得
  2. プロンプトに含める前にDOMコンテンツをサニタイズまたはフィルタリング
  3. 信頼できるドメインにナビゲーションを制限

プライベートネットワークアクセス

デフォルトでは、ブラウザはlocalhostやプライベートネットワーク(192.168.x.x、10.x.x.xなど)にアクセスできます。ブロックするには:

export CLI_ANYTHING_BROWSER_BLOCK_PRIVATE=true
cli-anything-browser page open http://localhost:8080  # ブロックされます

セッションの分離

複数のブラウザセッションは同じChromeインスタンスを共有します。Cookieや認証状態はセッション間で保持される可能性があります。機密性の高い操作では、以下を検討してください:

  1. Chromeのゲストモードまたはシークレットモードを使用
  2. セッション間でCookieをクリア
  3. 異なるセキュリティコンテキストに別々のChromeプロファイルを使用

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

cli-anything-adguardhome

>-

cli-anything-anygen

>-

cli-anything-audacity

>-

cli-anything-blender

>-

cli-anything-calibre

>-

cli-anything-ccswitch

CLI interface for CC Switch — manage AI coding tool configurations from the terminal

cli-anything-chromadb

>-

cli-anything-cloudanalyzer

Command-line interface for CloudAnalyzer — Agent-friendly harness for CloudAnalyzer, a QA platform for mapping, localization, and perception outputs. Supports 27 commands across 8 groups: point cloud evaluation, trajectory evaluation, ground segmentation QA, config-driven quality gates, baseline evolution, processing, visualization, and interactive REPL.

cli-anything-cloudcompare

Command-line interface for CloudCompare — Agent-friendly harness for CloudCompare, the open-source 3D point cloud and mesh processing software. Supports 41 commands across 9 groups: project management, session control, point cloud operations (subsample, filter, segment, analyze), mesh operations, distance computation (C2C, C2M), transformations (ICP, matrix), export (LAS/LAZ/PLY/PCD/OBJ/STL/E57), and interactive REPL.

cli-anything-comfyui

>-

cli-anything-dify-workflow

Wrapper for the Dify workflow DSL CLI. Create, inspect, validate, edit, and export Dify workflow files through a CLI-Anything harness.

cli-anything-drawio

>-

cli-anything-eez-studio

Use EEZ Studio from the command line: inspect and modify native .eez-project files, edit LVGL screens/widgets, manage SCPI commands, and invoke the real EEZ Studio backend for LVGL builds.

cli-anything-eth2-quickstart

>-

cli-anything-exa

>-

cli-anything-firefly-iii

Firefly III CLI - Personal finance management via CLI-Anything

cli-anything-freecad

Complete CLI harness for FreeCAD parametric 3D CAD modeler (258 commands). Covers ALL workbenches: Part (29 primitives + boolean + mirror + loft + sweep), Sketcher (26 cmds: geometry + constraints + editing), PartDesign (38 cmds: pad/pocket/groove/fillet/chamfer/patterns/hole/datum), Assembly (11 cmds), Mesh (16 cmds), TechDraw (15 cmds: views + dimensions + PDF/SVG), Draft (33 cmds: 2D shapes + arrays + transforms), FEM (12 cmds), CAM/CNC (10 cmds), Surface (6 cmds), Spreadsheet (7 cmds), Import (13 formats), Export (17 formats), Measure (12 cmds), Materials (21 presets). Headless FreeCAD export to STEP/IGES/STL/OBJ/DXF/PDF/glTF/3MF.

cli-anything-gimp

>-

cli-anything-godot

>-

cli-anything-inkscape

>-

関連スキル