{"id":10020718,"date":"2025-04-11T23:39:08","date_gmt":"2025-04-11T15:39:08","guid":{"rendered":"https:\/\/itmax.cn\/?p=10020718"},"modified":"2025-04-11T23:39:08","modified_gmt":"2025-04-11T15:39:08","slug":"%e4%b8%80%e6%96%87%e6%8e%8c%e6%8f%a1-mcp-%e4%b8%8a%e4%b8%8b%e6%96%87%e5%8d%8f%e8%ae%ae%ef%bc%9a%e4%bb%8e%e7%90%86%e8%ae%ba%e5%88%b0%e5%ae%9e%e8%b7%b5","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10020718","title":{"rendered":"\u4e00\u6587\u638c\u63e1 MCP \u4e0a\u4e0b\u6587\u534f\u8bae\uff1a\u4ece\u7406\u8bba\u5230\u5b9e\u8df5"},"content":{"rendered":"<blockquote>\n<p>\u4f5c\u8005\uff1a\u9648\u660e\u52c7<\/p>\n<p>\u4e2a\u4eba\u7f51\u7ad9\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=o6pukRJFxXryi0AvEEg5LA%3D%3D.QqiKde8%2FHbQHPYBlK81Rc03g%2Bn0rxA1Z2xhdl%2BmXiHo%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">https:\/\/chenmingyong.cn<\/a><\/p>\n<p>\u6587\u7ae0\u6301\u7eed\u66f4\u65b0\uff0c\u5982\u679c\u672c\u6587\u80fd\u8ba9\u60a8\u6709\u6240\u6536\u83b7\uff0c\u6b22\u8fce\u5173\u6ce8\u672c\u53f7\u3002<\/p>\n<p>\u5fae\u4fe1\u9605\u8bfb\u53ef\u641c\u300a\u7a0b\u5e8f\u5458\u9648\u660e\u52c7\u300b\u3002<\/p>\n<\/blockquote>\n<blockquote>\n<p>\u8be5\u6587\u7ae0\u5df2\u88ab\u00a0<a href=\"https:\/\/link.segmentfault.com\/?enc=j61nTQ0m47bw%2BiPCGb1T9Q%3D%3D.ha3H8PdzJBsarqIZ7G0MJiUfezTaBpKNUyZUsbZT3mzf7eaxt7Ive1cAxLRozk2TRztj%2FtKKXilD5ZTAU1JilA%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">Model Context Protocol(MCP) \u4e2d\u6587\u6559\u7a0b\u8bb2\u89e3<\/a>\u00a0\u6536\u5f55\uff0c\u6b22\u8fce <strong>star<\/strong> \u6536\u85cf\u3002<\/p>\n<p>\u82e5\u60f3\u83b7\u53d6\u672c\u6587\u6d89\u53ca\u5230\u7684\u5b8c\u6574\u4ee3\u7801\uff0c\u53ef\u5173\u6ce8\u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u9648\u660e\u52c7\uff0c\u56de\u590d MCP\u3002<\/p>\n<\/blockquote>\n<h2>MCP<\/h2>\n<p>\u200b\u6a21\u578b\u4e0a\u4e0b\u6587\u534f\u8bae\uff08<code>Model Context Protocol<\/code>\uff0c\u7b80\u79f0\u00a0<code>MCP<\/code>\uff09\u662f\u4e00\u79cd\u5f00\u653e\u6807\u51c6\uff0c\u65e8\u5728\u6807\u51c6\u5316\u5927\u578b\u8bed\u8a00\u6a21\u578b\uff08<code>LLM<\/code>\uff09\u4e0e\u5916\u90e8\u6570\u636e\u6e90\u548c\u5de5\u5177\u4e4b\u95f4\u7684\u4ea4\u4e92\u65b9\u5f0f\u3002\u200b\u7531\u00a0<code>Anthropic<\/code>\u00a0\u4e8e\u00a0<strong>2024<\/strong>\u00a0\u5e74\u00a0<strong>11<\/strong>\u00a0\u6708\u63a8\u51fa\uff0c<code>MCP<\/code>\u00a0\u901a\u8fc7\u5b9a\u4e49\u7edf\u4e00\u7684\u63a5\u53e3\uff0c\u4f7f\u00a0<code>AI<\/code>\u00a0\u5e94\u7528\u80fd\u591f\u5b89\u5168\u3001\u7075\u6d3b\u5730\u8bbf\u95ee\u548c\u64cd\u4f5c\u672c\u5730\u53ca\u8fdc\u7a0b\u6570\u636e\u8d44\u6e90\uff0c\u63d0\u5347\u6a21\u578b\u7684\u529f\u80fd\u6027\u548c\u53ef\u6269\u5c55\u6027\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"498\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdiUxT\" alt=\"\" title=\"\"><\/p>\n<h2>Transports\uff08\u4f20\u8f93\u5c42\uff09<\/h2>\n<p>\u5728\u00a0<code>MCP<\/code>\u00a0\u534f\u8bae\u4e2d\uff0c\u4f20\u8f93\u5c42\u63d0\u4f9b\u4e86\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u901a\u4fe1\u7684\u57fa\u7840\uff0c\u5176\u8d1f\u8d23\u5904\u7406\u6d88\u606f\u7684\u53d1\u9001\u4e0e\u63a5\u6536\u7684\u5e95\u5c42\u673a\u5236\u3002<\/p>\n<h3>\u6d88\u606f\u683c\u5f0f<\/h3>\n<p><code>MCP<\/code>\u00a0\u534f\u8bae\u4f7f\u7528\u00a0<code>JSON-RPC 2.0<\/code>\u00a0\u4f5c\u4e3a\u6d88\u606f\u4f20\u8f93\u683c\u5f0f\uff0c\u5305\u542b\u4ee5\u4e0b\u4e09\u79cd\u7c7b\u578b\u7684\u00a0<code>JSON-RPC<\/code>\u00a0\u6d88\u606f\uff1a<\/p>\n<ul>\n<li>\n<p><code>Request<\/code>\u00a0\u8bf7\u6c42\uff1a<\/p>\n<pre><code class=\"json\">{\n  &quot;jsonrpc&quot;: &quot;2.0&quot;,\n  &quot;id&quot;: 1,                            \/\/ \u8bf7\u6c42 ID\uff08\u6570\u5b57\u6216\u5b57\u7b26\u4e32\uff09\n  &quot;method&quot;: &quot;string&quot;,                 \/\/ \u65b9\u6cd5\u540d\n  &quot;params&quot;: {}                        \/\/ \u53ef\u9009\uff0c\u53c2\u6570\u5bf9\u8c61\n}<\/code><\/pre>\n<\/li>\n<li>\n<p><code>Response<\/code>\u00a0\u54cd\u5e94\uff1a<\/p>\n<pre><code class=\"json\">{\n  &quot;jsonrpc&quot;: &quot;2.0&quot;,\n  &quot;id&quot;: 1,                            \/\/ \u5bf9\u5e94\u8bf7\u6c42\u7684 ID\n  &quot;result&quot;: {},                       \/\/ \u53ef\u9009\uff0c\u6210\u529f\u7ed3\u679c\n  &quot;error&quot;: {                          \/\/ \u53ef\u9009\uff0c\u9519\u8bef\u4fe1\u606f\n    &quot;code&quot;: 123,\n    &quot;message&quot;: &quot;\u9519\u8bef\u63cf\u8ff0&quot;,\n    &quot;data&quot;: {}                        \/\/ \u53ef\u9009\uff0c\u9644\u52a0\u6570\u636e\n  }\n}<\/code><\/pre>\n<\/li>\n<li>\n<p><code>Notification<\/code>\u901a\u77e5\uff1a<\/p>\n<pre><code class=\"json\">{\n  &quot;jsonrpc&quot;: &quot;2.0&quot;,\n  &quot;method&quot;: &quot;string&quot;,                 \/\/ \u901a\u77e5\u65b9\u6cd5\u540d\n  &quot;params&quot;: {}                        \/\/ \u53ef\u9009\uff0c\u53c2\u6570\u5bf9\u8c61\n}<\/code><\/pre>\n<\/li>\n<\/ul>\n<h3>\u5185\u7f6e\u4f20\u8f93\u7c7b\u578b<\/h3>\n<p><code>MCP<\/code>\u00a0\u534f\u8bae\u5185\u7f6e\u4e86\u4e24\u79cd\u6807\u51c6\u4f20\u8f93\u65b9\u5f0f\uff1a<strong>\u6807\u51c6\u8f93\u5165\/\u8f93\u51fa\uff08stdio)<\/strong> \u548c\u00a0<strong>Server-Sent\u00a0Events(SSE)<\/strong> \u3002<\/p>\n<h4>\u6807\u51c6\u8f93\u5165\/\u8f93\u51fa\uff08stdio\uff09<\/h4>\n<p><code>stdio<\/code>\u00a0\u4f20\u8f93\u901a\u8fc7\u00a0<strong>\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u6d41<\/strong>\u00a0\u5b9e\u73b0\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u4e4b\u95f4\u7684\u901a\u4fe1\uff0c\u9002\u7528\u4e8e\u672c\u5730\u96c6\u6210\u4e0e\u547d\u4ee4\u884c\u5de5\u5177\u3002<\/p>\n<p>\u63a8\u8350\u5728\u4ee5\u4e0b\u573a\u666f\u4f7f\u7528\u00a0<code>stdio<\/code>\uff1a<\/p>\n<ul>\n<li>\u6784\u5efa\u547d\u4ee4\u884c\u5de5\u5177<\/li>\n<li>\u672c\u5730\u7cfb\u7edf\u96c6\u6210<\/li>\n<li>\u7b80\u5355\u8fdb\u7a0b\u95f4\u901a\u4fe1<\/li>\n<li>\u4e0e\u00a0<code>shell<\/code>\u00a0\u811a\u672c\u534f\u4f5c<\/li>\n<\/ul>\n<p><code>Go server<\/code>\u00a0\u793a\u4f8b\uff1a<\/p>\n<pre><code class=\"go\">s := server.NewMCPServer(\n    &quot;My Server&quot;, \/\/ Server name\n    &quot;1.0.0&quot;,     \/\/ Version\n)\n\nif err := server.ServeStdio(s); err != nil {\n    log.Fatalf(&quot;Server error: %v&quot;, err)\n}<\/code><\/pre>\n<h4><strong>Server-Sent\u00a0Events\u00a0(SSE)<\/strong><\/h4>\n<p><code>SSE<\/code> <strong>\u4f20\u8f93<\/strong>\u00a0\u901a\u8fc7\u00a0<code>HTTP\u00a0POST<\/code>\u00a0\u8bf7\u6c42\u5b9e\u73b0\u00a0<strong>\u5ba2\u6237\u7aef\u5230\u670d\u52a1\u5668\u901a\u4fe1<\/strong>\uff0c\u540c\u65f6\u652f\u6301\u00a0<strong>\u670d\u52a1\u5668\u5230\u5ba2\u6237\u7aef\u6d41\u5f0f\u4f20\u8f93<\/strong> \u3002<\/p>\n<p>\u63a8\u8350\u5728\u4ee5\u4e0b\u573a\u666f\u4f7f\u7528\u00a0<code>SSE<\/code>\uff1a<\/p>\n<ul>\n<li>\u4ec5\u9700\u8981\u670d\u52a1\u5668\u5230\u5ba2\u6237\u7aef\u7684\u6d41\u5f0f\u901a\u4fe1<\/li>\n<li>\u8fd0\u884c\u5728\u53d7\u9650\u7f51\u7edc\u73af\u5883<\/li>\n<li>\u5b9e\u73b0\u7b80\u5355\u7684\u63a8\u9001\u66f4\u65b0<\/li>\n<\/ul>\n<p><code>Go server<\/code>\u00a0\u793a\u4f8b\uff1a<\/p>\n<pre><code class=\"go\">s := server.NewMCPServer(\n    &quot;My Server&quot;, \/\/ Server name\n    &quot;1.0.0&quot;,     \/\/ Version\n)\n\nsseServer := server.NewSSEServer(s)\nerr := sseServer.Start(&quot;:8080&quot;)\nif err != nil {\n    panic(err)\n}<\/code><\/pre>\n<h2>MCP \u7684\u901a\u7528\u67b6\u6784<\/h2>\n<p><code>MCP<\/code>\u00a0\u9075\u5faa\u00a0<code>CS<\/code>\u00a0\u67b6\u6784\uff08<code>client-server<\/code>\uff09\uff0c\u5177\u4f53\u5305\u542b\u7684\u7ec4\u4ef6\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li><code>Host<\/code>\u00a0\u4e3b\u673a\uff1a\u53d1\u8d77\u8fde\u63a5\u00a0<code>LLM<\/code>\u00a0\u7684\u5e94\u7528\u7a0b\u5e8f\uff0c\u4f8b\u5982\u00a0<code>Claude for Desktop<\/code>\u00a0\u6216\u5176\u4ed6\u7684\u00a0<code>AI<\/code>\u00a0\u5e94\u7528\u3002<\/li>\n<li><code>MCP Client<\/code>\u00a0\u5ba2\u6237\u7aef\uff1a\u8fd0\u884c\u5728\u4e3b\u673a\u91cc\u7684\u5ba2\u6237\u7aef\uff0c\u4e0e\u00a0<code>MCP Server<\/code>\u00a0\u670d\u52a1\u5668\u4fdd\u6301\u00a0<strong>1:1<\/strong>\u00a0\u8fde\u63a5\uff0c\u8d1f\u8d23\u534f\u8bae\u901a\u4fe1\u3002<\/li>\n<li><code>MCP Server<\/code>\u00a0\u670d\u52a1\u5668\uff1a\u8d1f\u8d23\u5411\u5ba2\u6237\u7aef\u63d0\u4f9b\u00a0<strong>\u8d44\u6e90<\/strong>\u3001<strong>\u63d0\u793a<\/strong>\u00a0\u548c\u00a0<strong>\u5de5\u5177<\/strong> \u7684\u670d\u52a1\u5668\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" width=\"721\" height=\"392\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdiUxU\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<h2>MCP \u5ba2\u6237\u7aef<\/h2>\n<p>\u5ba2\u6237\u7aef\u53ef\u4ee5\u5b9e\u73b0\u989d\u5916\u7684\u529f\u80fd\u6765\u4e0e\u00a0<code>MCP<\/code>\u00a0\u670d\u52a1\u5668\u8fdb\u884c\u4ea4\u4e92\u3002<\/p>\n<h3>Roots \u6839<\/h3>\n<p><code>Roots<\/code>\u00a0\u662f<code>MCP<\/code>\u00a0\u534f\u8bae\u4e2d\u7684\u4e00\u4e2a\u6982\u5ff5\uff0c\u7528\u4e8e\u754c\u5b9a\u670d\u52a1\u5668\u53ef\u64cd\u4f5c\u7684\u8fb9\u754c\u3002\u5ba2\u6237\u7aef\u53ef\u4ee5\u5b9a\u4e49\u00a0<code>Roots<\/code>\uff0c\u4ee5\u544a\u77e5\u670d\u52a1\u5668\u76f8\u5173\u7684\u8d44\u6e90\u4fe1\u606f\u53ca\u5176\u4f4d\u7f6e\u3002<\/p>\n<p><code>root<\/code>\u00a0\u662f\u5ba2\u6237\u7aef\u5efa\u8bae\u670d\u52a1\u5668\u5e94\u5173\u6ce8\u7684\u00a0<code>URI<\/code>\u3002\u5f53\u00a0<strong>\u5ba2\u6237\u7aef<\/strong> \u8fde\u63a5\u5230\u670d\u52a1\u5668\u65f6\uff0c\u5b83\u4f1a\u58f0\u660e <strong>\u670d\u52a1\u5668<\/strong> \u5e94\u5904\u7406\u54ea\u4e9b\u00a0<code>root<\/code>\u3002\u867d\u7136\u8fd9\u4e9b\u00a0<code>root<\/code>\u00a0\u4e3b\u8981\u662f\u6587\u4ef6\u7cfb\u7edf\u8def\u5f84\uff0c\u4f46\u00a0<code>root<\/code>\u00a0\u4e5f\u53ef\u4ee5\u662f\u00a0<code>HTTP URL<\/code>\u3002<\/p>\n<pre><code class=\"txt\"># \u6587\u4ef6\u7cfb\u7edf\u8def\u5f84\nfile:\/\/\/home\/chenmingyong\/workspace\n# HTTP URL\nhttps:\/\/chenmingyong.cn\/<\/code><\/pre>\n<h4>\u529f\u80fd<\/h4>\n<p><code>Roots<\/code>\u00a0\u6709\u4ee5\u4e0b\u51e0\u4e2a\u529f\u80fd\uff1a<\/p>\n<ul>\n<li>\u5f15\u5bfc\uff1a\u6307\u793a\u670d\u52a1\u5668\u76f8\u5173\u8d44\u6e90\u53ca\u5176\u4f4d\u7f6e\u3002<\/li>\n<li>\u660e\u786e\u5f52\u5c5e\uff1a\u6e05\u695a\u6807\u8bc6\u54ea\u4e9b\u8d44\u6e90\u5c5e\u4e8e\u5f53\u524d\u5de5\u4f5c\u533a\u3002<\/li>\n<li>\u4fbf\u4e8e\u7ba1\u7406\uff1a\u652f\u6301\u540c\u65f6\u5904\u7406\u591a\u4e2a\u4e0d\u540c\u7684\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<h4>\u5de5\u4f5c\u673a\u5236<\/h4>\n<p>\u5f53\u5ba2\u6237\u7aef\u5177\u5907\u00a0<code>Roots<\/code>\u00a0\u529f\u80fd\u65f6\uff0c\u901a\u5e38\u4f1a\uff1a<\/p>\n<ul>\n<li>\u5728\u8fde\u63a5\u670d\u52a1\u5668\u65f6\u58f0\u660e\u81ea\u8eab\u7684\u00a0<code>Roots<\/code>\u00a0\u652f\u6301\u80fd\u529b<\/li>\n<li>\u5411\u670d\u52a1\u5668\u53d1\u9001\u5efa\u8bae\u7684\u00a0<code>Roots<\/code>\u00a0\u5217\u8868<\/li>\n<li>\u5728\u00a0<code>Roots<\/code>\u00a0\u53d1\u751f\u53d8\u66f4\u65f6\uff08\u82e5\u534f\u8bae\u652f\u6301\uff09\u4e3b\u52a8\u901a\u77e5\u670d\u52a1\u5668<\/li>\n<\/ul>\n<h4>\u793a\u4f8b<\/h4>\n<pre><code class=\"json\">{\n  &quot;roots&quot;: [\n    {\n      &quot;uri&quot;: &quot;file:\/\/\/home\/chenmingyong\/workspace\/frontend&quot;,\n      &quot;name&quot;: &quot;Frontend Repository&quot;\n    },\n    {\n      &quot;uri&quot;: &quot;https:\/\/chenmingyong.cn\/&quot;,\n      &quot;name&quot;: &quot;API Endpoint&quot;\n    }\n  ]\n}<\/code><\/pre>\n<h3>Sampling \u91c7\u6837<\/h3>\n<p>\u91c7\u6837\u662f\u00a0<code>MCP<\/code>\u00a0\u534f\u8bae\u4e2d\u4e00\u9879\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u5141\u8bb8\u670d\u52a1\u5668\u901a\u8fc7\u5ba2\u6237\u7aef\u5411\u00a0<code>LLM<\/code>\u00a0\u5927\u6a21\u578b\u8bf7\u6c42\u8865\u5168\u7ed3\u679c\uff0c\u4ece\u800c\u5b9e\u73b0\u66f4\u590d\u6742\u7684\u4ee3\u7406\u884c\u4e3a\uff0c\u540c\u65f6\u786e\u4fdd\u5b89\u5168\u6027\u4e0e\u9690\u79c1\u6027\u3002<\/p>\n<h4>\u5de5\u4f5c\u539f\u7406<\/h4>\n<p>\u91c7\u6837\u6d41\u7a0b\u9075\u5faa\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<ul>\n<li><strong>\u670d\u52a1\u5668\u53d1\u9001\u8bf7\u6c42<\/strong>\uff1a\u670d\u52a1\u5668\u5411\u5ba2\u6237\u7aef\u53d1\u9001\u00a0<code>sampling\/createMessage<\/code>\u00a0\u8bf7\u6c42\u3002<\/li>\n<li><strong>\u5ba2\u6237\u7aef\u5ba1\u6838\u8bf7\u6c42<\/strong>\uff1a\u5ba2\u6237\u7aef\u6536\u5230\u8bf7\u6c42\u540e\u53ef\u4ee5\u5bf9\u5176\u5ba1\u67e5\u548c\u4fee\u6539\u3002<\/li>\n<li><strong>\u5ba2\u6237\u7aef\u53d1\u8d77\u91c7\u6837<\/strong>\uff1a\u5ba2\u6237\u7aef\u5411\u00a0<code>LLM<\/code>\u00a0\u53d1\u9001\u91c7\u6837\u8bf7\u6c42\u3002<\/li>\n<li><strong>\u5ba2\u6237\u7aef\u5ba1\u6838\u7ed3\u679c<\/strong>\uff1a\u5ba2\u6237\u7aef\u5ba1\u6838\u00a0<code>LLM<\/code>\u00a0\u8fd4\u56de\u7684\u8865\u5168\u5185\u5bb9\u3002<\/li>\n<li><strong>\u5ba2\u6237\u7aef\u8fd4\u56de\u7ed3\u679c<\/strong>\uff1a\u5ba2\u6237\u7aef\u5c06\u6700\u7ec8\u7ed3\u679c\u53d1\u9001\u56de\u670d\u52a1\u5668\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" width=\"723\" height=\"492\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/bVdiUxV\" alt=\"\" title=\"\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u79cd\u00a0<strong>\u4eba\u673a\u534f\u4f5c\uff08Human-in-the-loop\uff09<\/strong>\u00a0\u8bbe\u8ba1\uff0c\u786e\u4fdd\u7528\u6237\u80fd\u63a7\u5236\u00a0<code>LLM<\/code>\u00a0\u770b\u5230\u7684\u5185\u5bb9\u4ee5\u53ca\u751f\u6210\u7684\u7ed3\u679c\uff0c\u517c\u987e\u81ea\u52a8\u5316\u4e0e\u5b89\u5168\u6027\u3002<\/p>\n<h4>\u6d88\u606f\u683c\u5f0f<\/h4>\n<p>\u91c7\u6837\u8bf7\u6c42\u4f7f\u7528\u540c\u4e00\u7684\u6d88\u606f\u7ed3\u6784\uff0c\u793a\u4f8b\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"json\">{\n  &quot;messages&quot;: [\n    {\n      &quot;role&quot;: &quot;user&quot; | &quot;assistant&quot;,            \/\/ \u6d88\u606f\u89d2\u8272\n      &quot;content&quot;: {\n        &quot;type&quot;: &quot;text&quot; | &quot;image&quot;,              \/\/ \u5185\u5bb9\u7c7b\u578b\n\n        \/\/ \u6587\u672c\u5185\u5bb9\n        &quot;text&quot;: &quot;string&quot;,\n\n        \/\/ \u56fe\u7247\u5185\u5bb9\n        &quot;data&quot;: &quot;string&quot;,                      \/\/ Base64 \u7f16\u7801\n        &quot;mimeType&quot;: &quot;string&quot;                   \/\/ MIME \u7c7b\u578b\n\n      }\n\n    }\n  ],\n  &quot;modelPreferences&quot;: {                        \/\/ \u53ef\u9009\uff0c\u6a21\u578b\u504f\u597d\u8bbe\u7f6e\n    &quot;hints&quot;: [                                 \/\/ \u6a21\u578b\u63d0\u793a\n      {\n        &quot;name&quot;: &quot;string&quot;                       \/\/ \u5efa\u8bae\u7684\u6a21\u578b\u540d\u79f0\n\n      }\n    ],\n    &quot;costPriority&quot;: 0.0,                       \/\/ \u964d\u4f4e\u6210\u672c\u7684\u4f18\u5148\u7ea7 (0-1)\n    &quot;speedPriority&quot;: 0.0,                      \/\/ \u4f4e\u5ef6\u8fdf\u7684\u4f18\u5148\u7ea7 (0-1)\n    &quot;intelligencePriority&quot;: 0.0                \/\/ \u6a21\u578b\u80fd\u529b\u7684\u4f18\u5148\u7ea7 (0-1)\n  },\n  &quot;systemPrompt&quot;: &quot;string&quot;,                    \/\/ \u53ef\u9009\uff0c\u7cfb\u7edf\u63d0\u793a\u8bcd\n\n  &quot;includeContext&quot;: &quot;none&quot; | &quot;thisServer&quot; | &quot;allServers&quot;,  \/\/ \u4e0a\u4e0b\u6587\u5305\u542b\u8303\u56f4\n  &quot;temperature&quot;: 0.0,                          \/\/ \u968f\u673a\u6027\u63a7\u5236\n  &quot;maxTokens&quot;: 100,                            \/\/ \u6700\u5927\u751f\u6210 Token \u6570\n\n  &quot;stopSequences&quot;: [&quot;string&quot;],                 \/\/ \u505c\u6b62\u5e8f\u5217\n  &quot;metadata&quot;: {}                               \/\/ \u5176\u4ed6\u5143\u6570\u636e\n}<\/code><\/pre>\n<h4>\u54cd\u5e94\u683c\u5f0f<\/h4>\n<p>\u5ba2\u6237\u7aef\u8fd4\u56de\u91c7\u6837\u7ed3\u679c\u7684\u7ed3\u6784\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"json\">{\n  &quot;model&quot;: &quot;string&quot;,                      \/\/ \u4f7f\u7528\u7684\u6a21\u578b\u540d\u79f0\n  &quot;stopReason&quot;: &quot;endTurn&quot; | &quot;stopSequence&quot; | &quot;maxTokens&quot; | &quot;string&quot;,  \/\/ \u505c\u6b62\u539f\u56e0\n\n  &quot;role&quot;: &quot;user&quot; | &quot;assistant&quot;,           \/\/ \u6d88\u606f\u89d2\u8272\n  &quot;content&quot;: {\n    &quot;type&quot;: &quot;text&quot; | &quot;image&quot;,             \/\/ \u5185\u5bb9\u7c7b\u578b\n    &quot;text&quot;: &quot;string&quot;,                     \/\/ \u6587\u672c\u5185\u5bb9\n    &quot;data&quot;: &quot;string&quot;,                     \/\/ \u56fe\u7247\u5185\u5bb9 (Base64)\n    &quot;mimeType&quot;: &quot;string&quot;                  \/\/ MIME \u7c7b\u578b\n  }\n}<\/code><\/pre>\n<h4>\u793a\u4f8b\u8bf7\u6c42<\/h4>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e2a\u793a\u4f8b\u91c7\u6837\u8bf7\u6c42\uff1a<\/p>\n<pre><code class=\"json\">{\n  &quot;method&quot;: &quot;sampling\/createMessage&quot;,\n  &quot;params&quot;: {\n    &quot;messages&quot;: [\n      {\n        &quot;role&quot;: &quot;user&quot;,\n        &quot;content&quot;: {\n          &quot;type&quot;: &quot;text&quot;,\n          &quot;text&quot;: &quot;\u5f53\u524d\u76ee\u5f55\u4e0b\u6709\u54ea\u4e9b\u6587\u4ef6\uff1f&quot;\n\n        }\n      }\n    ],\n    &quot;systemPrompt&quot;: &quot;\u4f60\u662f\u4e00\u540d\u6587\u4ef6\u7cfb\u7edf\u52a9\u624b\u3002&quot;,\n    &quot;includeContext&quot;: &quot;thisServer&quot;,\n    &quot;maxTokens&quot;: 100\n  }\n}<\/code><\/pre>\n<h2>MCP \u670d\u52a1\u5668<\/h2>\n<p>\u5728\u00a0<code>MCP<\/code>\u00a0\u534f\u8bae\u4e2d\uff0c\u670d\u52a1\u5668\u63d0\u4f9b\u4e86\u4e3a\u00a0<code>LLM<\/code>\u00a0\u5927\u6a21\u578b\u6dfb\u52a0\u4e0a\u4e0b\u6587\u7684\u57fa\u7840\u6784\u4ef6\u3002\u901a\u8fc7\u00a0<code>Propmts<\/code>\uff08\u63d0\u793a\u8bcd\uff09\u3001<code>Resources<\/code>\uff08\u8d44\u6e90\uff09\u548c\u00a0<code>Tools<\/code>\uff08\u5de5\u5177\uff09\u8fd9\u4e09\u79cd\u00a0<strong>\u539f\u8bed\uff08Primitives\uff09<\/strong>\uff0c\u00a0\u5ba2\u6237\u7aef\u3001\u670d\u52a1\u5668\u4e0e\u8bed\u8a00\u6a21\u578b\u4e4b\u95f4\u80fd\u591f\u5b9e\u73b0 <strong>\u9ad8\u6548\u4e14\u7075\u6d3b\u7684\u4ea4\u4e92\u3002<\/strong><\/p>\n<h3>Prompts \u63d0\u793a\u8bcd<\/h3>\n<p><strong>\u63d0\u793a\u8bcd<\/strong> \u5141\u8bb8\u670d\u52a1\u5668\u5b9a\u4e49\u53ef\u590d\u7528\u7684\u63d0\u793a\u8bcd\u6a21\u677f\u548c\u5de5\u4f5c\u6d41\uff0c\u5ba2\u6237\u7aef\u53ef\u4ee5\u8f7b\u677e\u5c06\u8fd9\u4e9b\u6a21\u677f\u5448\u73b0\u7ed9\u7528\u6237\u6216\u00a0<code>LLM<\/code>\u3002<\/p>\n<h4>\u63d0\u793a\u8bcd\u7ed3\u6784<\/h4>\n<p>\u4e00\u4e2a\u63d0\u793a\u8bcd\u7684\u7ed3\u6784\u5b9a\u4e49\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre><code class=\"json\">{\n  &quot;name&quot;: &quot;string&quot;,               \/\/ \u63d0\u793a\u8bcd\u552f\u4e00\u6807\u8bc6\u7b26\n  &quot;description&quot;: &quot;string&quot;,        \/\/ \u53ef\u9009\uff0c\u4eba\u7c7b\u53ef\u8bfb\u7684\u63cf\u8ff0\n  &quot;arguments&quot;: [                  \/\/ \u53ef\u9009\u53c2\u6570\u5217\u8868\n    {\n      &quot;name&quot;: &quot;string&quot;,           \/\/ \u53c2\u6570\u6807\u8bc6\u7b26\n      &quot;description&quot;: &quot;string&quot;,    \/\/ \u53ef\u9009\uff0c\u53c2\u6570\u63cf\u8ff0\n      &quot;required&quot;: &quot;boolean&quot;       \/\/ \u662f\u5426\u4e3a\u5fc5\u586b\u53c2\u6570\n    }\n  ]\n}\n<\/code><\/pre>\n<h4>\u83b7\u53d6\u63d0\u793a\u8bcd<\/h4>\n<p>\u5ba2\u6237\u7aef\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528\u00a0<code>prompts\/list<\/code>\u00a0\u83b7\u53d6\u53ef\u7528\u7684\u63d0\u793a\u8bcd\u5217\u8868\uff1a<\/p>\n<p><strong>\u8bf7\u6c42\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre><code class=\"json\">{\n  method: &quot;prompts\/list&quot;\n}<\/code><\/pre>\n<p><strong>\u54cd\u5e94\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre><code class=\"json\">{\n  &quot;prompts&quot;: [\n    {\n      &quot;name&quot;: &quot;analyze-code&quot;,                       \/\/ \u63d0\u793a\u8bcd\u552f\u4e00\u6807\u8bc6\u7b26\n      &quot;description&quot;: &quot;\u5206\u6790\u4ee3\u7801\u4ee5\u53d1\u73b0\u6f5c\u5728\u6539\u8fdb\u70b9&quot;,   \/\/ \u63d0\u793a\u8bcd\u63cf\u8ff0\n      &quot;arguments&quot;: [\n        {\n          &quot;name&quot;: &quot;language&quot;,                       \/\/ \u53c2\u6570\u540d\u79f0\n          &quot;description&quot;: &quot;\u7f16\u7a0b\u8bed\u8a00&quot;,                \/\/ \u53c2\u6570\u63cf\u8ff0\n          &quot;required&quot;: true                          \/\/ \u662f\u5426\u5fc5\u586b\n        }\n      ]\n    }\n  ]\n}<\/code><\/pre>\n<h4>\u83b7\u53d6\u63d0\u793a\u8bcd\u8be6\u60c5<\/h4>\n<p>\u5982\u679c\u5ba2\u6237\u7aef\u8981\u4f7f\u7528\u63d0\u793a\u8bcd\uff0c\u9700\u8981\u901a\u8fc7\u00a0<code>prompts\/get<\/code>\u00a0\u63a5\u53e3\u83b7\u53d6\u63d0\u793a\u8bcd\u8be6\u60c5\u3002<\/p>\n<p><strong>\u8bf7\u6c42\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre><code class=\"json\">{\n  &quot;method&quot;: &quot;prompts\/get&quot;,\n  &quot;params&quot;: {\n    &quot;name&quot;: &quot;analyze-code&quot;,              \/\/ \u8981\u4f7f\u7528\u7684\u63d0\u793a\u8bcd\u540d\u79f0\n    &quot;arguments&quot;: {\n      &quot;language&quot;: &quot;go&quot;               \/\/ \u52a8\u6001\u53c2\u6570\n    }\n  }\n}<\/code><\/pre>\n<p><strong>\u54cd\u5e94\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre><code class=\"json\">{\n  &quot;description&quot;: &quot;\u5206\u6790 Go \u4ee3\u7801\u4ee5\u53d1\u73b0\u6f5c\u5728\u6539\u8fdb\u70b9&quot;,  \/\/ \u63d0\u793a\u8bcd\u63cf\u8ff0\n  &quot;messages&quot;: [\n    {\n      &quot;role&quot;: &quot;user&quot;,                    \/\/ \u6d88\u606f\u53d1\u9001\u65b9\n      &quot;content&quot;: {\n        &quot;type&quot;: &quot;text&quot;,                  \/\/ \u5185\u5bb9\u7c7b\u578b\n        &quot;text&quot;: &quot;\u8bf7\u5206\u6790\u4ee5\u4e0b Go \u4ee3\u7801\uff0c\u627e\u51fa\u53ef\u80fd\u7684\u6539\u8fdb\u7a7a\u95f4\uff1a\/n\/n```go\/npackage main\/n\/nimport &quot;fmt&quot;\/n\/nfunc main() {\/n\/n    fmt.Println(&quot;Hello, World!&quot;)\/n}\/n```&quot;\n      }\n    }\n  ]\n}<\/code><\/pre>\n<h4>\u52a8\u6001\u63d0\u793a\u8bcd<\/h4>\n<p>\u63d0\u793a\u8bcd\u4e0d\u4ec5\u53ef\u4ee5\u662f\u9759\u6001\u6a21\u677f\uff0c\u4e5f\u652f\u6301\u6839\u636e\u53c2\u6570\u52a8\u6001\u751f\u6210\u5185\u5bb9\uff0c\u751a\u81f3\u53ef\u4ee5\u5d4c\u5165\u00a0<strong>\u8d44\u6e90\u4e0a\u4e0b\u6587<\/strong>\u3002<\/p>\n<p><strong>\u63d0\u793a\u8bcd\u5b9a\u4e49\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre><code class=\"json\">{\n  &quot;name&quot;: &quot;analyze-project&quot;,                    \/\/ \u63d0\u793a\u8bcd\u540d\u79f0\n  &quot;description&quot;: &quot;\u5206\u6790\u9879\u76ee\u65e5\u5fd7\u4e0e\u4ee3\u7801&quot;,          \/\/ \u63cf\u8ff0\n  &quot;arguments&quot;: [\n    {\n      &quot;name&quot;: &quot;timeframe&quot;,                      \/\/ \u53c2\u6570\u540d\u79f0\n      &quot;description&quot;: &quot;\u8981\u5206\u6790\u7684\u65e5\u5fd7\u65f6\u95f4\u8303\u56f4&quot;,    \/\/ \u53c2\u6570\u63cf\u8ff0\n      &quot;required&quot;: true                          \/\/ \u662f\u5426\u5fc5\u586b\n    },\n    {\n      &quot;name&quot;: &quot;fileUri&quot;,                        \/\/ \u53c2\u6570\u540d\u79f0\n      &quot;description&quot;: &quot;\u5f85\u5ba1\u67e5\u7684\u4ee3\u7801\u6587\u4ef6 URI&quot;,    \/\/ \u53c2\u6570\u63cf\u8ff0\n      &quot;required&quot;: true                          \/\/ \u662f\u5426\u5fc5\u586b\n    }\n  ]\n}\n<\/code><\/pre>\n<p><strong>prompts\/get \u8bf7\u6c42\u8fd4\u56de\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre><code class=\"json\">{\n  &quot;messages&quot;: [\n    {\n      &quot;role&quot;: &quot;user&quot;,\n      &quot;content&quot;: {\n        &quot;type&quot;: &quot;text&quot;,\n        &quot;text&quot;: &quot;\u8bf7\u5206\u6790\u4ee5\u4e0b\u7cfb\u7edf\u65e5\u5fd7\u548c\u4ee3\u7801\u6587\u4ef6\uff0c\u627e\u51fa\u6f5c\u5728\u95ee\u9898\uff1a&quot;\n      }\n    },\n    {\n      &quot;role&quot;: &quot;user&quot;,\n      &quot;content&quot;: {\n        &quot;type&quot;: &quot;resource&quot;,\n        &quot;resource&quot;: {\n          &quot;uri&quot;: &quot;logs:\/\/chenmingyong\/recent?timeframe=1h&quot;,                      \/\/ \u8d44\u6e90 URI\n          &quot;text&quot;: &quot;[2024-03-14 15:32:11] ERROR: network.py:127 \u8fde\u63a5\u8d85\u65f6\/n[2024-03-14 15:32:15] WARN: \u6b63\u5728\u91cd\u8bd5\u8fde\u63a5 (\u7b2c 2\/3 \u6b21)\/n[2024-03-14 15:32:20] ERROR: \u8fbe\u5230\u6700\u5927\u91cd\u8bd5\u6b21\u6570&quot;,\n          &quot;mimeType&quot;: &quot;text\/plain&quot;                                  \/\/ \u8d44\u6e90\u7c7b\u578b\n        }\n      }\n    },\n    {\n      &quot;role&quot;: &quot;user&quot;,\n      &quot;content&quot;: {\n        &quot;type&quot;: &quot;resource&quot;,\n        &quot;resource&quot;: {\n          &quot;uri&quot;: &quot;file:\/\/\/path\/chenmingyong\/code.py&quot;,                        \/\/ \u4ee3\u7801\u6587\u4ef6 URI\n          &quot;text&quot;: &quot;def connect_to_service(timeout=30):\/n    retries = 3\/n    for attempt in range(retries):\/n        try:\/n            return establish_connection(timeout)\/n        except TimeoutError:\/n            if attempt == retries - 1:\/n                raise\/n            time.sleep(5)\/n\/ndef establish_connection(timeout):\/n    # \u8fde\u63a5\u5b9e\u73b0\/n    pass&quot;,\n          &quot;mimeType&quot;: &quot;text\/x-python&quot;\n        }\n      }\n    }\n  ]\n}\n<\/code><\/pre>\n<h4>\u591a\u8f6e\u63d0\u793a\u5de5\u4f5c\u6d41<\/h4>\n<p>\u63d0\u793a\u8bcd\u8fd8\u652f\u6301\u5b9a\u4e49\u591a\u8f6e\u5bf9\u8bdd\u6d41\u7a0b\uff0c\u901a\u8fc7\u9884\u8bbe\u7684\u591a\u6b65\u63d0\u793a\uff0c\u5f15\u5bfc\u7528\u6237\u5b8c\u6210\u590d\u6742\u4efb\u52a1\u3002<\/p>\n<pre><code class=\"TypeScript\">const debugWorkflow = {\n  name: &quot;debug-error&quot;,\n  async getMessages(error: string) {\n    return [\n      {\n        role: &quot;user&quot;,\n        content: {\n          type: &quot;text&quot;,\n          text: `\u6211\u9047\u5230\u4e86\u4e00\u4e2a\u9519\u8bef\uff1a${error}`\n        }\n      },\n      {\n        role: &quot;assistant&quot;,\n        content: {\n          type: &quot;text&quot;,\n          text: &quot;\u6211\u6765\u5e2e\u4f60\u5206\u6790\u8fd9\u4e2a\u9519\u8bef\u3002\u4f60\u4e4b\u524d\u5c1d\u8bd5\u8fc7\u54ea\u4e9b\u64cd\u4f5c\uff1f&quot;\n        }\n      },\n      {\n        role: &quot;user&quot;,\n        content: {\n          type: &quot;text&quot;,\n          text: &quot;\u6211\u5c1d\u8bd5\u91cd\u542f\u670d\u52a1\uff0c\u4f46\u9519\u8bef\u4f9d\u7136\u5b58\u5728\u3002&quot;\n        }\n      }\n    ];\n  }\n};<\/code><\/pre>\n<h3>Resources \u8d44\u6e90<\/h3>\n<p><strong>Resources<\/strong>\uff08\u8d44\u6e90\uff09\u662f\u00a0<code>MCP<\/code>\u00a0\u534f\u8bae\u4e2d\u7684\u6838\u5fc3\u539f\u8bed\u4e4b\u4e00\uff0c\u670d\u52a1\u5668\u901a\u8fc7\u5b83\u53ef\u4ee5\u5411\u5ba2\u6237\u7aef\u63d0\u4f9b\u53ef\u8bfb\u7684\u6570\u636e\u6216\u5185\u5bb9\uff0c\u7528\u4f5c\u00a0<code>LLM<\/code>\u00a0\u4ea4\u4e92\u7684\u4e0a\u4e0b\u6587\u4fe1\u606f\u3002<\/p>\n<h4>\u8d44\u6e90 URI<\/h4>\n<p>\u6bcf\u4e2a\u8d44\u6e90\u901a\u8fc7\u00a0<code>URI<\/code>\u00a0\u8fdb\u884c\u6807\u8bc6\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"Markdown\">[\u534f\u8bae]:\/\/[\u4e3b\u673a]\/[\u8def\u5f84]<\/code><\/pre>\n<p>\u793a\u4f8b\uff1a<\/p>\n<pre><code class=\"Markdown\">file:\/\/\/home\/chenmingyong\/documents\/go.pdf\npostgres:\/\/database\/chenmingyong\/schema\nscreen:\/\/localhost\/chenmingyong\/display1<\/code><\/pre>\n<p>\u5177\u4f53\u7684\u534f\u8bae\uff08<code>protocol<\/code>\uff09\u4e0e\u8def\u5f84\u7ed3\u6784\u7531\u00a0<code>MCP<\/code>\u00a0\u670d\u52a1\u5668\u81ea\u884c\u5b9a\u4e49\uff0c\u670d\u52a1\u5668\u4e5f\u53ef\u4ee5\u8bbe\u8ba1\u81ea\u5b9a\u4e49\u7684\u00a0<code>URI<\/code>\u00a0\u683c\u5f0f\u3002<\/p>\n<h4>\u8d44\u6e90\u7c7b\u578b<\/h4>\n<p>\u8d44\u6e90\u5185\u5bb9\u5206\u4e3a\u4e24\u79cd\u7c7b\u578b\uff1a<\/p>\n<h5>\u6587\u672c\u7c7b\u578b<\/h5>\n<p>\u5305\u542b\u00a0<code>UTF_8<\/code>\u00a0\u7f16\u7801\u7684\u6587\u672c\u6570\u636e\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\u6e90\u4ee3\u7801<\/li>\n<li>\u914d\u7f6e\u6587\u4ef6<\/li>\n<li>\u65e5\u5fd7\u6587\u4ef6<\/li>\n<li><code>JSON \/ XML<\/code>\u00a0\u6570\u636e<\/li>\n<li>\u666e\u901a\u6587\u672c<\/li>\n<\/ul>\n<h5>\u4e8c\u8fdb\u5236\u8d44\u6e90<\/h5>\n<p>\u5305\u542b\u00a0<code>Base64<\/code>\u00a0\u7f16\u7801\u7684\u539f\u59cb\u4e8c\u8fdb\u5236\u6570\u636e\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\u56fe\u7247<\/li>\n<li><code>PDF<\/code>\u00a0\u6587\u4ef6<\/li>\n<li>\u97f3\u9891 \/ \u89c6\u9891\u6587\u4ef6<\/li>\n<li>\u5176\u4ed6\u975e\u6587\u672c\u683c\u5f0f<\/li>\n<\/ul>\n<h4>\u83b7\u53d6\u8d44\u6e90\u5217\u8868<\/h4>\n<p>\u5ba2\u6237\u7aef\u53ef\u4ee5\u901a\u8fc7\u8c03\u7528\u670d\u52a1\u5668\u7684\u00a0<code>resources\/list<\/code>\u00a0\u83b7\u53d6\u8d44\u6e90\u5217\u8868\uff0c\u6bcf\u4e2a\u8d44\u6e90\u5305\u542b\u4ee5\u4e0b\u4fe1\u606f\uff1a<\/p>\n<pre><code class=\"JSON\">{\n  &quot;uri&quot;: &quot;string&quot;,             \/\/ \u8d44\u6e90\u552f\u4e00\u6807\u8bc6\u7b26\n  &quot;name&quot;: &quot;string&quot;,            \/\/ \u8d44\u6e90\u540d\u79f0\uff08\u4eba\u7c7b\u53ef\u8bfb\uff09\n\n  &quot;description&quot;: &quot;string&quot;,     \/\/ \u53ef\u9009\uff0c\u8d44\u6e90\u63cf\u8ff0\n  &quot;mimeType&quot;: &quot;string&quot;         \/\/ \u53ef\u9009\uff0c\u8d44\u6e90 MIME \u7c7b\u578b\n}<\/code><\/pre>\n<p>\u5bf9\u4e8e\u52a8\u6001\u8d44\u6e90\uff0c\u670d\u52a1\u5668\u53ef\u4ee5\u901a\u8fc7\u00a0<code>URI<\/code>\u00a0\u6a21\u677f\u65b9\u5f0f\u66b4\u9732\u8d44\u6e90\uff0c\u5ba2\u6237\u7aef\u53ef\u6839\u636e\u6a21\u677f\u6784\u5efa\u6709\u6548\u7684\u8d44\u6e90\u00a0<code>URI<\/code>\uff1a<\/p>\n<pre><code class=\"JSON\">{\n  &quot;uriTemplate&quot;: &quot;string&quot;,     \/\/ \u7b26\u5408 RFC 6570 \u7684 URI \u6a21\u677f\n  &quot;name&quot;: &quot;string&quot;,            \/\/ \u6a21\u677f\u540d\u79f0\uff08\u4eba\u7c7b\u53ef\u8bfb\uff09\n\n  &quot;description&quot;: &quot;string&quot;,     \/\/ \u53ef\u9009\uff0c\u6a21\u677f\u63cf\u8ff0\n  &quot;mimeType&quot;: &quot;string&quot;         \/\/ \u53ef\u9009\uff0c\u5339\u914d\u8d44\u6e90\u7684 MIME \u7c7b\u578b\n}<\/code><\/pre>\n<h4>\u83b7\u53d6\u8d44\u6e90\u8be6\u60c5<\/h4>\n<p>\u5ba2\u6237\u7aef\u53ef\u4ee5\u901a\u8fc7\u00a0<code>resources\/read<\/code>\u00a0\u63a5\u53e3\u8bfb\u53d6\u8d44\u6e90\u5185\u5bb9\uff0c\u53ea\u9700\u4f20\u5165\u8d44\u6e90\u7684\u00a0<code>URI<\/code>\u3002<\/p>\n<p>\u670d\u52a1\u5668\u4f1a\u8fd4\u56de\u8d44\u6e90\u5185\u5bb9\u5217\u8868\uff1a<\/p>\n<pre><code class=\"JSON\">{\n  contents: [\n    {\n      uri: string;        \/\/ \u8d44\u6e90\u552f\u4e00\u6807\u8bc6\u7b26\n      mimeType?: string;  \/\/ \u53ef\u9009\uff0c\u8d44\u6e90 MIME \u7c7b\u578b\n\n      \/\/ \u4ee5\u4e0b\u4e8c\u9009\u4e00\n      text?: string;      \/\/ \u6587\u672c\u8d44\u6e90\n      blob?: string;      \/\/ \u4e8c\u8fdb\u5236\u8d44\u6e90\n    }\n  ]\n}<\/code><\/pre>\n<h4>\u8d44\u6e90\u66f4\u65b0<\/h4>\n<p><code>MCP<\/code>\u00a0\u652f\u6301\u901a\u8fc7\u4e24\u79cd\u65b9\u5f0f\u901a\u77e5\u8d44\u6e90\u53d8\u66f4\u3002<\/p>\n<h5>\u5217\u8868\u53d8\u66f4<\/h5>\n<p>\u5f53\u53ef\u7528\u8d44\u6e90\u5217\u8868\u53d1\u751f\u53d8\u66f4\u65f6\uff0c\u670d\u52a1\u5668\u4f1a\u901a\u8fc7\u00a0<code>notifications\/resources\/list_changed<\/code>\u00a0\u901a\u77e5\u5ba2\u6237\u7aef\u3002<\/p>\n<h5>\u5185\u5bb9\u53d8\u66f4<\/h5>\n<p>\u5ba2\u6237\u7aef\u53ef\u4ee5\u8ba2\u9605\u7279\u5b9a\u8d44\u6e90\u7684\u66f4\u65b0\u6d41\u7a0b\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\u5ba2\u6237\u7aef\u53d1\u9001\u00a0<code>resources\/subscribe<\/code>\u00a0\u8bf7\u6c42\uff0c\u6307\u5b9a\u8d44\u6e90\u00a0<code>URI<\/code><\/li>\n<li>\u8d44\u6e90\u53d1\u751f\u53d8\u66f4\u65f6\uff0c\u670d\u52a1\u5668\u901a\u8fc7\u00a0<code>notifications\/resources\/updated<\/code>\u00a0\u901a\u77e5\u5ba2\u6237\u7aef<\/li>\n<li>\u5ba2\u6237\u7aef\u53ef\u901a\u8fc7\u00a0<code>resources\/read<\/code>\u00a0\u83b7\u53d6\u6700\u65b0\u5185\u5bb9<\/li>\n<li>\u5ba2\u6237\u7aef\u53ef\u901a\u8fc7\u00a0<code>resources\/unsubscribe<\/code>\u00a0\u53d6\u6d88\u8ba2\u9605<\/li>\n<\/ul>\n<h3>Tools \u5de5\u5177<\/h3>\n<p><code>Tools<\/code>\uff08\u5de5\u5177\uff09\u00a0\u662f\u00a0<code>MCP<\/code>\u00a0\u534f\u8bae\u4e2d\u7684\u4e00\u9879\u5173\u952e\u539f\u8bed\uff0c\u670d\u52a1\u5668\u53ef\u901a\u8fc7\u5b83\u5411\u5ba2\u6237\u7aef\u66b4\u9732\u53ef\u6267\u884c\u529f\u80fd\uff0c\u4f9b\u00a0<code>LLM<\/code>\u00a0\u4f7f\u7528\uff08\u901a\u5e38\u9700\u8981\u7528\u6237\u6279\u51c6\uff0c\u786e\u4fdd\u4eba\u7c7b\u53c2\u4e0e\u51b3\u7b56\uff09\u3002<code>Tools<\/code>\u00a0\u7684\u6838\u5fc3\u6982\u5ff5\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u53d1\u73b0\uff08<strong>Discovery<\/strong>\uff09\uff1a\u5ba2\u6237\u7aef\u53ef\u901a\u8fc7\u00a0<code>tools\/list<\/code>\u00a0\u63a5\u53e3\u83b7\u53d6\u53ef\u7528\u5de5\u5177\u5217\u8868\u3002<\/li>\n<li>\u8c03\u7528\uff08<strong>Invocation<\/strong>\uff09\uff1a\u5ba2\u6237\u7aef\u53ef\u901a\u8fc7\u00a0<code>tools\/call<\/code>\u63a5\u53e3\u53d1\u8d77\u5de5\u5177\u8c03\u7528\u8bf7\u6c42\uff0c\u7531\u670d\u52a1\u5668\u6267\u884c\u5177\u4f53\u64cd\u4f5c\u5e76\u8fd4\u56de\u7ed3\u679c\u3002<\/li>\n<li>\u7075\u6d3b\u6027\uff08<strong>Flexibility<\/strong>\uff09\uff1a\u5de5\u5177\u65e2\u53ef\u4ee5\u662f\u7b80\u5355\u7684\u8ba1\u7b97\u51fd\u6570\uff0c\u4e5f\u53ef\u4ee5\u662f\u590d\u6742\u7684\u00a0<code>API<\/code>\u00a0\u96c6\u6210\u3002<\/li>\n<\/ul>\n<h4>\u5de5\u5177\u7ed3\u6784\u5b9a\u4e49<\/h4>\n<p>\u6bcf\u4e2a\u5de5\u5177\u7684\u7ed3\u6784\u5b9a\u4e49\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre><code class=\"JSON\">{\n  &quot;name&quot;: &quot;string&quot;,                \/\/ \u5de5\u5177\u552f\u4e00\u6807\u8bc6\u7b26\n  &quot;description&quot;: &quot;string&quot;,         \/\/ \u53ef\u9009\uff0c\u5de5\u5177\u63cf\u8ff0\n\n  &quot;inputSchema&quot;: {                 \/\/ \u5de5\u5177\u53c2\u6570\u7684 JSON Schema\n    &quot;type&quot;: &quot;object&quot;,\n\n    &quot;properties&quot;: { ... }          \/\/ \u5de5\u5177\u53c2\u6570\u5b9a\u4e49\n  }\n}<\/code><\/pre>\n<h4>\u5de5\u5177\u5b9e\u73b0\u793a\u4f8b<\/h4>\n<ul>\n<li>\n<p>\u4e0e\u672c\u5730\u7cfb\u7edf\u4ea4\u4e92\u7684\u5de5\u5177<\/p>\n<pre><code class=\"JavaScript\">{\n  &quot;name&quot;: &quot;execute_command&quot;,                      \/\/ \u5de5\u5177\u540d\u79f0\n  &quot;description&quot;: &quot;\u6267\u884c shell \u547d\u4ee4&quot;,               \/\/ \u63cf\u8ff0\n\n  &quot;inputSchema&quot;: {\n    &quot;type&quot;: &quot;object&quot;,\n\n    &quot;properties&quot;: {\n      &quot;command&quot;: { &quot;type&quot;: &quot;string&quot; },            \/\/ \u547d\u4ee4\u540d\u79f0\n\n      &quot;args&quot;: {\n        &quot;type&quot;: &quot;array&quot;,\n\n        &quot;items&quot;: { &quot;type&quot;: &quot;string&quot; }             \/\/ \u547d\u4ee4\u53c2\u6570\n      }\n    }\n  }\n}\n<\/code><\/pre>\n<\/li>\n<li>\n<p>\u5916\u90e8\u00a0<code>API<\/code>\u00a0\u96c6\u6210\u7c7b\u5de5\u5177<\/p>\n<pre><code class=\"JSON\">{\n  &quot;name&quot;: &quot;github_create_issue&quot;,                  \/\/ \u5de5\u5177\u540d\u79f0\n  &quot;description&quot;: &quot;\u5728 GitHub \u521b\u5efa Issue&quot;,         \/\/ \u63cf\u8ff0\n\n  &quot;inputSchema&quot;: {\n    &quot;type&quot;: &quot;object&quot;,\n\n    &quot;properties&quot;: {\n      &quot;title&quot;: { &quot;type&quot;: &quot;string&quot; },              \/\/ Issue \u6807\u9898\n\n      &quot;body&quot;: { &quot;type&quot;: &quot;string&quot; },               \/\/ Issue \u5185\u5bb9\n      &quot;labels&quot;: {\n\n        &quot;type&quot;: &quot;array&quot;,\n        &quot;items&quot;: { &quot;type&quot;: &quot;string&quot; }             \/\/ Issue \u6807\u7b7e\n      }\n\n    }\n  }\n}<\/code><\/pre>\n<\/li>\n<\/ul>\n<h2>MCP Server \u539f\u8bed\u63a7\u5236\u5c42\u7ea7<\/h2>\n<p>\u6bcf\u4e2a\u539f\u8bed\u7684\u00a0<strong>\u63a7\u5236\u5c42\u7ea7<\/strong> \u53ef\u603b\u7ed3\u5982\u4e0b\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u539f\u8bed<\/th>\n<th>\u63a7\u5236\u65b9<\/th>\n<th>Description  \u63cf\u8ff0<\/th>\n<th>Example  \u793a\u4f8b<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Prompts<\/td>\n<td>\u7528\u6237\u63a7\u5236<\/td>\n<td>\u7531\u7528\u6237\u9009\u62e9\u8c03\u7528\u7684\u4ea4\u4e92\u5f0f\u6a21\u677f<\/td>\n<td>\u659c\u6760\u547d\u4ee4\uff08\/command\uff09\u3001\u83dc\u5355\u9009\u9879<\/td>\n<\/tr>\n<tr>\n<td>Resources<\/td>\n<td>\u5e94\u7528\u63a7\u5236<\/td>\n<td>\u7531\u5ba2\u6237\u7aef\u9644\u52a0\u5e76\u7ba1\u7406\u7684\u4e0a\u4e0b\u6587\u6570\u636e<\/td>\n<td>\u6587\u4ef6\u5185\u5bb9\uff0cgit \u5386\u53f2\u8bb0\u5f55<\/td>\n<\/tr>\n<tr>\n<td>Tools<\/td>\n<td>\u6a21\u578b\u63a7\u5236<\/td>\n<td>\u66b4\u9732\u7ed9 LLM \u4ee5\u4fbf\u5176\u6267\u884c\u64cd\u4f5c\u7684\u529f\u80fd\u63a5\u53e3<\/td>\n<td>API POST \u8bf7\u6c42\u3001\u6587\u4ef6\u5199\u5165<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u670d\u52a1\u5668\u5b9e\u73b0<\/h2>\n<p>\u4ee5\u4e0b\u662f\u57fa\u4e8e\u00a0<code>go<\/code>\u00a0\u8bed\u8a00\u5b9e\u73b0\u7684\u00a0<code>MCP<\/code>\u00a0\u670d\u52a1\u5668\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<pre><code class=\"go\">package main\n\nimport (\n    &quot;context&quot;\n    &quot;errors&quot;\n    &quot;fmt&quot;\n    &quot;os&quot;\n\n    &quot;github.com\/mark3labs\/mcp-go\/mcp&quot;\n    &quot;github.com\/mark3labs\/mcp-go\/server&quot;\n)\n\nfunc main() {\n    s := server.NewMCPServer(\n        &quot;Server Demo&quot;,\n        &quot;1.0.0&quot;,\n    )\n\n    \/\/ \u6dfb\u52a0\u5de5\u5177\n    {\n        calculatorTool := mcp.NewTool(&quot;calculate&quot;,\n            mcp.WithDescription(&quot;\u6267\u884c\u57fa\u672c\u7684\u7b97\u672f\u8fd0\u7b97&quot;),\n            mcp.WithString(&quot;operation&quot;,\n                mcp.Required(),\n                mcp.Description(&quot;\u8981\u6267\u884c\u7684\u7b97\u672f\u8fd0\u7b97\u7c7b\u578b&quot;),\n                mcp.Enum(&quot;add&quot;, &quot;subtract&quot;, &quot;multiply&quot;, &quot;divide&quot;), \/\/ \u4fdd\u6301\u82f1\u6587\n            ),\n            mcp.WithNumber(&quot;x&quot;,\n                mcp.Required(),\n                mcp.Description(&quot;\u7b2c\u4e00\u4e2a\u6570\u5b57&quot;),\n            ),\n            mcp.WithNumber(&quot;y&quot;,\n                mcp.Required(),\n                mcp.Description(&quot;\u7b2c\u4e8c\u4e2a\u6570\u5b57&quot;),\n            ),\n        )\n\n        s.AddTool(calculatorTool, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) {\n            op := request.Params.Arguments[&quot;operation&quot;].(string)\n            x := request.Params.Arguments[&quot;x&quot;].(float64)\n            y := request.Params.Arguments[&quot;y&quot;].(float64)\n\n            var result float64\n            switch op {\n            case &quot;add&quot;:\n                result = x + y\n            case &quot;subtract&quot;:\n                result = x - y\n            case &quot;multiply&quot;:\n                result = x * y\n            case &quot;divide&quot;:\n                if y == 0 {\n                    return nil, errors.New(&quot;\u4e0d\u5141\u8bb8\u9664\u4ee5\u96f6&quot;)\n                }\n                result = x \/ y\n            }\n\n            return mcp.FormatNumberResult(result), nil\n        })\n    }\n\n    \/\/ \u6dfb\u52a0\u8d44\u6e90\n    {\n        \/\/ \u9759\u6001\u8d44\u6e90\u793a\u4f8b - \u66b4\u9732\u4e00\u4e2a README \u6587\u4ef6\n        resource := mcp.NewResource(\n            &quot;docs:\/\/readme&quot;,\n            &quot;\u9879\u76ee\u8bf4\u660e\u6587\u6863&quot;,\n            mcp.WithResourceDescription(&quot;\u9879\u76ee\u7684 README \u6587\u4ef6&quot;),\n            mcp.WithMIMEType(&quot;text\/markdown&quot;),\n        )\n\n        \/\/ \u6dfb\u52a0\u8d44\u6e90\u53ca\u5176\u5904\u7406\u51fd\u6570\n        s.AddResource(resource, func(ctx context.Context, request mcp.ReadResourceRequest) ([]mcp.ResourceContents, error) {\n            content, err := os.ReadFile(&quot;README.md&quot;)\n            if err != nil {\n                return nil, err\n            }\n\n            return []mcp.ResourceContents{\n                mcp.TextResourceContents{\n                    URI:      &quot;docs:\/\/readme&quot;,\n                    MIMEType: &quot;text\/markdown&quot;,\n                    Text:     string(content),\n                },\n            }, nil\n        })\n    }\n\n    \/\/ \u6dfb\u52a0\u63d0\u793a\u8bcd\n    {\n        \/\/ \u7b80\u5355\u95ee\u5019\u63d0\u793a\n        s.AddPrompt(mcp.NewPrompt(&quot;greeting&quot;,\n            mcp.WithPromptDescription(&quot;\u4e00\u4e2a\u53cb\u597d\u7684\u95ee\u5019\u63d0\u793a&quot;),\n            mcp.WithArgument(&quot;name&quot;,\n                mcp.ArgumentDescription(&quot;\u8981\u95ee\u5019\u7684\u4eba\u7684\u540d\u5b57&quot;),\n            ),\n        ), func(ctx context.Context, request mcp.GetPromptRequest) (*mcp.GetPromptResult, error) {\n            name := request.Params.Arguments[&quot;name&quot;]\n            if name == &quot;&quot; {\n                name = &quot;\u670b\u53cb&quot;\n            }\n\n            return mcp.NewGetPromptResult(\n                &quot;\u53cb\u597d\u7684\u95ee\u5019&quot;,\n                []mcp.PromptMessage{\n                    mcp.NewPromptMessage(\n                        mcp.RoleAssistant,\n                        mcp.NewTextContent(fmt.Sprintf(&quot;\u4f60\u597d\uff0c%s\uff01\u4eca\u5929\u6709\u4ec0\u4e48\u53ef\u4ee5\u5e2e\u60a8\u7684\u5417\uff1f&quot;, name)),\n                    ),\n                },\n            ), nil\n        })\n    }\n\n    \/\/ \u542f\u52a8\u57fa\u4e8e stdio \u4f20\u8f93\u7c7b\u578b\u7684\u670d\u52a1\n    if err := server.ServeStdio(s); err != nil {\n        fmt.Printf(&quot;Server error: %v\/n&quot;, err)\n    }\n}\n<\/code><\/pre>\n<p>\u4e0a\u8ff0\u4ee3\u7801\u793a\u4f8b\u6f14\u793a\u4e86\u5982\u4f55\u521b\u5efa\u4e00\u4e2a\u00a0<code>MCP Server<\/code>\uff0c\u5e76\u5c55\u793a\u4e86\u6dfb\u52a0\u5de5\u5177\u3001\u8d44\u6e90\u548c\u63d0\u793a\u8bcd\u7684\u65b9\u6cd5\u3002<\/p>\n<p>\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u7531\u4e8e\u00a0<code>mcp-go<\/code>\u00a0\u5e93\u5f53\u524d\u5c1a\u672a\u652f\u6301\u00a0<code>Sampling<\/code>\uff08\u91c7\u6837\uff09\u529f\u80fd\uff0c\u793a\u4f8b\u4e2d\u672a\u5305\u542b\u8be5\u529f\u80fd\u7684\u76f8\u5173\u7528\u6cd5\u3002<\/p>\n<h2>\u5ba2\u6237\u7aef\u5b9e\u73b0<\/h2>\n<p>\u57fa\u4e8e\u4e0a\u9762\u5b9a\u4e49\u7684\u670d\u52a1\u5668\uff0c\u4ee5\u4e0b\u662f\u57fa\u4e8e\u00a0<code>go<\/code>\u00a0\u8bed\u8a00\u5b9e\u73b0\u7684\u00a0<code>MCP<\/code>\u00a0\u5ba2\u6237\u7aef\u4ee3\u7801\u793a\u4f8b\uff1a<\/p>\n<pre><code class=\"go\">package main\n\nimport (\n    &quot;context&quot;\n    &quot;fmt&quot;\n    &quot;time&quot;\n\n    &quot;github.com\/mark3labs\/mcp-go\/client&quot;\n    &quot;github.com\/mark3labs\/mcp-go\/mcp&quot;\n)\n\nfunc main() {\n\n    \/\/ \u521b\u5efa\u4e00\u4e2a\u57fa\u4e8e stdio \u7684MCP\u5ba2\u6237\u7aef\n    mcpClient, err := client.NewStdioMCPClient(\n        &quot;.\/client\/server&quot;,\n        []string{},\n    )\n    if err != nil {\n        panic(err)\n    }\n    defer mcpClient.Close()\n\n    ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n    defer cancel()\n\n    fmt.Println(&quot;\u521d\u59cb\u5316 mcp \u5ba2\u6237\u7aef...&quot;)\n    initRequest := mcp.InitializeRequest{}\n    initRequest.Params.ProtocolVersion = mcp.LATEST_PROTOCOL_VERSION\n    initRequest.Params.ClientInfo = mcp.Implementation{\n        Name:    &quot;Client Demo&quot;,\n        Version: &quot;1.0.0&quot;,\n    }\n\n    \/\/ \u521d\u59cb\u5316MCP\u5ba2\u6237\u7aef\u5e76\u8fde\u63a5\u5230\u670d\u52a1\u5668\n    initResult, err := mcpClient.Initialize(ctx, initRequest)\n    if err != nil {\n        panic(err)\n    }\n    fmt.Printf(\n        &quot;\/n\u521d\u59cb\u5316\u6210\u529f\uff0c\u670d\u52a1\u5668\u4fe1\u606f: %s %s\/n\/n&quot;,\n        initResult.ServerInfo.Name,\n        initResult.ServerInfo.Version,\n    )\n\n    \/\/ \u4ece\u670d\u52a1\u5668\u83b7\u53d6\u63d0\u793a\u8bcd\u5217\u8868\n    fmt.Println(&quot;\u63d0\u793a\u8bcd\u5217\u8868:&quot;)\n    promptsRequest := mcp.ListPromptsRequest{}\n    prompts, err := mcpClient.ListPrompts(ctx, promptsRequest)\n    if err != nil {\n        panic(err)\n    }\n    for _, prompt := range prompts.Prompts {\n        fmt.Printf(&quot;- %s: %s\/n&quot;, prompt.Name, prompt.Description)\n        fmt.Println(&quot;\u53c2\u6570:&quot;, prompt.Arguments)\n    }\n\n    \/\/ \u4ece\u670d\u52a1\u5668\u83b7\u53d6\u8d44\u6e90\u5217\u8868\n    fmt.Println()\n    fmt.Println(&quot;\u8d44\u6e90\u5217\u8868:&quot;)\n    resourcesRequest := mcp.ListResourcesRequest{}\n    resources, err := mcpClient.ListResources(ctx, resourcesRequest)\n    if err != nil {\n        panic(err)\n    }\n    for _, resource := range resources.Resources {\n        fmt.Printf(&quot;- uri: %s, name: %s, description: %s, MIME\u7c7b\u578b: %s\/n&quot;, resource.URI, resource.Name, resource.Description, resource.MIMEType)\n    }\n\n    \/\/ \u4ece\u670d\u52a1\u5668\u83b7\u53d6\u5de5\u5177\u5217\u8868\n    fmt.Println()\n    fmt.Println(&quot;\u53ef\u7528\u5de5\u5177\u5217\u8868:&quot;)\n    toolsRequest := mcp.ListToolsRequest{}\n    tools, err := mcpClient.ListTools(ctx, toolsRequest)\n    if err != nil {\n        panic(err)\n    }\n\n    for _, tool := range tools.Tools {\n        fmt.Printf(&quot;- %s: %s\/n&quot;, tool.Name, tool.Description)\n        fmt.Println(&quot;\u53c2\u6570:&quot;, tool.InputSchema.Properties)\n    }\n    fmt.Println()\n\n    \/\/ \u8c03\u7528\u5de5\u5177\n    fmt.Println(&quot;\u8c03\u7528\u5de5\u5177: calculate&quot;)\n    toolRequest := mcp.CallToolRequest{\n        Request: mcp.Request{\n            Method: &quot;tools\/call&quot;,\n        },\n    }\n    toolRequest.Params.Name = &quot;calculate&quot;\n    toolRequest.Params.Arguments = map[string]any{\n        &quot;operation&quot;: &quot;add&quot;,\n        &quot;x&quot;:         1,\n        &quot;y&quot;:         1,\n    }\n    \/\/ Call the tool\n    result, err := mcpClient.CallTool(ctx, toolRequest)\n    if err != nil {\n        panic(err)\n    }\n    fmt.Println(&quot;\u8c03\u7528\u5de5\u5177\u7ed3\u679c:&quot;, result.Content[0].(mcp.TextContent).Text)\n}\n<\/code><\/pre>\n<p>\u8fd0\u884c\u4e0a\u8ff0\u4ee3\u7801\u7684\u7ed3\u679c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre><code class=\"TXT\">\u521d\u59cb\u5316 mcp \u5ba2\u6237\u7aef...\n\n\u521d\u59cb\u5316\u6210\u529f\uff0c\u670d\u52a1\u5668\u4fe1\u606f: Server Demo 1.0.0\n\n\u63d0\u793a\u8bcd\u5217\u8868:\n- greeting: \u4e00\u4e2a\u53cb\u597d\u7684\u95ee\u5019\u63d0\u793a\n\u53c2\u6570: [{name \u8981\u95ee\u5019\u7684\u4eba\u7684\u540d\u5b57 false}]\n\n\u8d44\u6e90\u5217\u8868:\n- uri: docs:\/\/readme, name: \u9879\u76ee\u8bf4\u660e\u6587\u6863, description: \u9879\u76ee\u7684 README \u6587\u4ef6, MIME\u7c7b\u578b: text\/markdown\n\n\u53ef\u7528\u5de5\u5177\u5217\u8868:\n- calculate: \u6267\u884c\u57fa\u672c\u7684\u7b97\u672f\u8fd0\u7b97\n\u53c2\u6570: map[operation:map[description:\u8981\u6267\u884c\u7684\u7b97\u672f\u8fd0\u7b97\u7c7b\u578b enum:[add subtract multiply divide] type:string] x:map[description:\u7b2c\u4e00\u4e2a\u6570\u5b57 type:number] y:map[description:\u7b2c\u4e8c\u4e2a\u6570\u5b57 type:number]]\n\n\u8c03\u7528\u5de5\u5177: calculate\n\u8c03\u7528\u5de5\u5177\u7ed3\u679c: 2.00\n<\/code><\/pre>\n<p>\u63d0\u793a\u8bcd\u3001\u8d44\u6e90\u4ee5\u53ca\u5de5\u5177\u5217\u8868\u548c\u4e4b\u524d\u5b9a\u4e49\u00a0<code>MCP Server<\/code>\u00a0\u65f6\u6240\u8bbe\u7f6e\u7684\u6570\u636e\u4e00\u81f4\u3002<\/p>\n<blockquote><p>\u82e5\u60f3\u83b7\u53d6\u5b8c\u6574\u4ee3\u7801\u94fe\u63a5\uff0c\u53ef\u5173\u6ce8\u516c\u4f17\u53f7\uff1a\u7a0b\u5e8f\u5458\u9648\u660e\u52c7\uff0c\u56de\u590d MCP\u3002<\/p><\/blockquote>\n<h2>\u5c0f\u7ed3<\/h2>\n<p>\u672c\u6587\u4ecb\u7ecd\u4e86\u00a0<strong>\u6a21\u578b\u4e0a\u4e0b\u6587\u534f\u8bae\uff08Model Context Protocol\uff0cMCP\uff09<\/strong>\uff0c\u4e00\u79cd\u7528\u4e8e\u89c4\u8303\u5927\u578b\u8bed\u8a00\u6a21\u578b\uff08<code>LLM<\/code>\uff09\u4e0e\u5916\u90e8\u6570\u636e\u6e90\u53ca\u5de5\u5177\u4e4b\u95f4\u4ea4\u4e92\u7684\u5f00\u653e\u6807\u51c6\u3002\u5185\u5bb9\u6db5\u76d6\u4e86\u00a0<code>MCP<\/code>\u00a0\u534f\u8bae\u7684\u6574\u4f53\u67b6\u6784\uff08\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u7684\u4e00\u5bf9\u4e00\u8fde\u63a5\u6a21\u5f0f\uff09\u3001\u6d88\u606f\u4f20\u8f93\u673a\u5236\uff08\u91c7\u7528\u00a0<code>JSON-RPC 2.0<\/code>\u00a0\u683c\u5f0f\uff09\u3001\u4ee5\u53ca\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u652f\u6301\u7684\u6838\u5fc3\u539f\u8bed\uff0c\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u5ba2\u6237\u7aef\u539f\u8bed\uff1a<strong>roots\uff08\u6839\u8def\u5f84\uff09<\/strong>\u3001<strong>sampling\uff08\u91c7\u6837\uff09<\/strong><\/li>\n<li>\u670d\u52a1\u5668\u539f\u8bed\uff1a<strong>prompts\uff08\u63d0\u793a\u8bcd\uff09<\/strong>\u3001<strong>resources\uff08\u8d44\u6e90\uff09<\/strong>\u3001<strong>tools\uff08\u5de5\u5177\uff09<\/strong><\/li>\n<li><code>Server<\/code>\u539f\u8bed\u7684\u63a7\u5236\u5c42\u7ea7\u5206\u7c7b<\/li>\n<\/ul>\n<p>\u6700\u540e\uff0c\u672c\u6587\u63d0\u4f9b\u4e86\u57fa\u4e8e\u00a0<strong>Go \u8bed\u8a00<\/strong>\u00a0\u7684\u00a0<code>MCP<\/code>\u00a0\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u7684\u793a\u4f8b\u5b9e\u73b0\uff0c\u5e2e\u52a9\u5f00\u53d1\u8005\u5feb\u901f\u7406\u89e3\u548c\u5e94\u7528\u8be5\u534f\u8bae\u3002<\/p>\n<blockquote><p>\u8be5\u6587\u7ae0\u5df2\u88ab\u00a0<a href=\"https:\/\/link.segmentfault.com\/?enc=rFpT7MyRU%2BA7YxAAl9yENg%3D%3D.%2FXJ7lrqKdZA6zUQlIHffP005WgvIOeI14037%2Bhk1AsVmLD75SzY5NYFnCl2cMUPxfnNpFoKUzqFRQt2FBgC2Zw%3D%3D\" rel=\"nofollow noopener noreferrer\" target=\"_blank\">Model Context Protocol(MCP) \u4e2d\u6587\u6559\u7a0b\u8bb2\u89e3<\/a>\u00a0\u6536\u5f55\uff0c\u6b22\u8fce <strong>star<\/strong> \u6536\u85cf\u3002<\/p><\/blockquote>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000046413935\">https:\/\/segmentfault.com\/a\/1190000046413935<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005\uff1a\u9648\u660e\u52c7 \u4e2a\u4eba\u7f51\u7ad9\uff1ahttps:\/\/chenmingyong.cn \u6587\u7ae0\u6301\u7eed\u66f4\u65b0\uff0c\u5982\u679c\u672c\u6587\u80fd\u8ba9\u60a8\u6709\u6240\u6536\u83b7\uff0c [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10020718","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020718","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10020718"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10020718\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10020718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10020718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10020718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}