The W3C Community Group's polyfill for document.modelContext
open sourceApache-2.0free
The WebMCP polyfill adds document.modelContext, the WebMCP API that lets a web page register tools for browser agents, to browsers without native support. It follows the Web Machine Learning Community Group's draft and its webmcp-types, has no runtime dependencies, and covers tool registration, discovery, execution and cancellation, the tool change and activation events, frame exposure and origin filtering. Pages load it conditionally, only where the browser lacks the API, and it works only in secure contexts. It's a pilot project of the W3C Open Source Program, and changes as the draft does.
Problems it solves
- add document.modelContext to browsers without native WebMCP support
- let browser agents call tools on my web page before browsers ship WebMCP
- the official WebMCP polyfill for my website
Features
- document.modelContext in browsers without native WebMCP
- registerTool, getTools and executeTool with cancellation
- toolchange, toolactivated and toolcancel events
- frame exposure and origin filtering
- no runtime dependencies
- conditional loading only where the API is missing
Limitations
Alternatives
The same job
These do what WebMCP polyfill does.
- MCP-B WebMCP runtime and MCP bridge packages for websites
