Ai Agents 2 min read

How to Expose Site Tools to Agents With Cloudflare WebMCP

Cloudflare WebMCP lets you expose structured tools to browser-based AI agents without changing your origin code. Learn how to configure and register tools.

Cloudflare has launched a developer preview of WebMCP, an interface that exposes your website’s structured tools to browser-based AI agents without modifying your origin code. Released during Cloudflare’s Agents Week 2026, the tool injects a JavaScript bridge that registers local capabilities directly to an emerging browser standard. This allows agents to navigate your site via predictable API calls instead of scraping DOM elements and wasting compute on human-oriented CSS.

Architecture and Injection Bridge

WebMCP leverages document.modelContext, an experimental standard currently available in Chrome 146. Rather than building custom endpoints or managing separate agent architectures, site owners enable WebMCP via a single switch in the Cloudflare dashboard.

Cloudflare’s edge automatically injects a lightweight bridge script at /.webmcp/bridge.js into your page. This bridge registers pre-configured “packs”—collections of tool descriptors based on the Model Context Protocol—using document.modelContext.registerTool. Because the injection happens at the edge, your origin servers remain untouched.

Local Execution and Stateless Protocol

Tools exposed via WebMCP execute entirely within the visitor’s browser. This local execution model enables packs to utilize the current user’s session state. A Site MCP Server pack, for instance, can communicate directly with your existing MCP server endpoints using the visitor’s active session and cookies. Other packs, like the Content Credentials pack, fetch and parse image metadata locally without sending it back to an external server.

WebMCP implements the MCP 2026-07-28 specification. This version transitions the protocol from stateful session management to a stateless model utilizing “Streamable HTTP.” Agents invoke tools using standard POST requests, routing their commands via Mcp-Method and Mcp-Name headers. This stateless approach scales cleanly across edge infrastructure.

Security and Agent Authentication

Running unmanaged local MCP servers often creates security liabilities, commonly referred to as the “Shadow MCP” risk. WebMCP mitigates this by moving the interaction to Cloudflare’s governed remote infrastructure. You can combine it with Cloudflare Agents Week releases to enforce strict access controls.

The feature integrates seamlessly with Web Bot Auth for cryptographic identification of incoming agents. Sites can also utilize Private Access Control Tokens (PACT)—a standard developed alongside Google and Mozilla—to anonymously vouch for legitimate agent traffic.

Enable the WebMCP preview in your Cloudflare dashboard to begin exposing your tools. Ensure your application architecture is prepared to handle the stateless POST requests before routing production traffic.

Get Insanely Good at AI

Get Insanely Good at AI

The book for developers who want to understand how AI actually works. LLMs, prompt engineering, RAG, AI agents, and production systems.

Keep Reading