{
    "version": "https://jsonfeed.org/version/1.1",
    "title": "SEO私馆",
    "home_page_url": "https://www.seosiguan.com/",
    "feed_url": "https://www.seosiguan.com/post/2398.json",
    "language": "zh-Hans",
    "items": [
        {
            "id": "https://www.seosiguan.com/post/2398.html",
            "url": "https://www.seosiguan.com/post/2398.html",
            "title": "WebMCP优化网站的技术方法",
            "content_html": "<p>WebMCP（Web模型上下文协议）正在成为AI识别理解网站的主要策略，很快会成为AI控制网站的标准接口协议，这意味着GEO就需要WebMCP的技术方案，大家有必要掌握这项专门的技术，让能力贴近AI场景。</p><h2>网站如何使用WebMCP？</h2><p><strong>方法一：引入式</strong></p><pre>&lt;script&nbsp;type=&quot;module&quot;&nbsp;src=&quot;https://example.com/webmcp.js&quot;&nbsp;data-mcp-url=&quot;https://example.com/mcp/&quot;&gt;&lt;/script&gt;</pre><p>访问时直接读取MCP服务端的工具，所以这个方法是需要后端有对应服务支持，如：webmcp.js是支持库，data-mcp-url指向的是MCP服务端地址。</p><p><strong>方法二：命令式</strong></p><pre>navigator.modelContext.registerTool({\r\n&nbsp;&nbsp;name:&nbsp;&#39;searchProducts&#39;,\r\n&nbsp;&nbsp;description:&nbsp;&#39;按关键词搜索信息&#39;,\r\n&nbsp;&nbsp;parameters:&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;type:&nbsp;&#39;object&#39;,\r\n&nbsp;&nbsp;&nbsp;&nbsp;properties:&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keyword:&nbsp;{&nbsp;type:&nbsp;&#39;string&#39;,&nbsp;description:&nbsp;&#39;搜索关键词&#39;&nbsp;}\r\n&nbsp;&nbsp;&nbsp;&nbsp;},\r\n&nbsp;&nbsp;&nbsp;&nbsp;required:&nbsp;[&#39;keyword&#39;]\r\n&nbsp;&nbsp;},\r\n&nbsp;&nbsp;handler:&nbsp;async&nbsp;({&nbsp;keyword&nbsp;})&nbsp;=&gt;&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;const&nbsp;results&nbsp;=&nbsp;await&nbsp;fetch(`/api/search?q=${keyword}`).then(r&nbsp;=&gt;&nbsp;r.json());\r\n&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;{&nbsp;results&nbsp;};\r\n&nbsp;&nbsp;}});</pre><p>使用<code>navigator.modelContext</code>接口（Chrome浏览器或是Chromium内核的146版以上），这是jquery代码样式。</p><p><strong>方法三：声明式</strong></p><pre>&lt;form&nbsp;method=&quot;modelcontext&quot;&gt;\r\n&nbsp;&nbsp;&lt;input&nbsp;type=&quot;text&quot;&nbsp;name=&quot;query&quot;&nbsp;toolname=&quot;search&quot;&nbsp;/&gt;\r\n&nbsp;&nbsp;&lt;button&nbsp;type=&quot;submit&quot;&gt;搜索&lt;/button&gt;&lt;/form&gt;</pre><p>这是在前端代码的标签中添加WebMCP指定的特殊属性，可以让AI-Agent直接调用函数控制。</p><p><strong>仔细检查并且完善安全性。</strong></p><p>这是个至关重要的问题，由于是对外放权由AI操控，这难免会存在风险，但是如果能够完善安全限制，控制权限的范畴，那么就可以放心了，而且可以根据网站的性质，选择合适的方法，举例：引入式可以用于功能网站、命令式可以用于简易表单提交的网站、声明式可以用于常规的标准网站。</p><p><strong>结语：</strong>不要重复或是叠加使用不同的WebMCP技术方法，会造成AI的错误以及混乱，甚至会导致破坏性，这就很不利于网站的GEO了，具体还需针对性的执行操作。</p>",
            "content_text": "WebMCP（Web模型上下文协议）正在成为AI识别理解网站的主要策略，很快会成为AI控制网站的标准接口协议，这意味着GEO就需要WebMCP的技术方案，大家有必要掌握这项专门的技术，让能力贴近AI场景。网站如何使用WebMCP？方法一：引入式<script type=\"module\" src=\"https://example.com/webmcp.js\" data-mcp-url=\"https://example.com/mcp/\"></script>访问时直接读取MCP服务端的工具，所以这个方法是需要后端有对应服务支持，如：webmcp.js是支持库，data-mcp-url指向的是MCP服务端地址。方法二：命令式navigator.modelContext.registerTool({ name: 'searchProducts', description: '按关键词搜索信息', parameters: { type: 'object', properties: { keyword: { type: 'string', description: '搜索关键词' } }, required: ['keyword'] }, handler: async ({ keyword }) => { const results = await fetch(`/api/search?q=${keyword}`).then(r => r.json()); return { results }; }});使用navigator.modelContext接口（Chrome浏览器或是Chromium内核的146版以上），这是jquery代码样式。方法三：声明式<form method=\"modelcontext\"> <input type=\"text\" name=\"query\" toolname=\"search\" /> <button type=\"submit\">搜索</button></form>这是在前端代码的标签中添加WebMCP指定的特殊属性，可以让AI-Agent直接调用函数控制。仔细检查并且完善安全性。这是个至关重要的问题，由于是对外放权由AI操控，这难免会存在风险，但是如果能够完善安全限制，控制权限的范畴，那么就可以放心了，而且可以根据网站的性质，选择合适的方法，举例：引入式可以用于功能网站、命令式可以用于简易表单提交的网站、声明式可以用于常规的标准网站。结语：不要重复或是叠加使用不同的WebMCP技术方法，会造成AI的错误以及混乱，甚至会导致破坏性，这就很不利于网站的GEO了，具体还需针对性的执行操作。",
            "date_published": "2026-04-30T18:52:14+00:00",
            "date_modified": "2026-04-30T19:19:58+00:00",
            "summary": "WebMCP（Web模型上下文协议）正在成为AI识别理解网站的主要策略，很快会成为AI控制网站的标准接口协议，这意味着GEO就需要WebMCP的技术方案，大家有必要掌握这项专门的技术，让能力贴近AI场景。网站如何使用WebMCP？方法一：引入式<script type=\"module\" src=\"https://example.com/webmcp.js\" data-mcp-url=\"https://example.com/mcp/\"></script>"
        }
    ]
}