Agent skill

Webmcp CLI Cdp

by opentiny in opentiny/webmcp-sdk

面向第三方 AI Agent 的 CDP 直连模式执行指南:通过 Chrome DevTools Protocol 独立沙箱操作浏览器,自动注入 page-agent-tool 及领域工具。

MITAuto-check passedTesting & QA

Install Webmcp CLI Cdp

skills CLI
$ npx skills add opentiny/webmcp-sdk --skill webmcp-cli-cdp -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install opentiny/webmcp-sdk webmcp-cli-cdp --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/opentiny/webmcp-sdk.git skills-src && mkdir -p .claude/skills && cp -r skills-src/packages/webmcp-cli-skill/cdp .claude/skills/webmcp-cli-cdp && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
webmcp-cli-cdp
GitHub stars
121
Token cost
~1.5k tokens
SKILL.md length
223 words
Files
8
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

面向第三方 AI Agent 的 CDP 直连模式执行指南:通过 Chrome DevTools Protocol 独立沙箱操作浏览器,自动注入 page-agent-tool 及领域工具。

  • Works in 7 steps: 管理浏览器标签页 webmcp-cli tabs → 查询浏览器当前状态 webmcp-cli state → 系统剪贴板操作 webmcp-cli clipboard(CDP 专属) → …
  • Tasks that involve Browser testing
  • SKILL.md covers 适用场景与特征, 安装, 命令集与规范 and 页面状态获取与决策流(核心规范), plus 3 more sections
  • Calls npm; reaches baidu.com and excalidraw.com

What it does

Webmcp CLI Cdp is an agent skill from opentiny/webmcp-sdk. 面向第三方 AI Agent 的 CDP 直连模式执行指南:通过 Chrome DevTools Protocol 独立沙箱操作浏览器,自动注入 page-agent-tool 及领域工具。

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files (for example `domains/excalidraw.md`, `domains/publish-article-in-csdn.md` and `domains/publish-article-in-juejin.md`).

It sits in Testing & QA, covering Browser testing. It works with Chrome DevTools. The repository describes itself as: OpenTiny NEXT-SDKs is a front-end AI and browser automation toolkit. It implements WebMCP + WebSkills to build AI-native apps, and leverages webmcp-cli to enable LLM agents to…. The licence is MIT.

When your agent uses it

  • Tasks that involve Browser testing

Example prompts

  • “/webmcp-cli-cdp”

Requirements

  • Node.js

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. 管理浏览器标签页 webmcp-cli tabs
  2. 查询浏览器当前状态 webmcp-cli state
  3. 系统剪贴板操作 webmcp-cli clipboard(CDP 专属)
  4. 页面元素感知与操作 webmcp-cli run
  5. searchTree 优先原则(节省 80%+ Token)
  6. 获取无障碍树 browserState
  7. 具体交互操作

What it can do on your machine

Read from SKILL.md and the folder at commit 47a2b03. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • baidu.com
    • excalidraw.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Webmcp CLI Cdp loads about 1.5k tokens when it runs. Until then it costs about 28 tokens; SKILL.md has 223 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~28
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from opentiny/webmcp-sdk at commit 47a2b03, republished under its MIT licence (© opentiny). 223 words, ~1,465 tokens.

Download SKILL.mdSave it as .claude/skills/webmcp-cli-cdp/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
webmcp-cli-cdp
description
面向第三方 AI Agent 的 CDP 直连模式执行指南:通过 Chrome DevTools Protocol 独立沙箱操作浏览器,自动注入 page-agent-tool 及领域工具。
license
MIT
metadata.author
opentiny
metadata.version
2.0.0

WebMCP CLI (CDP 直连模式) Skill

本 Skill 指导 AI Agent 如何通过 @opentiny/webmcp-cli 的 CDP 模式(Chrome DevTools Protocol 直连)操控浏览器。

适用场景与特征

  • 独立沙箱:自动在后台启动独立的 Chrome 实例(默认配置位于 ~/.webmcp_chrome_profile),无需预先开启用户浏览器。
  • 自动化与 CI 优先:适合可重复的回归测试、批量网页内容提取、自动化脚本任务。
  • 环境自动注入:自动向目标网页注入 webmcp-polyfill 与内置的 page-agent-tool。
  • 标识特征:
    • 命令直接调用 webmcp-cli <command>(默认即 CDP 模式,无需额外参数);
    • Tab ID 格式为 32 位 UUID 字符串(Chrome Target ID);
    • 支持 CDP 专属的系统剪贴板操作(clipboard)。
    • 不复用用户真实浏览器的登录态与 Cookie。

安装

当 shell 终端提示找不到工具时执行:

bash
npm install -g @opentiny/webmcp-cli

命令集与规范

1. 管理浏览器标签页 webmcp-cli tabs
bash
webmcp-cli tabs open https://excalidraw.com    # 打开新网页,返回目标 tabid (UUID)
webmcp-cli tabs switch <tabid>                 # 切换到指定标签页
webmcp-cli tabs close <tabid>                  # 关闭指定标签页
webmcp-cli tabs back                           # 当前标签页后退
webmcp-cli tabs back <tabid>                   # 指定标签页后退
webmcp-cli tabs forward                        # 当前标签页前进
webmcp-cli tabs forward <tabid>                # 指定标签页前进
2. 查询浏览器当前状态 webmcp-cli state

返回当前活跃页签的导航元数据(URL、标题、所有打开页签、当前已注入的 webmcpTools 清单)。

bash
webmcp-cli state
webmcp-cli state -t <tabid>   # 指定某个标签页(UUID 字符串)

输出示例:

json
{
  "url": "https://www.baidu.com/",
  "title": "百度一下,你就知道",
  "webmcpTools": [{ "name": "page-agent-tool" }, { "name": "baidu_search" }],
  "tabs": [
    { "tabid": "2EA73ED323E46E5E108D4E46DA4E4AA7", "title": "百度一下,你就知道", "url": "https://www.baidu.com/" }
  ]
}

注意:state 不返回页面的可交互元素(DOM 树)。获取元素必须使用 page-agent-tool 的 browserState 或 searchTree。


3. 系统剪贴板操作 webmcp-cli clipboard(CDP 专属)
bash
webmcp-cli clipboard                      # 读取当前系统剪贴板文本
webmcp-cli clipboard "需要写入剪贴板的内容"   # 写入文本到系统剪贴板

4. 页面元素感知与操作 webmcp-cli run
4.1 终端 JSON 参数转义规则

根据不同终端严格遵守引号规范,避免 参数不是有效的 JSON 错误:

  • bash / zsh 终端:使用单引号包裹 JSON:'{"action": "click", "index": 0}'
  • cmd 终端:双引号包裹,内部双引号转义:"{\"action\": \"click\", \"index\": 0}"
  • PowerShell 终端:单引号包裹,内部双引号反斜杠转义:'{\"action\": \"click\", \"index\": 0}'
4.2 内置核心工具 page-agent-tool

每个页面均会自动注入该工具。支持动作(action): browserState、searchTree、click、fill、select、scroll、executeJavascript、hover。

操作返回格式(responseMode):

  • diff(默认):仅返回操作后页面的增量差异,极度节省 Token。
  • full:返回当前视口完整的 ARIA YAML 无障碍树。
  • both:同时返回全量树与增量差异。

执行 click、fill、select、scroll 等操作后,工具会自动返回最新页面 diff,通常无需再次手动调用 browserState。


页面状态获取与决策流(核心规范)

1. searchTree 优先原则(节省 80%+ Token)

决策流程:

已知要找的元素类型或文字(如“搜索”、“登录”、“button”)?
    ↓ 是
    → 先用 searchTree 搜索
        ↓ 找到了?
            是 → 直接使用命中的 #N 索引操作(click / fill 等)
            否 → 再用 browserState(full) 获取全量树兜底
    ↓ 否(初次进入未知页面或探索全局结构)
    → 用 browserState(full) 抓取完整树

用法示例:

bash
# 按角色或文字精准搜索
webmcp-cli run page-agent-tool '{"action": "searchTree", "query": "登录"}'
webmcp-cli run page-agent-tool '{"action": "searchTree", "query": "button", "contextLines": 2}'
webmcp-cli run page-agent-tool '{"action": "searchTree", "query": "#42"}'

输出命中行会带 >>> 标记,并给出目标元素的 #N 索引编号。

2. 获取无障碍树 browserState
bash
# 首次进入页面获取完整树
webmcp-cli run page-agent-tool '{"action": "browserState", "responseMode": "full"}'

# 对指定标签页获取
webmcp-cli run page-agent-tool '{"action": "browserState"}' -t 2EA73ED323E46E5E108D4E46DA4E4AA7

无障碍树格式: - role #N [token1] [token2] "accessible name"

  • role:ARIA 语义(button / link / textbox / radio 等);
  • #N:唯一操作索引,仅带 #N 的元素才能交互,将其数值传入 index;
  • [token]:状态标记([checked]、[disabled]、[cursor=pointer] 等);
  • "accessible name":元素可访问名。

⚠️ 每次交互操作后,#N 会重新分配,严禁复用历史旧索引。

3. 具体交互操作
bash
# 点击
webmcp-cli run page-agent-tool '{"action": "click", "index": 16}'

# 填写输入框
webmcp-cli run page-agent-tool '{"action": "fill", "index": 15, "text": "OpenTiny"}'

# 下拉选择
webmcp-cli run page-agent-tool '{"action": "select", "index": 7, "value": "option_value"}'

# 页面滚动(0.5 = 半页,1.0 = 一页)
webmcp-cli run page-agent-tool '{"action": "scroll", "direction": "down", "amount": 500}'

# 执行 JavaScript
webmcp-cli run page-agent-tool '{"action": "executeJavascript", "script": "return document.title"}'

操作约束与安全边界

  1. 仅与带 #N 的元素交互,绝对不要臆测不存在或已过期的索引。
  2. 优先分析 Diff:点击或填写后,优先阅读自动返回的 Diff 增量确认操作成效。
  3. 不要重复相同失败动作超过 3 次。
  4. 验证码阻塞:若遇到验证码,应主动告知用户手动处理,切勿盲目循环尝试。
  5. 不要在无凭据情况下尝试登录;如需用户真实登录态,应提示用户切换为 WXT 模式。

领域专用工具(domains/)

当导航到特定站点时,页面会自动注册专用工具(可通过 state 确认),进入相关页面请查阅对应指引:

目标域名注册工具业务指引文档
excalidraw.comexcalidraw_execute_commanddomains/excalidraw.md
juejin.cncreate_article, publish_current_draftdomains/publish-article-in-juejin.md
editor.csdn.netcreate_article, publish_current_draftdomains/publish-article-in-csdn.md
my.oschina.netcreate_article, publish_current_draftdomains/publish-article-in-oschina.md
segmentfault.comcreate_article, segmentfault_publish_articledomains/publish-article-in-segmentfault.md
xiaohongshu.comxhs_search_notes, xhs_publish_note查看工具 Schema 直接调用

调用示例:

bash
# Excalidraw 画布操作
webmcp-cli run excalidraw_execute_command '{"eventName": "getSceneElements"}'

# 掘金发布文章(支持 @base64file 文件引用)
webmcp-cli run create_article '{"title": "技术文章", "content": "@base64file:./post.md"}'

启动为标准 MCP 服务

bash
# 启动 MCP Server(stdio 传输,暴露原子工具)
webmcp-cli mcp

© opentiny, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files in packages/webmcp-cli-skill/cdp of opentiny/webmcp-sdk.

  • SKILL.md
  • domains/excalidraw.md
  • domains/publish-article-in-csdn.md
  • domains/publish-article-in-juejin.md
  • domains/publish-article-in-oschina.md
  • domains/publish-article-in-segmentfault.md
  • domains/publish-article-in-zhihu.md
  • domains/publish-article.md

Open the folder on GitHubat commit 47a2b03

Compare with similar skills

Webmcp CLI Cdp next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Webmcp CLI Cdp compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Webmcp CLI Cdp this skillopentiny/webmcp-sdk121—~1.5kAutomated safety check: PassMIT
Browser Testing with Chrome DevToolsaddyosmani/agent-skills103k4 repos~3.5kAutomated safety check: WarnMIT
Browsingobra/superpowers-chrome3561 repos~8kAutomated safety check: PassMIT
Chrome Devtools Axilayer5io/sistent1382 repos~989Automated safety check: PassApache-2.0
Idleon Live CdpMrJoiny/Idleon-Injector112—~1.2kAutomated safety check: PassNone
Web Browsermitsuhiko/agent-stuff3.2k—~1.5kAutomated safety check: WarnApache-2.0

Similar skills

  • Connects an agent to a real Chrome instance through the Chrome DevTools MCP server, so it can inspect the DOM, read console errors and profile performance directly.

    103k GitHub starsUsed in 4 repos~3.5k tokens
    Testing & QAAuto-check: warnings
  • Browsing

    obra/superpowers-chrome

    A skill your agent uses when you need direct browser control - teaches Chrome DevTools Protocol for controlling existing browser sessions, multi-tab management, form automation, and content…

    356 GitHub starsUsed in 1 repo~8k tokens
    Testing & QAAuto-check passed
  • Chrome Devtools Axi

    layer5io/sistent

    Control a Chrome browser session through the chrome-devtools-axi CLI - navigate, snapshot, click, fill forms, run JavaScript, inspect console and network, take screenshots, audit performance.

    138 GitHub starsUsed in 2 repos~989 tokens
    Testing & QAAuto-check passed
  • Idleon Live Cdp

    MrJoiny/Idleon-Injector

    Inspect and interact with a running Legends of Idleon session through the Chrome DevTools Protocol on port 32123.

    112 GitHub stars~1.2k tokensUpdated 4 days ago
    Testing & QAAuto-check passed
  • Web Browser

    mitsuhiko/agent-stuff

    Automate and interact with web pages through Chrome or Chromium using the Chrome DevTools Protocol (CDP): navigate, click, fill forms, inspect content, take screenshots, and debug console or network…

    3.2k GitHub stars~1.5k tokensUpdated 11 days ago
    Testing & QAAuto-check: warnings
  • Chrome Cdp

    MatrixAges/polywise

    Interacts with local browser via Chrome DevTools Protocol (only triggered after user explicitly requests to inspect, debug, or interact with pages open in Chrome)

    662 GitHub stars~800 tokensUpdated 3 mo ago
    Testing & QAAuto-check passed

More from opentiny/webmcp-sdk

  • Next SDK Page Agent

    opentiny/webmcp-sdk

    @opentiny/next-sdk 的 page-agent-tool / a11y / registerPageAgentTool 相关开发。

    121 GitHub stars~815 tokensUpdated 17 days ago
    Auto-check passed
  • Webmcp CLI Wxt

    opentiny/webmcp-sdk

    面向第三方 AI Agent 的 WXT 扩展桥接模式执行指南:通过 Tiny Robot 扩展 WebSocket 桥接操控用户真实浏览器,复用登录态/Cookie,支持双向本地 Bash 协同与高层自主 Agent 委托。

    121 GitHub stars~1.1k tokensUpdated 17 days ago
    Auto-check passed
  • Drawer Expert

    opentiny/webmcp-sdk

    擅长绘制各种图表、流程图、架构图等,能够提供专业的设计建议和方案

    121 GitHub stars~2.2k tokensUpdated 17 days ago
    Auto-check passed
  • Month Report Expert

    opentiny/webmcp-sdk

    擅长通过工具调用帮助用户生成月报。

    121 GitHub stars~122 tokensUpdated 17 days ago
    Auto-check passed

Works with

Categories

Questions about Webmcp CLI Cdp

What does Webmcp CLI Cdp do?

面向第三方 AI Agent 的 CDP 直连模式执行指南:通过 Chrome DevTools Protocol 独立沙箱操作浏览器,自动注入 page-agent-tool 及领域工具。. Webmcp CLI Cdp is an agent skill from opentiny/webmcp-sdk.

When should I use Webmcp CLI Cdp?

Webmcp CLI Cdp fits situations like: tasks that involve Browser testing.

How do I install Webmcp CLI Cdp in Claude Code?

Run `npx skills add opentiny/webmcp-sdk --skill webmcp-cli-cdp -a claude-code`. Or copy the skill folder (packages/webmcp-cli-skill/cdp in opentiny/webmcp-sdk) into .claude/skills/webmcp-cli-cdp in your project. Claude Code loads it when a task matches its description.

How do I install Webmcp CLI Cdp in Codex?

Run `npx skills add opentiny/webmcp-sdk --skill webmcp-cli-cdp -a codex`. Or copy the skill folder (packages/webmcp-cli-skill/cdp in opentiny/webmcp-sdk) into .agents/skills/webmcp-cli-cdp in your project. Codex loads it when a task matches its description.

Can I use Webmcp CLI Cdp in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add opentiny/webmcp-sdk --skill webmcp-cli-cdp -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/webmcp-cli-cdp, .gemini/skills/webmcp-cli-cdp, .github/skills/webmcp-cli-cdp and .opencode/skills/webmcp-cli-cdp in your project.

What does Webmcp CLI Cdp need to run?

Going by SKILL.md and its folder, Webmcp CLI Cdp needs the command-line tools its instructions call (npm). Our summary lists: Node.js.

Does Webmcp CLI Cdp access the network?

SKILL.md names 2 domains. In commands or code: baidu.com and excalidraw.com; the agent is likely to contact these when it follows the instructions. This is read from the text; nothing was executed.

Is Webmcp CLI Cdp safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Webmcp CLI Cdp use?

Webmcp CLI Cdp is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Webmcp CLI Cdp use?

About 1.5k tokens (SKILL.md is roughly 5.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Webmcp CLI Cdp?

Skills that share tags, products or a category with Webmcp CLI Cdp: Browser Testing with Chrome DevTools (addyosmani/agent-skills, 103k stars), Browsing (obra/superpowers-chrome, 356 stars), Chrome Devtools Axi (layer5io/sistent, 138 stars) and Idleon Live Cdp (MrJoiny/Idleon-Injector, 112 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Webmcp CLI Cdp?

opentiny (a GitHub organization) maintains it in opentiny/webmcp-sdk, which has 121 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on September 21, 2026.

Source: opentiny/webmcp-sdk on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.