Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

WebMCP: Make Your Site Callable by AI Agents (With Working Code)

说明与用途

WebMCP 让网页公开可被 AI 代理直接调用的类型化工具,消除了猜测 DOM 元素的需求。

问题

AI agents currently interact with web pages by guessing DOM elements, leading to fragile and error‑prone automation.

结果

WebMCP enables precise, typed interactions between AI agents and web pages, reducing fragility and improving reliability.

工作流

  • 1. Include WebMCP script in the page.
  • 2. Obtain document.modelContext (or navigator.modelContext for older previews).
  • 3. Call registerTool with name, description, inputSchema, annotations, and execute function.
  • 4. Agent calls executeTool with appropriate arguments.
  • 5. Tool performs server request or DOM manipulation and returns result.

证据

WebMCP is a proposal to skip the guessing. Your page tells the browser: "here are the actions I support, here's the JSON Schema for each one, call this function."

来源

Chrome's team announced an early preview in February 2026, the spec is being developed at the W3C with Microsoft involved, and Chrome's docs were last updated in May 2026.

来源

From Chrome's imperative API docs, document.modelContext gives you: registerTool(tool, options?)

来源

  • 记录日期: 2026-10-20T06:41:31.239Z