Webmcp Gen
BrowserbaseOfficialPublished by Browserbase
- Skill
- Content generator
- Software development
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
webmcp-gen provides a structured process for creating WebMCP tools that run directly within a browser context. The skill guides users through scaffolding a project, defining tool manifests, compiling them into initialization scripts, and validating their registration and execution using Stagehand. It emphasizes a defensive coding approach for browser-native interactions, ensuring that tools are reliable and properly integrated into the browser environment.
What it does
- Scaffolds project directories for new WebMCP tool definitions.
- Compiles JSON manifests into functional webmcp.init.js scripts.
- Generates testable Stagehand examples to verify tool registration.
- Provides validation scripts to check tool execution and output.
- Supports iterative development through manifest patching and re-validation.
When to use it
- When you need to create custom WebMCP tools for specific websites.
- When you want to generate a webmcp.init.js artifact for browser automation.
- When you need to test how a website interacts with registered WebMCP tools.
- When you are building browser-based agents that require custom DOM-based tool capabilities.
Advantages
- Standardizes the creation and testing of browser-based tools.
- Ensures tool implementations are isolated and defensive.
- Facilitates easy integration into existing Stagehand-based browser applications.
- Provides clear feedback loops through automated evaluation reports.
Usage examples
- “Scaffold a new WebMCP project for example.com to extract page context.”
- The skill creates the necessary directory structure and manifest file at artifacts/example.com/page-context.
- “Compile and validate my current WebMCP manifest for example.com.”
- The skill runs the compilation script and executes the validation suite, providing an eval-report.md with the results.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/browserbase/webmcp-gen/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip webmcp-gen.zip -d .agents/skills
Documentation by Browserbase
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 installThis installs the pinned Stagehand package plus the TypeScript toolchain (tsx,
typescript, @types/node) used to run the generated stagehand-example.ts.
Workflow
Pick an artifact slug with exactly one slash:
<domain>/<task>Example:
example.com/page-contextScaffold the artifact:
node scripts/scaffold.mjs example.com/page-context --url https://example.comExplore the target page with the
browseCLI:
browse open https://example.com --local
browse snapshot
browse get title
browse get url
browse get text body
browse get html bodyPrefer browse snapshot, page text, and DOM inspection over screenshots unless visual layout matters. Use browse stop when exploration is complete.
Edit
artifacts/<domain>/<task>/manifest.json. The manifest is the source of truth.Compile:
node scripts/compile.mjs artifacts/example.com/page-contextGenerate a runnable Stagehand example (
stagehand-example.ts) and run it withtsx:
node scripts/generate-stagehand-example.mjs artifacts/example.com/page-context
npx tsx artifacts/example.com/page-context/stagehand-example.tsValidate:
node scripts/validate.mjs artifacts/example.com/page-contextIf validation fails, inspect
eval.jsonandeval-report.md, patchmanifest.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.sourceis inserted insideasync (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-originfetch.Do not use Playwright, Puppeteer, Stagehand, XPath helpers, or agent/browser commands inside
implementation.source.document.querySelectorandquerySelectorAllmust 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
evalornew 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.mdTo 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" })).
Files
- .gitignore41 B
- ATTRIBUTION.mdAdded by AutoGineer862 B
- LICENSE.txt1.0 KiB
- SKILL.md4.3 KiB
- package.json314 B
- pnpm-lock.yaml72.2 KiB
- scripts/compile.mjsScript5.8 KiB
- scripts/generate-stagehand-example.mjsScript3.4 KiB
- scripts/scaffold.mjsScript3.2 KiB
- scripts/validate.mjsScript5.1 KiB
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Declares allowed tools, Needs an API key, Needs Node.js
The author says: 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`).
Security
What our scanner noticed· Low risk
- Instructions that use the network
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Browserbase
- Publisher
- Browserbase (Official)
- Source
- browserbase/skills · skills/webmcp-gen · commit 6811ca3
- Licence
- MIT License (redistribution allowed)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Browserbase or Browserbase.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download webmcp-gen.zip