mini-browser by runablehq/mini-browser
npx skills add https://github.com/runablehq/mini-browser --skill mini-browsermb 是一个浏览器命令行工具,其中每个命令都是一个精简的 Unix 工具。它通过 puppeteer-core 经由 CDP(端口 9222)与 Chrome 通信。
仅当 mb 未安装或 Chrome 无法连接时才需要设置。请先运行以下检查——如果两者都通过,请直接跳转到命令参考部分。
# 1. mb 是否已安装?
which mb && echo "mb: ok" || echo "mb: MISSING"
# 2. Chrome 是否正在监听 CDP?
curl -sf http://127.0.0.1:9222/json/version > /dev/null && echo "chrome: ok" || echo "chrome: NOT RUNNING"
如果两者都打印 "ok",则一切就绪——可以直接使用 mb 命令。
mb 缺失时)npm install -g @runablehq/mini-browser
mb-start-chrome
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
这会以 --remote-debugging-port=9222 参数启动 Chrome,使用全新配置文件,并打开一个 1024×768 的窗口。如果 Chrome 已在运行,则此命令无操作。
如需终止并重新启动:
mb-restart-chrome
mb go "https://example.com" && mb text
| 变量 | 默认值 | 描述 |
|---|---|---|
CHROME_PORT | 9222 | CDP 端口 |
CHROME_BIN | 自动检测 | Chrome/Chromium 二进制文件路径 |
CHROME_PID_FILE | <scripts>/.chrome-pid | PID 文件位置 |
CHROME_USER_DATA_DIR | <scripts>/.chrome-profile | Chrome 配置文件目录 |
| 命令 | 描述 |
|---|---|
mb go <url> | 导航到 URL(等待网络空闲) |
mb url | 打印当前 URL |
mb back | 后退 |
mb forward | 前进 |
| 命令 | 描述 |
|---|---|
mb text [selector] | 可见文本内容(默认:body) |
mb shot [file] | 截图保存为 PNG(默认:./shot.png) |
mb snap | 列出带坐标的交互式元素 |
| 命令 | 描述 |
|---|---|
mb click <x> <y> | 在坐标处点击 |
mb type [x y] <text> | 输入文本(带坐标时:先选中) |
mb fill <k=v...> | 通过标签/名称/占位符填充表单字段 |
mb key <key...> | 按键(Enter, Tab, Meta+a) |
mb move <x> <y> | 在坐标处悬停 |
mb drag <x1> <y1> <x2> <y2> | 在两点间拖拽 |
mb scroll [dir] [px] | 滚动(默认:向下 500) |
| 命令 | 描述 |
|---|---|
mb record start <file> | 开始录制(.webm, .mp4, .gif) |
mb record stop | 停止录制并保存 |
mb record status | 检查录制是否处于活动状态 |
| 命令 | 描述 |
|---|---|
mb tab list | 列出打开的标签页 |
mb tab new [url] | 打开新标签页,打印索引 |
mb tab close [n] | 关闭标签页(默认:最后一个) |
| 命令 | 描述 |
|---|---|
mb js <code> | 在页面上下文中运行 JavaScript |
mb wait <target> | 等待毫秒数 / 选择器 / networkidle / url:pattern |
mb audit | 设计审查(调色板、排版、对比度、无障碍、SEO) |
mb logs | 流式传输控制台日志(Ctrl+C 停止) |
| 标志 | 默认值 | 描述 |
|---|---|---|
--timeout <ms> | 30000 | 命令超时时间 |
--tab <n> | 0 | 目标标签页索引 |
--json | false | 结构化 JSON 输出 |
--right | false | 右键点击 |
--double | false | 双击 |
--fps <n> | 30 | 录制帧率 |
--scale <n> | 1 | 录制缩放因子 |
标准的智能体循环:对页面进行快照,选择一个元素,对其执行操作。
mb snap # 列出带 (x, y) 坐标的交互式元素
mb click 512 380 # 点击该坐标处的按钮
mb wait networkidle # 等待页面稳定
mb snap # 再次观察
mb go "https://example.com/login"
mb fill "Email=user@example.com" "Password=hunter2"
mb key Enter
mb wait url:/dashboard
mb shot page.png
mb text "main" # 来自 <main> 的文本
mb text "#content" # 来自 #content 的文本
mb text # 完整的 body 文本
mb js 'document.title'
echo 'document.querySelectorAll("a").length' | mb js -
mb record start demo.mp4 --fps 30 --scale 1
# ... 与页面交互 ...
mb record stop
mb audit # 人类可读的报告
mb audit --json # 结构化 JSON 输出
Cookie 横幅和模态框会阻止点击。使用 JS 移除它们:
mb js 'document.querySelector("[class*=cookie]")?.remove()'
mb wait 2000 # 休眠 2 秒
mb wait ".modal" # 等待选择器出现
mb wait networkidle # 等待无网络活动
mb wait url:/dashboard # 等待 URL 包含字符串
snap 仅返回当前视口中的元素——滚动并再次使用 snap 以查找更多元素。text 使用 querySelector —— 仅返回第一个匹配项。使用 text "main" 而非 text "p" 以获得更好的结果。go 会等待 networkidle。 对于大型单页应用,请随后使用 wait ".selector"。type 会先三连击 以选中现有文本,然后输入替换文本。fill 字段匹配顺序: aria-label → placeholder → name 属性 → id → 标签文本 → CSS 选择器(使用 #/./[ 前缀)。--json 输出: snap → [{role, name, x, y, state}], tab list → [{index, url, title}], logs → JSON 行, audit → 完整的审查对象。~/.mb-recorder.json 中。一次只能进行一个录制。tab close 无法关闭最后一个剩余的标签页。| 问题 | 解决方法 |
|---|---|
| "Chrome not found" | 设置 CHROME_BIN=/path/to/chrome |
| Connection refused | 先运行 mb-start-chrome |
| Stale recording state | 删除 ~/.mb-recorder.json |
| Chrome 窗口大小错误 | mb-restart-chrome(创建全新配置文件) |
| Element not in snap output | mb scroll down 500 然后再次 mb snap |
每周安装量
2.3K
仓库
GitHub 星标数
20
首次出现
6 天前
安全审计
安装于
claude-code1.2K
codex881
opencode671
cursor568
cline296
windsurf260
mb is a browser CLI where each command is a small Unix tool. It talks to Chrome over CDP (port 9222) via puppeteer-core.
Setup is only needed when mb is not installed or Chrome is not reachable. Run these checks first — if both pass, skip straight to the Command Reference.
# 1. Is mb installed?
which mb && echo "mb: ok" || echo "mb: MISSING"
# 2. Is Chrome listening on CDP?
curl -sf http://127.0.0.1:9222/json/version > /dev/null && echo "chrome: ok" || echo "chrome: NOT RUNNING"
If both print "ok", everything is ready — go use mb commands directly.
mb is missing)npm install -g @runablehq/mini-browser
mb-start-chrome
This launches Chrome with --remote-debugging-port=9222, a fresh profile, and a 1024×768 window. It no-ops if Chrome is already running.
To kill and relaunch:
mb-restart-chrome
mb go "https://example.com" && mb text
| Variable | Default | Description |
|---|---|---|
CHROME_PORT | 9222 | CDP port |
CHROME_BIN | auto-detected | Path to Chrome/Chromium binary |
CHROME_PID_FILE | <scripts>/.chrome-pid | PID file location |
CHROME_USER_DATA_DIR | <scripts>/.chrome-profile |
| Command | Description |
|---|---|
mb go <url> | Navigate to URL (waits for networkidle) |
mb url | Print current URL |
mb back | Go back |
mb forward | Go forward |
| Command | Description |
|---|---|
mb text [selector] | Visible text content (default: body) |
mb shot [file] | Screenshot to PNG (default: ./shot.png) |
mb snap | List interactive elements with coordinates |
| Command | Description |
|---|---|
mb click <x> <y> | Click at coordinates |
mb type [x y] <text> | Type text (with coords: selects first) |
mb fill <k=v...> | Fill form fields by label/name/placeholder |
mb key <key...> | Press keys (Enter, Tab, Meta+a) |
mb move <x> <y> | Hover at coordinates |
mb drag <x1> <y1> <x2> <y2> |
| Command | Description |
|---|---|
mb record start <file> | Start recording (.webm, .mp4, .gif) |
mb record stop | Stop recording and save |
mb record status | Check if recording is active |
| Command | Description |
|---|---|
mb tab list | List open tabs |
mb tab new [url] | Open new tab, print index |
mb tab close [n] | Close tab (default: last) |
| Command | Description |
|---|---|
mb js <code> | Run JavaScript in page context |
mb wait <target> | Wait for ms / selector / networkidle / url:pattern |
mb audit | Design audit (palette, typography, contrast, a11y, SEO) |
mb logs | Stream console logs (Ctrl+C to stop) |
| Flag | Default | Description |
|---|---|---|
--timeout <ms> | 30000 | Command timeout |
--tab <n> | 0 | Target tab index |
--json | false | Structured JSON output |
--right | false | Right-click |
--double | false | Double-click |
The standard agent loop: snapshot the page, pick an element, act on it.
mb snap # list interactive elements with (x, y)
mb click 512 380 # click the button at those coordinates
mb wait networkidle # wait for the page to settle
mb snap # observe again
mb go "https://example.com/login"
mb fill "Email=user@example.com" "Password=hunter2"
mb key Enter
mb wait url:/dashboard
mb shot page.png
mb text "main" # text from <main>
mb text "#content" # text from #content
mb text # full body text
mb js 'document.title'
echo 'document.querySelectorAll("a").length' | mb js -
mb record start demo.mp4 --fps 30 --scale 1
# ... interact with the page ...
mb record stop
mb audit # human-readable report
mb audit --json # structured JSON output
Cookie banners and modals block clicks. Remove them with JS:
mb js 'document.querySelector("[class*=cookie]")?.remove()'
mb wait 2000 # sleep 2 seconds
mb wait ".modal" # wait for selector to appear
mb wait networkidle # wait for no network activity
mb wait url:/dashboard # wait for URL to contain string
snap only returns elements in the current viewport — scroll and snap again to find more.text uses querySelector — returns first match only. Use text "main" over text "p" for better results.go waits for networkidle. For heavy SPAs, follow up with wait ".selector".type with coordinates triple-clicks first to select existing text, then types the replacement.fill field matching order: aria-label → placeholder → name attr → id → label text → CSS selector (use #// prefix).| Problem | Fix |
|---|---|
| "Chrome not found" | Set CHROME_BIN=/path/to/chrome |
| Connection refused | Run mb-start-chrome first |
| Stale recording state | Delete ~/.mb-recorder.json |
| Chrome window wrong size | mb-restart-chrome (creates fresh profile) |
| Element not in snap output | mb scroll down 500 then mb snap again |
Weekly Installs
2.3K
Repository
GitHub Stars
20
First Seen
6 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
claude-code1.2K
codex881
opencode671
cursor568
cline296
windsurf260
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
| Chrome profile directory |
| Drag between points |
mb scroll [dir] [px] | Scroll (default: down 500) |
--fps <n> | 30 | Recording frame rate |
--scale <n> | 1 | Recording scale factor |
.[--json output: snap → [{role, name, x, y, state}], tab list → [{index, url, title}], logs → JSON lines, audit → full audit object.~/.mb-recorder.json. Only one recording at a time.tab close cannot close the last remaining tab.