WebMCP: How to make websites easily usable for AI agents

Google’s new WebMCP standard enables AI agents to navigate websites in a structured and efficient manner – without detours via screenshots or vision models. As an open web standard, this protocol has the potential to fundamentally improve interaction between AI and modern web applications.

WebMCP: Technical basis and open architecture

WebMCP – Web Model Context Protocol – is a standard proposal developed by the W3C Community Group, initiated by Google and Microsoft engineers. It aims to enable websites to act as MCP servers by providing JavaScript-based tools locally in the browser. Important: WebMCP is model-agnostic and works with AI systems such as ChatGPT, Gemini, Claude, and open-source models.

Declarative and Imperative APIs: Two Ways to Integrate AI

WebMCP offers developers two methods: The declarative API uses HTML attributes (e.g., toolname in forms) for standardized actions. For more complex workflows, there is the imperative API with JavaScript (navigator.modelContext.registerTool()). This allows existing business logic to be used directly without having to restructure entire web applications.

Performance boost through structured data

By interacting via structured JSON schemas instead of visual analysis, AI agents achieve an error rate of nearly 0% and increase task accuracy to approximately 98%. At the same time, computing effort and latency are reduced by approximately 67% because no image data needs to be transferred or analyzed.

Security and human-in-the-loop control

The permission-first security approach ensures that all tool calls from AI agents run through the browser. Site users retain control by monitoring agent actions and granting approvals when necessary (agent.requestUserInteraction()). Tools cannot be triggered in parallel on a massive scale; all important AI interactions remain traceable and consent-based.

Hands-on: How to use WebMCP as a developer

  • Step 1: Implement a JavaScript-based tool with natural language explanation and schema in the browser. E.g., a function for reading a form or searching for products in the shop frontend.
  • Step 2: Register the tool as an MCP tool via navigator.modelContext.registerTool(). Store the JSON schema and descriptive prompt.
  • Step 3: Optional integration with HTML attributes (declarative API) for simpler standard interactions, such as the checkout flow in an e-commerce form.
  • Step 4: After registration, AI agents (e.g., ChatGPT in supported browsers) can control tools in a structured manner; human control and interaction are retained.

Summary / TL;DR

  • Open standard: WebMCP is jointly promoted by Google, Microsoft, and W3C.
  • Two APIs: Declarative (HTML) and imperative (JavaScript) methods for tool integration.
  • Significant efficiency gains: Fewer errors, 67% less computing power required, almost no latency overhead.
  • Secure and transparent: Permission management and human-in-the-loop embedded in the design.
  • Practical and versatile: Can be used in customer support, e-commerce, travel, and more.

Source: Codely