Skip to content

WebMCP and MCP starter kit

Paste a form from your site and get the WebMCP attributes and script that let an in-browser agent fill it in, test the script in a sandbox, then read the security guidance and a recipe for a remote MCP server. The generator and the test run in your browser; nothing you paste is sent to us.

Checked against the draft of 2026-09-29. WebMCP is a draft, so names and behaviour may change. This page doesn’t claim that any AI product uses these tools; it helps you publish them correctly and safely.

1. Generate

Paste the HTML of a form. Nothing is sent to a server, and the pasted HTML is parsed but never run. Password, payment and file-upload forms are refused.

Declarative: attributes on your form

Paste a form to see the output.

Imperative: a script for document.modelContext

Paste a form, then answer both questions.

2. Test

Tests shape, not a real agent. The frame has no network access and nothing you paste leaves this page.

Generate the imperative script above to test it here.

What the test does and doesn’t show

The harness tests shape, not a real agent. It runs your snippet in a sandboxed frame against a stand-in document.modelContext, checks each tool’s name, schema, description and annotation members against the draft, and lets you call execute with sample input. It never contacts your site, and no AI agent or browser model is involved, so it can’t tell you how an agent will choose or use your tools. To try them in a real browser, use Chrome with the testing flag (chrome://flags/#enable-webmcp-testing) or an origin-trial token, and the Model Context Tool Inspector extension, on your own site. Sources: Chrome for Developers: WebMCP (testing flag, origin trial, Model Context Tool Inspector); WebMCP, Draft Community Group Report (W3C Web Machine Learning CG), 29 September 2026.

3. Guidance

Security

WebMCP lets a page hand an AI agent a list of actions. The agent reads your tool names, descriptions and results as text and decides what to do with them, and it may be following instructions someone else planted. These points come from the security section of the WebMCP draft (§6.3 risks, §6.4 mitigations) and from our review of our own tools.

Two risks in §6.3 are for browsers and agents rather than site owners: same-origin boundaries (§6.3.4, still marked TODO in the draft) and private browsing modes (§6.3.5). Sources: WebMCP draft §6.3 Key Security and Privacy Risks; WebMCP draft §6.4 Mitigations; Our prompt-injection review of our own agent tools, 2026-09-29; live example: the notes in our AGENTS.md.

Remote MCP server recipe

WebMCP tools live in an open browser tab. To offer the same actions to agents that call servers directly, wrap the same functions in a remote MCP server. This is a recipe for a Next.js route handler with the official TypeScript SDK v2, @modelcontextprotocol/server (2.2.0 on 2026-09-29), which implements MCP 2026-07-28.

// app/mcp/route.ts
import { createMcpHandler, fromJsonSchema, McpServer, originValidationResponse } from '@modelcontextprotocol/server';

export const runtime = 'nodejs';

const ALLOWED_ORIGIN_HOSTS = ['example.com', 'www.example.com'];

const mcp = createMcpHandler(
  () => {
    const server = new McpServer({ name: 'example', version: '1.0.0' }, { capabilities: { tools: { listChanged: false } } });
    server.registerTool(
      'search_products',
      {
        title: 'Search products',
        description: 'Search the catalogue by keyword. Returns up to 10 products with name, price and URL.',
        inputSchema: fromJsonSchema<{ q: string }>({
          type: 'object',
          properties: { q: { type: 'string', maxLength: 200 } },
          required: ['q'],
          additionalProperties: false,
        }),
        annotations: { readOnlyHint: true, openWorldHint: false },
      },
      async ({ q }) => {
        const results = await searchProducts(q); // the function your search page already calls
        return { content: [{ type: 'text', text: JSON.stringify({ results }) }], structuredContent: { results } };
      },
    );
    return server;
  },
  { responseMode: 'json', maxRequestBodySize: 1_000_000 },
);

async function handle(request: Request): Promise<Response> {
  const rejected = originValidationResponse(request, ALLOWED_ORIGIN_HOSTS);
  if (rejected) return rejected;
  if (await overLimit(clientIp(request))) {
    return new Response(JSON.stringify({ jsonrpc: '2.0', error: { code: -32000, message: 'rate limited' } }), {
      status: 429,
      headers: { 'content-type': 'application/json', 'retry-after': '600' },
    });
  }
  return mcp.fetch(request);
}

export const POST = handle;
export const GET = handle;
export const DELETE = handle;

Annotations

The toolWebMCP membersMCP annotationsDescription warningNote
Reads only your own data; changes nothingreadOnlyHint readOnlyHint: true openWorldHint: false NoClosed world: it touches nothing outside your site.
Changes nothing; returns other people’s textreadOnlyHint untrustedContentHint readOnlyHint: true openWorldHint: true YesMCP has no untrusted-content annotation: add a warning to the description and a notice first in each result.
Changes something or spends a quotaconsequentialHint readOnlyHint: false destructiveHint: false idempotentHint: false openWorldHint: true NoreadOnlyHint false marks it as a write, and MCP asks clients to confirm sensitive operations. destructiveHint false says it only adds (MCP’s default is true); set it true for a tool that deletes or overwrites. idempotentHint false: each call has a new effect.
Changes something and returns other people’s textconsequentialHint untrustedContentHint readOnlyHint: false destructiveHint: false idempotentHint: false openWorldHint: true YesBoth of the above.

openWorldHint is an MCP member, not a WebMCP one; a browser ignores it. MCP says clients must treat annotations as untrusted unless they come from a trusted server, so they are hints, never a substitute for server-side checks. Sources: MCP specification 2026-07-28 schema: ToolAnnotations (defaults); MCP specification 2026-07-28, Tools: Security Considerations and annotations; WebMCP, Draft Community Group Report (W3C Web Machine Learning CG), 29 September 2026; Our remote MCP server, described in AGENTS.md, "Remote MCP server".

MCP Registry

The MCP Registry lists public servers so directories and clients can find them; it is in preview, and breaking changes or data resets may happen. A remote server’s entry is a server.json file. name is reverse-DNS (com.example/…) with one slash, and you prove you own the domain with a DNS record or a file at /.well-known/mcp-registry-auth. description is at most 100 characters, and version must be an exact version, not a range. Publish with the registry’s mcp-publisher tool.

{
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
  "name": "com.example/store",
  "title": "Example Store",
  "description": "Search the Example Store catalogue and check order status",
  "version": "1.0.0",
  "websiteUrl": "https://example.com",
  "remotes": [{ "type": "streamable-http", "url": "https://example.com/mcp" }]
}

An optional llms.txt line

- [WebMCP tools](https://example.com/search): This page registers WebMCP tools in the browser (document.modelContext): search_products (read-only), request_quote (changes data; the person confirms).
- [MCP server](https://example.com/mcp): Remote MCP server (Streamable HTTP) with the same tools and the same limits as the site.

Optional. It tells people, and any agent that reads your llms.txt, that the tools exist and which ones change data. No AI vendor has documented that its assistant reads llms.txt, and a line here doesn’t register anything: the tools work, or don’t, whether or not it is present. The LLMSRank rubric counts a WebMCP or MCP mention under Machine surface (A5) and Action endpoints (A6); that is our rubric, not the behaviour of any AI product. Sources: Does ChatGPT, Claude, Perplexity or Google read llms.txt? (vendor statements, checked 2026-09-29).

Try it in Chrome

Chrome’s testing flag is chrome://flags/#enable-webmcp-testing; paste it into the address bar, because browsers don’t follow links to chrome:// pages. Chrome’s documentation covers the flag, the origin trial and the Model Context Tool Inspector extension for testing on your own site: Chrome for Developers: WebMCP (testing flag, origin trial, Model Context Tool Inspector). The imperative and declarative pages are here and here.