webmcp-gen

작성자: browserbase

대상 URL과 원하는 도구 기능을 바탕으로 사이트별 WebMCP 초기화 스크립트를 생성, 컴파일 및 검증합니다. 사용자가 WebMCP 도구를 작성하려 할 때 사용하세요.

npx skills add https://github.com/browserbase/skills --skill webmcp-gen

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:

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:
<domain>/<task>

Example:

example.com/page-context
  1. Scaffold the artifact:
node scripts/scaffold.mjs example.com/page-context --url https://example.com
  1. Explore the target page with the browse CLI:
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.

  1. Edit artifacts/<domain>/<task>/manifest.json. The manifest is the source of truth.

  2. Compile:

node scripts/compile.mjs artifacts/example.com/page-context
  1. Generate a runnable Stagehand example (stagehand-example.ts) and run it with tsx:
node scripts/generate-stagehand-example.mjs artifacts/example.com/page-context
npx tsx artifacts/example.com/page-context/stagehand-example.ts
  1. Validate:
node scripts/validate.mjs artifacts/example.com/page-context
  1. If validation fails, inspect eval.json and eval-report.md, patch manifest.json, then compile and validate again.

Manifest contract

{
  "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

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의 다른 스킬

optimize-agent-prompt
browserbase
Browserbase Agent API 데모를 구축하고 개선하며, Autobrowse 스타일의 외부 루프를 통해 고정된 작업을 실행하고, Agent 메시지와 세션 로그를 수집하고, 결과를 점수화하고, 하나의 시스템 프롬프트 휴리스틱을 수정하고, 수렴을 확인합니다. Browserbase Agents 데모 또는 POC를 만들 때, Agent 시스템 프롬프트를 최적화할 때, 불안정한 Agent 실행을 진단할 때, 또는 Browserbase Agents API에 자동 리서치/오토브라우즈를 적용할 때 사용하세요.
add-webmcp
browserbase
기존 웹 애플리케이션을 분석하고, 라우트, 폼, 서버 액션, 핸들러, 스키마 전반에서 안전한 사용자 노출 기능을 식별한 다음, 자사 WebMCP 도구를 구현하고 Stagehand로 발견 및 호출을 검증합니다. 사용자가 코드베이스를 에이전트 준비 상태로 만들거나, 웹사이트 기능을 WebMCP 도구로 노출하거나, URL에서 독립 실행형 주입 스크립트를 생성하는 대신 앱에 WebMCP를 직접 추가하도록 요청할 때 사용합니다.
browse
browserbase
browse CLI를 사용하여 Browserbase 브라우저 자동화, Browserbase 클라우드 API, Browserbase Functions, 템플릿, 웹 가져오기/검색, 진단 및 Browse.sh…
browse
browserbase
browse CLI를 Browserbase 브라우저 자동화, Browserbase 클라우드 API, Browserbase Functions, 템플릿, 웹 fetch/search, 진단, Browse.sh 등에 사용하세요…
browser-automation
browserbase
MCP 도구를 사용하여 웹 브라우저 상호작용을 자동화합니다. 사용자가 웹사이트 탐색, 웹 페이지 이동, 웹사이트에서 데이터 추출, 스크린샷 촬영 등을 요청할 때 사용합니다,…
functions
browserbase
공식 Browserbase Functions CLI를 사용한 서버리스 브라우저 자동화 배포를 안내합니다. 사용자가 자동화를 배포하여 실행하려 할 때 사용하세요…
agent-experience
browserbase
제품, SDK, 문서 사이트 또는 SKILL.md의 개발자 경험을 감사하려면, 여러 Claude 하위 에이전트를 아주 작은 작업 프롬프트와 실제…
autobrowse
browserbase
자기 개선형 브라우저 자동화로, 자동 연구 루프를 통해 탐색 작업을 반복 실행하고, 추적 기록을 읽으며, 탐색 기술을 개선합니다…