Cssprobe Cli

io.github.mack-peng由 GitHub 帳號 mack-peng 發布v0.3.0更新於 Oct 24, 2026

Runtime CSS probe — inspect layout, overflow, scroll chains in a real browser. For AI agents.

已驗證STDIO僅桌面瀏覽器自動化開發者工具

概覽

AI 產生的概覽

本機 MCP 伺服器,會啟動真實的 Chromium 瀏覽器,讓助理檢查實際算繪的 CSS 版面、溢出與捲動行為。

可以做什麼
  • 開啟、關閉與查看瀏覽器工作階段狀態,支援有頭模式、自訂視埠與已儲存的登入狀態
  • 檢查選擇器的計算樣式與宣告樣式、DOM 樹、ASCII 版面圖,以及附信心等級的診斷結果
  • 在頁面中執行 JavaScript、注入 CSS、調整視埠大小並截圖
  • 點擊、懸停、輸入文字,以及等待選擇器、JS 條件或網路閒置
  • 執行多步驟流程腳本與 JSON 回歸測試套件,含斷言與產出檔案
適用情境
適合排查只在執行階段才出現的 CSS 問題:元素為何溢出、實際算繪版面為何、容器是否可捲動,而不是只憑原始碼猜測。也適合在樣式變更後驗證頁面,或進行可重複的瀏覽器回歸檢查。
執行需求
以本機 npm 套件 cssprobe-cli 執行,透過 mcp 子命令啟動;需要 Node.js 以及由 Playwright 管理的 Chromium 瀏覽器。僅支援桌面端,涵蓋 macOS、Linux、Windows 的 x64 與 arm64。未宣告需要帳號、API 金鑰或環境變數。
安裝前請注意
eval 與流程腳本會在瀏覽器中執行任意 JavaScript,腳本還會在本機守護程序中以完整 Node 權限執行,因此只應執行可信的腳本。儲存的狀態檔包含登入網站的 cookie 與 localStorage。點擊、輸入與注入 CSS 會改動即時頁面,被檢查的頁面也會從網路載入。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Cssprobe Cli,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

cssprobe-cli

Runtime CSS probe — inspect layout, scroll, colors, backgrounds, fonts and more in a live browser. Built for both humans and AI agents.

[License: MIT] [Node.js] [npm version] [npm downloads] [GitHub stars]

Static + runtime CSS diagnosis for AI agents — pair with cssgraph (the CSS knowledge graph) for the full picture.


Why cssprobe-cli?

When an AI agent needs to debug CSS — why is this element overflowing, what's the actual rendered layout, is this container scrollable — it can't see the browser. It guesses from static code, missing runtime-only issues like overflow, scroll chains, and containing block hijacks.

cssprobe-cli gives the agent eyes. It opens a real browser, collects computed styles and metrics via injected JavaScript, analyzes them with a confidence model, and returns structured findings — all in one command. The agent asks a question about any selector and gets back the DOM tree, ASCII layout diagram, overflow warnings, and scroll diagnosis without leaving the terminal.


Installation

For Humans

Copy and paste this prompt to your LLM agent (Claude Code, Cursor, Codex, etc.):

Install and configure cssprobe-cli by following the instructions here:https://raw.githubusercontent.com/mack-peng/cssprobe-cli/main/docs/guide/installation.md

Or read the Installation Guide, but seriously, let an agent do it. Humans fat-finger configs.

For LLM Agents

Fetch the installation guide and follow it:

bash
curl -s https://raw.githubusercontent.com/mack-peng/cssprobe-cli/main/docs/guide/installation.md

Or install directly:

bash
npm install -g cssprobe-clicssprobe-cli skill-install

How It Works

┌───────────────────────────────────────────────────────────┐│                      AI Agent                              ││                                                           ││  "Is .sidebar overflowing?"                               ││      calls: cssprobe-cli inspect .sidebar                 ││                             │                             │└─────────────────────────────┬─────────────────────────────┘                              │                              ▼┌───────────────────────────────────────────────────────────┐│                  cssprobe-cli daemon                       ││                                                           ││  collector (IIFE) → analyzer (pure) → renderer (md/json)  ││                             │                             ││                             ▼                             ││               Playwright browser (Chromium)                ││     getBoundingClientRect · getComputedStyle · DOM walk    │└───────────────────────────────────────────────────────────┘
  1. Session — open spawns a daemon process managing a browser. Commands connect via Unix socket.
  2. Collector — Injected as IIFE into the page. Walks the DOM, reads computed styles, declared values, and element metrics.
  3. Analyzer — Pure Node.js functions. Classifies findings with confidence levels (DEFINITE / INDEFINITE / UNVERIFIABLE).
  4. Renderer — Outputs Markdown (default) or JSON. Includes ASCII layout diagram, DOM tree, and findings.

Quick Start

1. Inspect a Page

bash
# Open browser (non-blocking, starts daemon session)cssprobe-cli open https://getbootstrap.com/docs/5.3/examples/checkout
# Inspect with CSS selectorcssprobe-cli inspect .container
# Show ASCII layout diagramcssprobe-cli layout .container
# Show only issues/warningscssprobe-cli findings .container
# Close browser when donecssprobe-cli close

2. Login-Protected Pages

bash
# Open browser in headed modecssprobe-cli open https://mysite.com --headed
# User manually logs in...
# Save session state for future usecssprobe-cli state-save --name mysite
# Reopen with saved state (no login needed)cssprobe-cli open https://mysite.com --state state.json --headed

3. JSON Output

bash
cssprobe-cli inspect body --jsoncssprobe-cli inspect body --json | jq '.findings[] | {id, confidence, message}'

4. Use as an MCP Server (AI clients)

cssprobe-cli ships an MCP server (stdio), so AI clients call it as a native tool — no shell needed:

bash
cssprobe-cli mcp-install          # auto-detect and configure installed clientscssprobe-cli mcp-install --target=claude,cursor,codexcssprobe-cli mcp-install --local  # write project-scoped config

Manual configuration for any MCP client:

json
{  "mcpServers": {    "cssprobe-cli": { "command": "cssprobe-cli", "args": ["mcp"] }  }}

Exposes 10 tools: cssprobe_open, cssprobe_inspect, cssprobe_tree, cssprobe_layout, cssprobe_findings, cssprobe_eval, cssprobe_screenshot, cssprobe_inject_css, cssprobe_close, cssprobe_status. Remove with cssprobe-cli mcp-uninstall.


Commands

Session Management

CommandDescription
open [url]Open browser in session mode (non-blocking)
open [url] --headedShow browser window
open [url] --state <file>Open with saved cookies + localStorage
open [url] --viewport 1280x720Custom viewport size
open [url] --expect-url <regex>Fail unless the final URL matches the pattern
open [url] --fail-on-loginFail fast when redirected to a login URL
closeClose browser session
close --allClose all sessions across all workspaces
statusShow session status (URL, title, frame count)
framesList frames: index, name, URL, main marker
doctorDiagnose browser install vs Playwright expected revision

CSS Inspection

CommandDescription
inspect <selector>Full CSS diagnosis (computed values, declared values, findings)
inspect <selector> --layoutInclude ASCII layout diagram
inspect <selector> --briefCompact: tree sketch + warnings/errors only
inspect <selector> --jsonStructured JSON output
tree <selector>DOM tree structure
layout <selector>ASCII layout diagram
findings <selector>Only issues/warnings/errors

Inspection commands accept --frame <index|name|url-substring> to target an iframe; the default is the main frame.

CSS Injection

CommandDescription
inject-css <css>Inject CSS into current page

Browser

CommandDescription
resize <width> <height>Resize browser viewport
eval <expression>Evaluate JavaScript (browser context); DOM nodes are auto-serialized; promises are awaited, undefined fields become null
eval @file / eval -Read the expression from a file or stdin
playwright <call>Execute Playwright API (Node.js context)
screenshotTake screenshot (saves to ~/.cssprobe-cli/screenshots/, --out to override)

Interaction

CommandDescription
click <selector>Real mouse click (auto-scroll + actionability wait; works with custom React components)
hover <selector>Real mouse hover
type <selector> <text>Fill text (replaces value); --press Enter to submit; --sequential for real key events
wait-for <selector>Wait for selector state (--state visible|hidden|attached|detached, --timeout ms)
wait-for --js "<predicate>"Wait until a JS predicate is truthy
wait-for --network-idleWait until the page is network-idle (page-level; no --frame)
wait-for ... --frame <spec>Wait inside an iframe (selector/js modes)
sample "<expr>"Sample an expression over time (--interval, --duration, --key, --frame); returns timeline + summary
wait-stable "<expr>"Wait until an expression stops changing (--tolerance, --window, --timeout)
run <file>Run a multi-step flow script

click / hover support --nth N (1-based, default first match), --force (skip actionability checks) and --timeout ms. Without --nth, multiple matches fail (strict) to prevent wrong-target clicks.

State

CommandDescription
state-import <file>Import cookies from Netscape format
state-saveSave current browser session state (cookies + localStorage)
state-checkValidate a state file: cookie count, expiry, target domain coverage (--state, --url)

Configuration

CommandDescription
config-showShow current config
config-set <key> <value>Set config value
config-listList all profiles
config-use <name>Switch active profile
config-new <name>Create new profile
config-pathShow config file path

Multi-step Flows

The interaction commands drive a page step by step; run turns a sequence into a versionable script:

bash
cssprobe-cli open https://example.com/editorcssprobe-cli wait-for .editor-canvascssprobe-cli click ".layout-switch" --nth 1cssprobe-cli type ".block-title input" "Hello" --press Entercssprobe-cli inspect .block-grid --jsoncssprobe-cli close

For repeatable flows, write a script and run it with one command. The script runs inside the daemon session (full Playwright page access):

js
// flow.jsexport default async ({ page, context, frames, newPage, click, waitFor, type, inspect, screenshot, expect, log }) => {  await page.goto('https://example.com/editor', { waitUntil: 'domcontentloaded' });  await waitFor('.editor-canvas', { state: 'visible', timeout: 10000 });
  await click('.layout-switch', { nth: 1 });  await waitFor({ js: "() => document.body.dataset.layout === 'two-col'" });
  await type('.block-title input', 'Hello', { press: 'Enter', sequential: true, clear: true });  await waitFor({ networkIdle: true });
  const { findings } = await inspect('.block-grid', { format: 'json' });  log('findings:', findings.length);  await screenshot({ path: './after-layout-switch.png' });
  return { findings: findings.length };};
bash
cssprobe-cli run ./flow.js        # --timeout ms for the whole script (default 300000, 0 = unlimited)

Scripts must default-export an async function receiving the API object: page, context, frames(), newPage(), click, hover, type, waitFor, inspect, screenshot, expect, log. waitFor accepts { state, timeout, frame }. Uncaught page errors are collected into the result envelope as pageErrors. screenshot relative paths resolve against the script's directory; logs (log() and console.*) are collected and returned with the result. On failure the command exits 1, prints the collected logs, and keeps the session alive.

Scripts are executed by the local daemon with full Node privileges — only run trusted scripts.


Scenario Suites (Regression)

Run repeatable regression cases from a JSON suite: each case opens a fresh browser, executes steps, asserts on saved values, and writes artifacts + an optional JUnit report.

bash
cssprobe-cli scenario run suites/ticket-26571394.json \  --state ~/.cssprobe-cli/states/preprod.json \  --artifacts out/ticket-26571394 \  --junit out/junit.xml
json
{  "name": "ticket 26571394 preprod",  "defaults": { "viewport": { "width": 1280, "height": 800 } },  "cases": [    {      "name": "refresh keeps the hash section aligned",      "url": "https://example.com/#listen-to-tcmi",      "steps": [        { "do": "sample", "expression": "({ hash: location.hash, top: Math.round(document.querySelector('#listen-to-tcmi')?.getBoundingClientRect().top ?? -1) })", "interval": 250, "duration": 12000, "key": "top", "tailFrom": 9500, "save": "timeline" },        { "do": "assert", "label": "hash retained", "on": "timeline", "path": "summary.last.value.hash", "eq": "#listen-to-tcmi" },        { "do": "assert", "label": "anchor stable", "on": "timeline", "path": "summary.tail.min", "min": 70 },        { "do": "assert", "label": "anchor stable", "on": "timeline", "path": "summary.tail.max", "max": 90 }      ]    },    {      "name": "deployment fingerprint",      "url": "https://example.com/",      "steps": [        { "do": "waitFor", "js": "() => !!window.DEBUG?.NavigatorStore", "timeout": 20000 },        { "do": "assert", "globals": { "DEBUG.NavigatorStore.setHashRestoreProtected": "function" }, "absent": ["DEBUG.NavigatorStore.navigateToSectionId"] }      ]    }  ]}

Steps: goto, reload, wait, eval, sample, waitStable, click, waitFor, screenshot, assert. wait takes a fixed ms; waitFor supports frame for in-iframe selector/js waits. sample and eval save values with save: "<name>"; assertions read them with on: "<name>" + path, or check live state (url, title, frames), url, globals, absent. sample supports key, tailFrom, ignoreErrors; every run writes summary.json, per-case case.json, sample series and failure screenshots.

Iframe and preview pages. A page can contain hidden helper iframes (about:blank); use frames to pick the real one, and state: "attached" when waiting for a frame element that is not visible. Preview frames can take 6–8s to render and analytics requests keep networkIdle busy — prefer a fixed wait step followed by a waitFor inside the frame (frame: "i/preview") instead of networkIdle.

Confidence Model

Every finding carries a confidence level:

LevelMeaning
DEFINITEBased on computed values (facts from getComputedStyle) or accessible declared values
INDEFINITEDeclared value uses % — resolves at runtime
UNVERIFIABLEDeclared value missing or from blocked cross-origin stylesheet

The report header shows: confidence: DEFINITE 8 | INDEFINITE 0 | UNVERIFIABLE 1


Complementary Tool: cssgraph

cssprobe-cli is a runtime CSS probe — it opens a real browser and reads what is actually rendered. For static questions about the source code — where is .btn-primary defined, what cascades over it, which components reference it, what would change if I edited it — use cssgraph, a local SQLite knowledge graph of every className, property, variable, and at-rule in your stylesheets. The two tools complement each other:

cssgraph (static)cssprobe-cli (runtime)
Analyzessource code (CSS/SCSS/Less + JSX/TSX + templates)live browser (computed styles + DOM)
Answerswhere a class is defined, cascade, impact, unused CSSactual rendered layout, overflow, scroll, height chains
Whenbefore/without a browserafter static analysis, to verify at runtime
Usagecssgraph init + explore/rule/impactopen + inspect/layout/findings

Recommended workflow for a style problem — go static first, then verify at runtime:

bash
# 1. Static: find the definitions, cascade, and blast radius (cssgraph)cssgraph explore .btn-primarycssgraph cascade .btn-primary
# 2. Runtime: confirm what actually renders (cssprobe-cli)cssprobe-cli open https://example.comcssprobe-cli inspect .btn-primarycssprobe-cli findings .btn-primary

Install: npm install -g cssgraph (requires Node.js >= 22.5.0). It exposes 12 MCP tools (cssgraph_explore, cssgraph_rule, cssgraph_impact, …) plus CLI commands. See npm / GitHub.


Configuration

bash
# Set valuescssprobe-cli config-set browser chromiumcssprobe-cli config-set depth 8cssprobe-cli config-set viewport 375x812
# Profile managementcssprobe-cli config-new stagingcssprobe-cli -p staging config-set browser firefoxcssprobe-cli config-use staging

Priority: CLI flags > Environment variables > Config file

--browser       CSSPROBE_BROWSER--depth         CSSPROBE_DEPTH--headed        CSSPROBE_HEADED--viewport      CSSPROBE_VIEWPORT-p, --profile   CSSPROBE_PROFILE

Config file: ~/.cssprobe-clirc


Supported Platforms

PlatformArchitectures
macOSx64, arm64
Linuxx64, arm64
Windowsx64, arm64

Development

bash
npm installnpm run build       # tsc + esbuild collector + daemon entry + generate help.jsonnpm test            # Run unit tests (58 tests)npx tsc --noEmit    # Type check only

If cssprobe-cli is useful

A ⭐ star helps other developers discover it — and tells us to keep shipping.


License

MIT

來源:README.md,提交 80057ad

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分