webmcp-integration
WebMCP Integration
WebMCP is the W3C draft API (webmachinelearning.github.io/webmcp) that lets a page register tools — name, description, JSON Schema, execute handler — on document.modelContext. Agent-capable browsers discover those tools and call them exactly like MCP tools, so the site acts as an MCP server and agents drive real journeys instead of guessing from screenshots and clicks.
Work in one of three modes, chosen from the request:
| Mode | Request sounds like | Go to |
|---|---|---|
| ADD | "add WebMCP to my site", "make my app agent-callable" | § Implement |
| AUDIT | "audit/check/grade my WebMCP", "what would webmcp.com score us" | § Audit |
| PERFECT | "improve our score", "agents misuse our tools", "make our tools better" | Run § Audit first, then fix by § Perfect priorities |
Two sources back everything here: the W3C spec for API truth, and webmcp.com's published scorecard methodology for the only public grading rubric (Usability 60% · Coverage 20% · Quality 20%). Deep detail lives in references/api.md and references/scorecard.md — consult them on demand for edge cases, not upfront.
API essentials
Canonical example in the WG dialect (document.modelContext) — in production route it through the compat adapter from the next section: