webmcp-gen

Erstelle, kompiliere und validiere seiten-spezifische WebMCP-Init-Skripte aus einer Ziel-URL und gewünschten Tool-Fähigkeiten. Verwende, wenn der Benutzer WebMCP-Tools erstellen möchte…

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" })).

Mehr Skills von browserbase

browse
browserbase
Nutze die browse-CLI für die Browserbase-Browserautomatisierung, Browserbase-Cloud-APIs, Browserbase-Funktionen, Vorlagen, Web-Abruf/-Suche, Diagnose und Browse.sh…
official
browser-automation
browserbase
Automate web browser interactions using MCP tools. Use when the user asks to browse websites, navigate web pages, extract data from websites, take screenshots,…
official
functions
browserbase
Leite die Bereitstellung serverloser Browser-Automatisierung mit der offiziellen Browserbase Functions CLI an. Verwende dies, wenn der Benutzer Automatisierung bereitstellen möchte, die auf einem… laufen soll.
official
agent-experience
browserbase
Auditieren Sie die Entwicklererfahrung eines Produkts, SDK, Dokumentationsseite oder SKILL.md, indem Sie mehrere Claude-Subagenten darauf ansetzen, mit nur einem winzigen Aufgaben-Prompt und echten…
official
autobrowse
browserbase
Selbstverbessernde Browserautomatisierung durch die Auto-Research-Schleife. Führt iterativ eine Browsing-Aufgabe aus, liest den Trace und verbessert die Navigationsfähigkeit…
official
browse
browserbase
Vollständige Anleitung zum Erstellen und Bereitstellen von Browser-Automatisierungsfunktionen mit der browse CLI
official
browser
browserbase
Browser-Automatisierung mit lokalem Chrome oder remote Browserbase für geschützte Websites, Bot-Erkennung und CAPTCHAs. Zwei Modi: lokaler Chrome (Standard, keine Einrichtung) oder remote Browserbase (Anti-Bot-Tarnung, automatische CAPTCHA-Lösung, Residential-Proxys, Sitzungspersistenz). Kernbefehle umfassen Navigation, Seiteninspektion, Interaktion (Klicken, Tippen, Ausfüllen, Auswählen, Ziehen) und Sitzungsverwaltung über die CLI. Verwenden Sie browse snapshot, um den Accessibility-Baum zu lesen und Elementreferenzen für zuverlässige Interaktionen zu erhalten; vorbehalten...
official
Browser Automation
browserbase
Automatisieren Sie Webbrowser-Interaktionen mit natürlicher Sprache über CLI-Befehle. Verwenden Sie dies, wenn der Benutzer bittet, Websites zu durchsuchen, Webseiten zu navigieren, Daten zu extrahieren aus…
official