webmachinelearning/webmcp

🤖 WebMCP

What it solves

Web pages are designed for human interaction, but AI agents often struggle to use them reliably. They might try to scrape the page's HTML, simulate clicks, or take screenshots – all brittle and slow. WebMCP gives web developers a way to expose the page's own JavaScript functions as clean, structured "tools" that an AI agent can directly invoke. This lets agents perform tasks like filtering products, editing designs, or checking build statuses without fighting the UI. It also keeps the human in control: the user sees the same page, and the agent works through the page's own code.

How it works

Web developers register tools using the document.modelContext.registerTool() API. Each tool has a name, a description, an input schema (like a form that specifies what arguments are allowed), and an execute function that runs when the agent calls it. The page's JavaScript does the actual work, updates the visible interface, and returns structured results to the agent. Agents can discover the list of available tools at any time through the browser. Tools can be registered or unregistered dynamically, so pages can show only what's relevant to the current state. The API works in top-level pages and, with permission, inside iframes using the allow="tools" attribute. WebMCP is designed to complement backend integrations like MCP, not replace them.

Who it's for

Web developers who want to make their sites easier for AI agents to use, and AI agents (especially those built into browsers, extensions, or iframes) that need to act on web content. It's also relevant for assistive technology users, because agents can act as intermediaries. WebMCP is meant for human-in-the-loop scenarios – a user and an agent working together on the same page – not for fully autonomous bots with no browser UI.

Highlights

  • Exposes client-side JavaScript functions as structured tools for AI agents
  • Reuses existing page code, keeping the visible UI in sync automatically
  • Works alongside backend MCP and OpenAPI integrations, not instead of them
  • Supports dynamic tool registration to avoid overwhelming the agent
  • Enables collaborative, user-controlled workflows on live pages
  • Secures iframe usage with a Permissions Policy

Related

  • Project
  • Project
  • Project
  • Project
  • Project