webmcp-gen — скилл для Claude Code: WebMCP-инструменты для сайта
Пишет манифест WebMCP-инструментов для конкретного сайта, компилирует его в init-скрипт и проверяет, что Chrome регистрирует и вызывает инструменты.
npx skills add browserbase/skills --skill webmcp-gen -a claude-codeЧто делает webmcp-gen
Скилл ведёт вас по шагам: выбрать слаг вида <domain>/<task>, создать заготовку артефакта, изучить страницу через CLI browse, описать инструменты в manifest.json, скомпилировать в webmcp.init.js и прогнать валидацию. Вложенного агента внутри нет — страницу исследуете и манифест правите вы сами, скилл даёт скрипты и правила.
Внутри — scripts/scaffold.mjs, scripts/compile.mjs, scripts/generate-stagehand-example.mjs и scripts/validate.mjs. Сгенерированный stagehand-example.ts запускается через tsx. Код инструмента выполняется в самой странице, поэтому в implementation.source доступны только браузерные API: document, location, navigator и fetch того же origin. Playwright, Puppeteer и Stagehand там не работают — это повод проверить реализацию до компиляции.
Для работы нужны Node 18+, Chrome или Chromium с флагами тестирования WebMCP и установленный browse (npm install -g browse). Зависимости ставятся командой pnpm install в каталоге скилла. В манифест нельзя класть ключи API, токены, cookies и данные учётных записей, а eval и new Function запрещены. Если валидация падает, смотрите eval.json и eval-report.md, правьте манифест и повторяйте компиляцию.
Какие задачи решает
- описать WebMCP-инструменты для конкретного сайта в манифесте
- собрать
webmcp.init.jsиз манифеста - проверить, что Chrome регистрирует инструменты и вызывает их
- получить рабочий пример на Stagehand для запуска через
tsx - разобрать причины провала валидации по
eval-report.md
Примеры запросов агенту
- сгенерируй WebMCP-инструмент для example.com, который возвращает заголовок и URL страницы
- создай артефакт example.com/page-context и скомпилируй его в webmcp.init.js
- прогони валидацию артефакта и покажи, что упало в eval-report.md
Как установить webmcp-gen
1Через Skills CLI (Vercel)
npx skills add browserbase/skills --skill webmcp-gen -a claude-code2Вручную: положить файлы
~/.claude/skills/webmcp-gen/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/webmcp-gen/
1Через Skills CLI (Vercel)
npx skills add browserbase/skills --skill webmcp-gen -a codex2Вручную: положить файлы
.agents/skills/webmcp-gen/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add browserbase/skills --skill webmcp-gen -a cursor2Вручную: положить файлы
.cursor/skills/webmcp-gen/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install browserbase/skills webmcp-gen2Вручную: положить файлы
.github/skills/webmcp-gen/SKILL.md1Через Skills CLI (Vercel)
npx skills add browserbase/skills --skill webmcp-gen -a gemini-cli2Командой платформы
gemini skills install https://github.com/browserbase/skills --path skills/webmcp-genВручную: положить файлы
.devin/skills/webmcp-gen/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add browserbase/skills --skill webmcp-gen -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Из того же набора16
Похожие
Рядом в теме «Настройка агента: память, контекст, субагенты»
Все скиллы по теме «Настройка агента: память, контекст, субагенты» →Вопросы о webmcp-gen
Как установить webmcp-gen в Claude?
Выполните npx skills add browserbase/skills --skill webmcp-gen -a claude-code. После этого скилл лежит в ~/.claude/skills/webmcp-gen/SKILL.md.
Что делает webmcp-gen?
Помогает описать WebMCP-инструменты для сайта в manifest.json, скомпилировать их в webmcp.init.js и проверить регистрацию и вызов инструментов в Chrome.
Что нужно для работы скилла?
Node 18+, Chrome или Chromium с флагами тестирования WebMCP и CLI browse, который ставится через npm install -g browse. Зависимости скилла — pnpm install в его каталоге.
Исходный текст
SKILL.md · MIT
---
name: webmcp-gen
description: Create, compile, and validate site-specific WebMCP init scripts from a target URL and desired tool capability. Use when the user wants to author WebMCP tools for a website, produce a webmcp.init.js artifact, or test WebMCP registration and invocation through Stagehand.
compatibility: "Requires Node 18+ and Chrome/Chromium with WebMCP testing flags. Run `pnpm install` in the skill directory to install the Stagehand dependency. Page exploration uses the browse CLI (`npm install -g browse`)."
license: MIT
allowed-tools: Bash Read Grep Edit Write
---
# WebMCP Gen
Author website-specific WebMCP tools by writing a manifest, compiling it to an init script, and validating that Chrome registers and invokes the tools.
This skill does not call a nested agent. You are responsible for exploring the page, writing `manifest.json`, and iterating based on validation output.
## Setup check
From the skill directory, install dependencies if they are not already installed:
```bash
cd skills/webmcp-gen
pnpm install
```
This installs the pinned Stagehand package plus the TypeScript toolchain (`tsx`,
`typescript`, `@types/node`) used to run the generated `stagehand-example.ts`.
## Workflow
1. Pick an artifact slug with exactly one slash:
```text
<domain>/<task>
```
Example:
```text
example.com/page-context
```
2. Scaffold the artifact:
```bash
node scripts/scaffold.mjs example.com/page-context --url https://example.com
```
3. Explore the target page with the `browse` CLI:
```bash
browse open https://example.com --local
browse snapshot
browse get title
browse get url
browse get text body
browse get html body
```
Prefer `browse snapshot`, page text, and DOM inspection over screenshots unless visual layout matters. Use `browse stop` when exploration is complete.
4. Edit `artifacts/<domain>/<task>/manifest.json`. The manifest is the source of truth.
5. Compile:
```bash
node scripts/compile.mjs artifacts/example.com/page-context
```
6. Generate a runnable Stagehand example (`stagehand-example.ts`) and run it with `tsx`:
```bash
node scripts/generate-stagehand-example.mjs artifacts/example.com/page-context
npx tsx artifacts/example.com/page-context/stagehand-example.ts
```
7. Validate:
```bash
node scripts/validate.mjs artifacts/example.com/page-context
```
8. If validation fails, inspect `eval.json` and `eval-report.md`, patch `manifest.json`, then compile and validate again.
## Manifest contract
```json
{
"domain": "example.com",
"task": "page-context",
"url": "https://example.com",
"generatedAt": "2026-06-04T00:00:00.000Z",
"tools": [
{
"name": "example_com_page_context",
"description": "Returns page context.",
"inputSchema": {
"type": "object",
"properties": {},
"required": []
},
"implementation": {
"kind": "dom",
"source": "return { success: true, title: document.title, url: location.href };"
},
"fixtureInput": {}
}
]
}
```
## Authoring rules
- `implementation.source` is inserted inside `async (input) => { ... }`; write JavaScript statements, not a full function wrapper.
- Return a JSON-serializable object.
- WebMCP code runs inside the browser page. Use browser-native APIs: `document`, `location`, `navigator`, and same-origin `fetch`.
- Do not use Playwright, Puppeteer, Stagehand, XPath helpers, or agent/browser commands inside `implementation.source`.
- `document.querySelector` and `querySelectorAll` must receive valid browser CSS selectors only.
- To find visible text, use `Array.from(document.querySelectorAll(...)).find((el) => (el.textContent || "").includes("..."))`.
- Do not include API keys, bearer tokens, cookies, localStorage secrets, or user credentials.
- Do not use `eval` or `new Function`.
- Avoid destructive actions unless the user explicitly asked for them.
- Make implementations defensive: check for missing elements and return structured `{ success: false, error: "..." }` responses.
- Generated init scripts register WebMCP tools only in the top frame.
## Output layout
```text
artifacts/<domain>/<task>/
manifest.json
webmcp.init.js
stagehand-example.ts
eval.json
eval-report.md
```
To turn the example into a standalone project, scaffold a Stagehand app with
`npx create-browser-app` and drop the generated `webmcp.init.js` into it (load it
with `page.addInitScript({ path: "webmcp.init.js" })`).
© browserbase · MIT · browserbase/skills