Loading...
Loading...
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.
npx skill4agent add browserbase/skills webmcp-genmanifest.jsoncd skills/webmcp-gen
pnpm installtsxtypescript@types/nodestagehand-example.ts<domain>/<task>example.com/page-contextnode scripts/scaffold.mjs example.com/page-context --url https://example.combrowsebrowse open https://example.com --local
browse snapshot
browse get title
browse get url
browse get text body
browse get html bodybrowse snapshotbrowse stopartifacts/<domain>/<task>/manifest.jsonnode scripts/compile.mjs artifacts/example.com/page-contextstagehand-example.tstsxnode scripts/generate-stagehand-example.mjs artifacts/example.com/page-context
npx tsx artifacts/example.com/page-context/stagehand-example.tsnode scripts/validate.mjs artifacts/example.com/page-contexteval.jsoneval-report.mdmanifest.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": {}
}
]
}implementation.sourceasync (input) => { ... }documentlocationnavigatorfetchimplementation.sourcedocument.querySelectorquerySelectorAllArray.from(document.querySelectorAll(...)).find((el) => (el.textContent || "").includes("..."))evalnew Function{ success: false, error: "..." }artifacts/<domain>/<task>/
manifest.json
webmcp.init.js
stagehand-example.ts
eval.json
eval-report.mdnpx create-browser-appwebmcp.init.jspage.addInitScript({ path: "webmcp.init.js" })