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メッセージとセッションログの収集、結果のスコアリング、システムプロンプトのヒューリスティックを1つ改訂し、収束を確認します。Browserbase AgentsデモやPOCの作成、Agentシステムプロンプトの最適化、不安定なAgent実行の診断、またはBrowserbase Agents APIへの自動リサーチ/オートブラウズの適用時に使用します。
add-webmcp
browserbase
既存のWebアプリケーションを分析し、ルート、フォーム、サーバーアクション、ハンドラー、スキーマ全体で安全なユーザー可視機能を特定し、ファーストパーティのWebMCPツールを実装して、Stagehandでディスカバリと呼び出しを検証します。ユーザーがコードベースをエージェント対応にしたい、Webサイトの機能をWebMCPツールとして公開したい、またはURLからスタンドアロンの注入スクリプトを生成するのではなく、アプリに直接WebMCPを追加したいと依頼した場合に使用します。
browse
browserbase
browse CLIを使用して、Browserbaseのブラウザ自動化、BrowserbaseクラウドAPI、Browserbase Functions、テンプレート、Webフェッチ/検索、診断、Browse.shなどを利用します…
browse
browserbase
browse CLIを使用して、Browserbaseのブラウザ自動化、BrowserbaseクラウドAPI、Browserbase Functions、テンプレート、Webフェッチ/検索、診断、Browse.sh…を実行します。
browser-automation
browserbase
MCPツールを使用してウェブブラウザの操作を自動化します。ユーザーがウェブサイトの閲覧、ウェブページのナビゲーション、ウェブサイトからのデータ抽出、スクリーンショットの取得などを求めた場合に使用します。
functions
browserbase
公式のBrowserbase Functions CLIを使用したサーバーレスブラウザ自動化のデプロイを案内します。ユーザーが自動化をデプロイして実行したい場合に使用します…
agent-experience
browserbase
製品、SDK、ドキュメントサイト、またはSKILL.mdの開発者体験を監査するために、複数のClaudeサブエージェントを、小さなタスクプロンプトと実際の…だけを与えて投入します。
autobrowse
browserbase
自己改善型ブラウザ自動化を自動リサーチループで実現。ブラウジングタスクを反復実行し、トレースを読み取り、ナビゲーションスキルを向上させます…