What is WebMCP?
WebMCP lets a web page expose tools that Stagehand can discover and invoke through Chrome’s WebMCP DevTools Protocol support. Use it when the page itself registers structured tools for workflows like search, booking, calculation, or support requests.WebMCP is different from Stagehand agent MCP integrations. Agent MCP integrations connect your agent to external MCP servers. WebMCP tools are registered by the current web page and are invoked through the
page object.Browser Support
WebMCP requires Chrome or Chromium newer than version 149, and it must be launched with--enable-features=WebMCPTesting,DevToolsWebMCPSupport. Stagehand launches browsers with those flags by default.
Listing Tools
Usepage.listWebMCPTools() after navigating to a page that registers WebMCP tools.
name, optional description, optional inputSchema, optional annotations, and the frameId where it was registered.
listWebMCPTools() returns a fresh snapshot from the browser on each call. It does not reuse tools from previous pages or previous calls.Invoking Tools
Usepage.invokeWebMCPTool() with the tool name and a JSON-serializable input object. The method returns an invocation immediately; await invocation.result for the tool’s final response.
Handling Results
WebMCP invocation results have one of three statuses:output. A failed tool may include errorText or exception.
invocation.cancel(). The invocation result still resolves when the browser sends the cancellation response.
Timeouts
Both WebMCP methods accept atimeoutMs option:
listWebMCPTools({ timeoutMs })waits for the page’s tool snapshot. Default:1000invokeWebMCPTool(name, input, { timeoutMs })sets how longinvocation.resultwaits for the tool response. Default:30000
StagehandUnsupportedBrowserFeatureError with instructions for enabling the required Chrome flags.

