WebMCP at the edge.
A Cloudflare Worker that equips any website with WebMCP from a single TOML config. Browser-native agents see your site's tools automatically. Desktop MCP clients pair through a dedicated page.
Get started Source on GitHubHow it works
The Worker sits in front of your domain. On every request it does one of two things:
- If the request matches a Worker-owned path (manifest,
/mcplanding,/_webmcp/exec/*,/_webmcp/health,/llms.txt,/robots.txt,/.well-known/agents.mdand its 301 aliases), handle it directly. - Otherwise proxy the request to origin. Two modifications happen on the way back to the visitor:
- HTTP
Linkheader added on every proxied response - HTML, PDF, image, JSON, anything. The header points at the manifest, so an agent doing aHEADrequest finds it without parsing a body. - On HTML responses only (status 200,
text/html, UTF-8, path not excluded), HTMLRewriter also injects one<link rel="webmcp">into<head>and one<script src="/_webmcp/bootstrap.<hash>.js" defer>before</body>. Non-HTML responses pass through unchanged in their body. - If a
[[forms]]block matches the current path, declarative WebMCP attributes are stamped onto matching forms in the HTML response.
- HTTP
What you get
Manifest
Static tool catalogue at /.well-known/webmcp.json.
Auto-registration
Site-wide navigator.modelContext.registerTool for browser-native agents.
Discovery
<link rel="webmcp"> on every page, plus HTTP Link header.
Pairing page
/mcp lands desktop MCP clients with one-line setup.
llms.txt + robots.txt
Augmented with WebMCP discovery hints, idempotently merged.
AGENTS.md
Auto-published at /.well-known/agents.md with 301 aliases for /AGENTS.md and /agents.md.
Form injection
Stamp toolname / tooldescription / toolparamdescription onto existing forms at the edge from a [[forms]] TOML block. No CMS edit.
Five executors
sitemap_filter, rss_feed, dom_extract, http_json, http_get.
Two minutes to deploy
git clone https://github.com/basgr/cf-webmcp
cd cf-webmcp
cp templates/wordpress.toml webmcp.toml
cp wrangler.example.toml wrangler.toml
# edit webmcp.toml + wrangler.toml
npm install
npm run build
wrangler deploy
Three templates ship: default, wordpress, woocommerce.