SEO私馆

原创知识、有效实用、促进思考、学习交流

WebMCP可以让网站具有AI智能体的代理标准

现在的生成式AI搜索引擎已经可以给用户提供平台及站内的订阅、下载等其他功能性的操作体验,这意味网站要改造成智能体是已经成为必要的运营措施,因为关系到GEO有效性及AI可见性的代理结果,那么WebMCP就是个不错的技术方案,而且是由谷歌和微软共同推出的通用草案。

网站如何添加WebMCP?

声明式:
<form toolname="supportRequestTool"
  tooldescription="Submit a request for support."
  action="/submit">
  <label for="firstName">First Name</label>
  <input type=text name=firstName>
  <label for="lastName">Last Name</label>
  <input type=text name=lastName>
  <select name="select" required 
    toolparamdescription="Determines what team this request is routed to.">
    <option value="Customer happiness team">Return my purchase.</option>
    <option value="Distribution team">Check where my package is.</option>
    <option value="Website support team">Get help on the website.</option>
  </select>
  <button type=submit>Submit</button>
</form>

声明式是直接在前端代码标签中添加WebMCP工具集的属性及元素,这是最简单容易的方式,适用于博客、官网等轻量化的网站。

命令式:
document.modelContext.registerTool({
  name: 'toggle_layer',
  description: 'Control pizza layers (sauce, cheese). Use "add", "remove", or "toggle".',
  inputSchema: {
    type: 'object',
    properties: {
      layer: { type: 'string', enum: ['sauce-layer', 'cheese-layer'] },
      action: { type: 'string', enum: ['add', 'remove', 'toggle'] },
    },
    required: ['layer'],
  },
  execute: async ({ layer, action }) => {
    await toggleLayer(layer, action);
    return `Performed ${action || 'toggle'} on layer: ${layer}`;
  },
});

命令式也有前端的avaScript代码中添加WebMCP工具集的参数及语法,采用的是API模式,适合功能性交互类型的网站。

结语:WebMCP是大势已定的技术方案,也是改造网站成为智能体的简易方法,甚至是适配AI浏览器的优先选择项,所以GEO的营销及应用会涉及到网站否使用了WebMCP,这其实就是适配AI代理的标准。