# WebMCP

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

New on /news: [Rivet self-hosts on any cloud through Alchemy](/news).

## What it does

A [capability contract](/lore/one-capability-every-surface) gives `search` one name and one set of input and output rules.
That contract becomes an HTTP route, an [MCP](/lore/mcp-is-another-surface) tool, and a WebMCP tool.
The browser tool calls the same server handler through the reader's RPC connection.

Every reader page offers the public tools for search, reading, lore, flags, prompts, the directory, and the public learning deck.
The learning tools work on data supplied by the caller. They save nothing on the server.
The browser does not register `execute`, subscriber signup, authenticated feedback, or local devtools.

Leaving the document removes its tools.

## The standard

WebMCP is a [Community Group draft](https://webmachinelearning.github.io/webmcp/). We read it on November 24, 2026.
The reader checks `document.modelContext` first, then checks the older Chrome location, `navigator.modelContext`.
It gives each tool the same input rules that the public MCP server advertises.

[Chrome's guide](https://developer.chrome.com/docs/ai/webmcp) lists a trial from Chrome 149 and a local testing flag.
[Chrome Platform Status](https://chromestatus.com/feature/5117755740913664) still lists the feature as proposed.
[Edge runs a separate trial](https://developer.microsoft.com/en-us/microsoft-edge/origin-trials/trials/0b76fe60-b266-458e-a285-04e375c0c31a) from Edge 150.

The [implementation tracker](https://github.com/webmachinelearning/webmcp/blob/main/implementation-status.md) lists ChatGPT Desktop support and a future Brave Leo release.
Mozilla records a [neutral position](https://github.com/mozilla/standards-positions/issues/1412). WebKit records [opposition](https://github.com/WebKit/standards-positions/issues/670).
A browser without the API still renders the same pages.

Set `WEB_MCP_CHROME_TRIAL_TOKEN` or `WEB_MCP_EDGE_TRIAL_TOKEN` only after the respective browser issues a token for the site origin.
The site sends configured tokens with HTML responses and omits the header when both are unset.

## How to check

1. Build the reader and serve it on loopback with its `/rpc` backend.
2. Launch Playwright Chromium with `--enable-features=WebMCP`. On Chromium 158, also pass `--enable-blink-features=WebMCP` to enable the draft API.
3. Open the home page. Use the `toolchange` event to wait until `getTools()` lists `search`.
4. Run this in `page.evaluate`.

```js
const context = document.modelContext;
const tools = await context.getTools();
const search = tools.find((tool) => tool.name === "search");
const raw = await context.executeTool(search, { query: "capability", limit: 1 });
const result = typeof raw === "string" ? JSON.parse(raw) : raw;
return { names: tools.map((tool) => tool.name), result };
```

5. Check for `search` and `read` in the names and a document match in the result. There must be no `rat_*` tools.
6. Run the production bundle test. It rejects forms with an undeclared `toolname` and checks that browser code excludes devtools.

## Sources

1. [WebMCP](https://webmachinelearning.github.io/webmcp/)
   W3C Web Machine Learning Community Group. Draft API for registration, discovery, execution, and removal. Accessed 2026-11-24.

2. [WebMCP explainer](https://github.com/webmachinelearning/webmcp/blob/main/README.md)
   W3C Web Machine Learning Community Group. Discovery, cancellation, and the scope of the imperative API. Accessed 2026-11-24.

3. [Get started with WebMCP](https://developer.chrome.com/docs/ai/webmcp)
   Chrome for Developers. Chrome origin trial and local testing flag. Accessed 2026-11-24.

4. [WebMCP platform status](https://chromestatus.com/feature/5117755740913664)
   Chrome Platform Status. Proposed status and origin trial record. Accessed 2026-11-24.

5. [Browser and agent implementation status](https://github.com/webmachinelearning/webmcp/blob/main/implementation-status.md)
   W3C Web Machine Learning Community Group. Records supported agents, trials, and browser positions. Accessed 2026-11-24.

6. [Microsoft Edge WebMCP origin trial](https://developer.microsoft.com/en-us/microsoft-edge/origin-trials/trials/0b76fe60-b266-458e-a285-04e375c0c31a)
   Microsoft Edge. Edge issues its own WebMCP origin trial tokens. Accessed 2026-11-24.

7. [Mozilla standards position on WebMCP](https://github.com/mozilla/standards-positions/issues/1412)
   Mozilla. Mozilla marks its position neutral. Accessed 2026-11-24.

8. [WebKit standards position on WebMCP](https://github.com/WebKit/standards-positions/issues/670)
   WebKit. WebKit opposes the draft. Accessed 2026-11-24.

## Linked from

- Agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms.txt)

- Change log → What changed in the files served here, newest first. → [Read page](https://ratstack.sh/log)

- Full agent guide → An Effect stack so pure (aspirational) Kit Langton will blush. → [Read page](https://ratstack.sh/llms-full.txt)

- Rat Stack systems | rat-stack → The systems rat-stack ships, the standard each keeps, and how to check it. → [Read page](https://ratstack.sh/systems)

- Source change history (log.md) → The generated change log as Markdown. → [Read page](https://ratstack.sh/log.md)
