---
title: WebMCP
description: Expose documentation search and page reading to browser agents.
url: /docs/webmcp
source: apps/template/content/docs/webmcp.mdx
---

# WebMCP

Geistdocs includes experimental WebMCP support. WebMCP is disabled by default. To opt in, add it to the `defineConfig` call in `lib/geistdocs/config.tsx`:

```ts
export const config = defineConfig({
  // ...
  webmcp: { enabled: true },
});
```

The provider exposes two read-only tools:

| Tool | Input | Result |
| --- | --- | --- |
| `search_docs` | `query`, a nonempty string up to 500 characters | Results from the existing search API in the current language |
| `read_current_page` | None | The current documentation page as Markdown |

Search respects the existing search visibility rules. Page reading uses the existing Markdown route and fails if the current page does not serve Markdown. Neither tool sends data to an external model or modifies documentation. Returned documentation is marked as untrusted content.

WebMCP requires a compatible browser with the experimental API enabled. Unsupported browsers continue to work normally. This feature uses browser-local tools, independently of the site's remote MCP discovery manifest.

## Verify locally

Enable WebMCP testing as described in the [Chrome documentation](https://developer.chrome.com/docs/ai/webmcp). Open a documentation page and inspect its tools:

```js
const tools = await document.modelContext.getTools();
const search = tools.find((tool) => tool.name === "search_docs");
await document.modelContext.executeTool(search, JSON.stringify({ query: "configuration" }));
const read = tools.find((tool) => tool.name === "read_current_page");
await document.modelContext.executeTool(read, "{}");
```

Navigate to another documentation page and read it again. Repeat in a translated route and, when configured, under the site's base path. Disable the feature and verify the provider removes its tools.

## agent-browser

With agent-browser 0.36.0 or newer, WebMCP is enabled by default in managed Chrome sessions:

```bash
agent-browser --session docs-check open http://localhost:3000/docs
agent-browser --session docs-check webmcp list
agent-browser --session docs-check webmcp invoke search_docs --params '{"query":"configuration"}'
agent-browser --session docs-check webmcp invoke read_current_page --params '{}'
agent-browser --session docs-check close
```

Discovery includes each tool's origin, frame, schema, and read-only annotations. Check the invocation's `status`: a successfully delivered command can still contain a failed tool execution.

Both tools limit network requests to 15 seconds. When the browser supplies an execution signal, cancellation also aborts the request. Some experimental browser versions, including Chrome 152, omit that signal: canceling an invocation in those versions does not immediately abort its underlying fetch, which remains bounded by the request deadline.
