{"id":21106,"date":"2026-07-31T16:29:47","date_gmt":"2026-07-31T08:29:47","guid":{"rendered":"https:\/\/92it.top\/?p=21106"},"modified":"2026-07-31T16:29:47","modified_gmt":"2026-07-31T08:29:47","slug":"%e5%a4%a7%e6%a8%a1%e5%9e%8b%e8%b0%83%e7%94%a8-mcp%ef%bc%88model-context-protocol-%e6%a8%a1%e5%9e%8b%e4%b8%8a%e4%b8%8b%e6%96%87%e5%8d%8f%e8%ae%ae%ef%bc%89%e5%8e%9f%e7%90%86","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=21106","title":{"rendered":"\u5927\u6a21\u578b\u8c03\u7528 MCP\uff08Model Context Protocol \u6a21\u578b\u4e0a\u4e0b\u6587\u534f\u8bae\uff09\u539f\u7406"},"content":{"rendered":"\n<p><strong>\u524d\u8a00 \ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u5f53\u5927\u6a21\u578b\u4ece\u6587\u672c\u751f\u6210\u8d70\u5411\u5de5\u5177\u8c03\u7528\u3001\u591a\u6a21\u6001\u4ea4\u4e92\u7684\u5b9e\u7528\u5316\u9636\u6bb5\uff0c\u6a21\u578b\u4e0e\u5916\u90e8\u5de5\u5177\u7684\u517c\u5bb9\u96be\u9898\u3001\u4e0a\u4e0b\u6587\u7ba1\u7406\u7684\u6548\u7387\u74f6\u9888\uff0c\u6210\u4e86\u5236\u7ea6 AI \u843d\u5730\u7684\u5173\u952e\u75db\u70b9\u3002\u800c Anthropic \u5728 2024 \u5e74\u63a8\u51fa\u7684 MCP\uff08Model Context Protocol\uff0c\u6a21\u578b\u4e0a\u4e0b\u6587\u534f\u8bae\uff09\uff0c\u6b63\u662f\u4e3a\u89e3\u51b3\u8fd9\u4e00\u884c\u4e1a\u75db\u70b9\u800c\u751f\u7684\u6807\u51c6\u5316\u65b9\u6848\u3002\u5b83\u88ab\u4e1a\u5185\u79f0\u4e3a\u5927\u6a21\u578b\u9886\u57df\u7684 \u201cUSB-C \u901a\u7528\u63a5\u53e3\u201d\uff0c\u91cd\u6784\u4e86\u5927\u6a21\u578b\u4e0e\u5916\u90e8\u8d44\u6e90\u7684\u4ea4\u4e92\u903b\u8f91\uff0c\u8ba9\u4e0d\u540c\u5927\u6a21\u578b\u3001\u5404\u7c7b\u5de5\u5177\u5b9e\u73b0 \u201c\u5373\u63d2\u5373\u7528\u201d\uff0c\u4e3a\u5927\u6a21\u578b\u7684\u5de5\u7a0b\u5316\u843d\u5730\u548c\u751f\u6001\u534f\u540c\u6253\u5f00\u4e86\u65b0\u7a7a\u95f4\u3002\u672c\u6587\u5c06\u4ece\u6838\u5fc3\u5b9a\u4e49\u3001\u6838\u5fc3\u4ef7\u503c\u3001\u843d\u5730\u67b6\u6784\u4e09\u4e2a\u7ef4\u5ea6\uff0c\u5e26\u4f60\u8bfb\u61c2 MCP \u534f\u8bae\u7684\u6838\u5fc3\u903b\u8f91\u3002<\/p>\n\n\n\n<p>\u5728 MCP \u534f\u8bae\u51fa\u73b0\u4e4b\u524d\uff0c\u5927\u6a21\u578b\u7684\u5de5\u5177\u96c6\u6210\u548c\u4e0a\u4e0b\u6587\u7ba1\u7406\u4e00\u76f4\u5b58\u5728\u4e24\u5927\u884c\u4e1a\u96be\u9898\uff1a<\/p>\n\n\n\n<ul>\n<li>\u662f\u751f\u6001\u788e\u7247\u5316\uff0c GPT \u3001Claude\u3001\u5f00\u6e90\u5927\u6a21\u578b\u7b49\u5404\u6709\u4e13\u5c5e\u7684\u5de5\u5177\u4ea4\u4e92\u63a5\u53e3\uff0c\u5f00\u53d1\u8005\u5bf9\u63a5\u4e0d\u540c\u6a21\u578b\u65f6\uff0c\u9700\u8981\u91cd\u590d\u5f00\u53d1\u9002\u914d\u4ee3\u7801\uff0c\u6548\u7387\u6781\u4f4e\u3002<\/li>\n\n\n\n<li>\u662f\u4e0a\u4e0b\u6587\u7ba1\u7406\u4f4e\u6548\uff0c\u4f20\u7edf\u5927\u6a21\u578b\u7684 \u4e0a\u4e0b\u6587\u7a97\u53e3 \u56fa\u5b9a\uff0c\u957f\u6587\u672c\u5904\u7406\u65f6\u6613\u51fa\u73b0\u4fe1\u606f\u4e22\u5931\uff0c\u4e14\u5916\u90e8\u5de5\u5177\u8c03\u7528\u7684\u4e0a\u4e0b\u6587\u65e0\u6cd5\u4e0e\u6a21\u578b\u539f\u751f\u4e0a\u4e0b\u6587\u9ad8\u6548\u534f\u540c\u3002<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"715\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-122-1024x715.png\" alt=\"\" class=\"wp-image-21108\" style=\"width:430px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-122-1024x715.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-122-300x210.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-122-768x536.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-122-830x580.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-122-230x161.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-122-350x244.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-122-480x335.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-122.png 1406w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>MCP \u534f\u8bae\u7684\u6838\u5fc3\u5b9a\u4e49\uff0c\u662f\u4e3a\u5927\u6a21\u578b\u8bbe\u8ba1\u7684\u5f00\u653e\u5f0f\u3001\u6807\u51c6\u5316\u4e0a\u4e0b\u6587\u7ba1\u7406\u4e0e\u5de5\u5177\u4ea4\u4e92\u534f\u8bae\uff0c\u5b83\u901a\u8fc7\u7edf\u4e00\u7684\u63a5\u53e3\u89c4\u8303\uff0c\u5b9e\u73b0\u4e86 \u201c\u5927\u6a21\u578b &#8211; \u4e0a\u4e0b\u6587 &#8211; \u5916\u90e8\u5de5\u5177\u201d \u7684\u5168\u94fe\u8def\u6807\u51c6\u5316\u534f\u540c\u3002\u7b80\u5355\u6765\u8bf4\uff0c\u53ea\u8981\u9075\u5faa MCP \u534f\u8bae\uff0c\u4efb\u4f55\u5927\u6a21\u578b\u90fd\u80fd\u76f4\u63a5\u5bf9\u63a5\u4efb\u4f55\u7b26\u5408\u6807\u51c6\u7684\u5916\u90e8\u5de5\u5177\uff08\u6570\u636e\u5e93\u3001\u4e91\u670d\u52a1\u3001\u672c\u5730\u5e94\u7528\u7b49\uff09\uff0c\u540c\u65f6\u5b9e\u73b0\u4e0a\u4e0b\u6587\u7684\u9ad8\u6548\u538b\u7f29\u3001\u52a8\u6001\u8c03\u5ea6\u548c\u5206\u5e03\u5f0f\u7ba1\u7406\uff0c\u8ba9\u5927\u6a21\u578b\u7684\u4e0a\u4e0b\u6587\u80fd\u529b\u4e0d\u518d\u53d7\u9650\u4e8e\u786c\u4ef6\uff0c\u5b9e\u6d4b\u53ef\u652f\u6301 1M tokens \u4ee5\u4e0a\u7684\u6709\u6548 \u4e0a\u4e0b\u6587\u957f\u5ea6 \uff0c\u5927\u5e45\u63d0\u5347\u957f\u6587\u672c\u5904\u7406\u548c\u590d\u6742\u4efb\u52a1\u6267\u884c\u80fd\u529b\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e00\u3001\u5148\u641e\u61c2\u57fa\u7840\u5b9a\u4e49<\/strong> <strong>\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\ud83d\udd391. MCP \u662f\u4ec0\u4e48<\/strong><\/p>\n\n\n\n<p><strong>MCP = Model Context Protocol\uff0c\u6a21\u578b\u4e0a\u4e0b\u6587\u534f\u8bae<\/strong>\uff0cAnthropic \u63a8\u51fa\u3001\u73b0\u5df2\u6350\u7ed9 Linux \u57fa\u91d1\u4f1a\u7684<strong>\u5f00\u6e90\u6807\u51c6\u5316\u534f\u8bae<\/strong>\uff0c\u5b9a\u4f4d\u662f<strong>\u5927\u6a21\u578b\u4e0e\u5916\u90e8\u5de5\u5177 \/ \u6587\u4ef6 \/ \u6570\u636e\u5e93 \/ API \u7684\u7edf\u4e00\u901a\u4fe1\u6807\u51c6<\/strong>\uff0c\u4e1a\u5185\u6bd4\u55bb\u4e3a <strong>AI \u4e16\u754c\u7684 USB\u2011C<\/strong>\uff0c\u4e00\u5957\u534f\u8bae\u5bf9\u63a5\u6240\u6709\u5916\u90e8\u80fd\u529b\uff0c\u4e0d\u518d\u4e3a\u6bcf\u4e2a\u5de5\u5177\u5199\u79c1\u6709\u5bf9\u63a5\u4ee3\u7801\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd392. \u4e09\u5c42\u6838\u5fc3\u67b6\u6784\uff08\u51b3\u5b9a\u8c03\u7528\u5e95\u5c42\u903b\u8f91\uff09<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"502\" src=\"https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-123-1024x502.png\" alt=\"\" class=\"wp-image-21109\" style=\"width:496px;height:auto\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-123-1024x502.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-123-300x147.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-123-768x376.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-123-830x407.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-123-230x113.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-123-350x172.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-123-480x235.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2026\/07\/\u56fe\u7247-123.png 1530w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p>\u6574\u5957\u8c03\u7528\u4e0d\u662f\u6a21\u578b\u76f4\u63a5\u53d1\u8d77\u7f51\u7edc\u8bf7\u6c42\uff0c\u800c\u662f\u4e09\u5c42\u89e3\u8026\u7ed3\u6784\uff1a<\/p>\n\n\n\n<ol>\n<li><strong>MCP Host\uff08\u5bbf\u4e3b\u5c42\uff09<\/strong> \u627f\u8f7d\u5927\u6a21\u578b\u7684\u5e94\u7528\u7a0b\u5e8f\uff1aClaude Desktop\u3001Cursor\u3001VSCode \u63d2\u4ef6\u3001\u81ea\u7814 Agent \u540e\u7aef\u3001llm \u5c01\u88c5\u670d\u52a1\u3002 \u804c\u8d23\uff1a\u8c03\u5ea6\u5168\u5c40\u3001\u5b89\u5168\u6821\u9a8c\u3001\u7ba1\u7406\u591a MCP \u8fde\u63a5\u3001\u628a\u5de5\u5177\u7ed3\u679c\u5582\u56de LLM\u3001\u6700\u7ec8\u7ed9\u7528\u6237\u8f93\u51fa\u7b54\u6848\u3002<strong>\u5927\u6a21\u578b\u53ea\u8fd0\u884c\u5728 Host \u5185\u90e8<\/strong>\u3002<\/li>\n\n\n\n<li><strong>MCP Client\uff08\u5ba2\u6237\u7aef\u4ee3\u7406\uff0c\u5185\u5d4c\u5728 Host \u91cc\uff09<\/strong> Host \u5185\u7f6e\u7684\u534f\u8bae\u901a\u4fe1\u6a21\u5757\uff0c<strong>\u6a21\u578b\u5b8c\u5168\u4e0d\u611f\u77e5 MCP \u534f\u8bae\u7ec6\u8282<\/strong>\uff0c\u7531 Client \u505a\u683c\u5f0f\u7ffb\u8bd1\uff1a\n<ul>\n<li>\u548c\u8fdc\u7aef MCP Server \u63e1\u624b\u3001\u80fd\u529b\u53d1\u73b0\uff1b<\/li>\n\n\n\n<li>LLM \u8f93\u51fa\u7684 function call \u2192 \u7ffb\u8bd1\u6210\u6807\u51c6 JSON\u2011RPC 2.0 MCP \u8bf7\u6c42\uff1b<\/li>\n\n\n\n<li>Server \u8fd4\u56de\u7ed3\u679c \u2192 \u8f6c\u56de\u6a21\u578b\u53ef\u8bc6\u522b\u7684\u4e0a\u4e0b\u6587\u6d88\u606f\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>MCP Server\uff08\u80fd\u529b\u63d0\u4f9b\u7aef\uff09<\/strong> \u72ec\u7acb\u8fdb\u7a0b \/ \u8fdc\u7a0b\u670d\u52a1\uff0c\u5c01\u88c5\u771f\u5b9e\u80fd\u529b\uff0c\u5bf9\u5916\u53ea\u66b4\u9732 MCP \u6807\u51c6\u63a5\u53e3\uff0c\u5206\u4e3a\u4e09\u7c7b\u53ef\u88ab\u6a21\u578b\u8c03\u7528\u7684\u539f\u8bed\uff1a\n<ul>\n<li><strong>Tools\uff08\u5de5\u5177\u8c03\u7528\uff09<\/strong>\uff1a\u53ef\u6267\u884c\u52a8\u4f5c\uff08\u67e5\u5929\u6c14\u3001SQL \u67e5\u8be2\u3001\u6267\u884c\u547d\u4ee4\u3001\u53d1\u63a5\u53e3\uff09\uff1b<\/li>\n\n\n\n<li><strong>Resources\uff08\u53ea\u8bfb\u8d44\u6e90\uff09<\/strong>\uff1a\u8bfb\u53d6\u6587\u4ef6\u3001\u65e5\u5fd7\u3001\u77e5\u8bc6\u5e93\u3001\u6570\u636e\u5e93\u6570\u636e\uff0c\u7eaf\u8bfb\u53d6\uff1b<\/li>\n\n\n\n<li><strong>Prompts\uff08\u9884\u8bbe\u63d0\u793a\u6a21\u677f\uff09<\/strong>\uff1a\u53ef\u590d\u7528\u4efb\u52a1\u6307\u4ee4\u6a21\u677f\u3002<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd393. \u5e95\u5c42\u901a\u4fe1\u8f7d\u4f53\uff08\u4e24\u79cd\u4f20\u8f93\uff09<\/strong><\/p>\n\n\n\n<p>\u6240\u6709\u6d88\u606f\u57fa\u4e8e <strong>JSON\u2011RPC 2.0<\/strong> \u5c01\u88c5\uff1a<\/p>\n\n\n\n<ul>\n<li>\u672c\u5730\u8c03\u7528\uff1a<strong>Stdio \u6807\u51c6\u8f93\u5165\u8f93\u51fa<\/strong>\uff08MCP Server \u4f5c\u4e3a\u5b50\u8fdb\u7a0b\u62c9\u8d77\uff0c\u8fdb\u7a0b\u95f4\u7ba1\u9053\u901a\u4fe1\uff0c\u6700\u5e38\u7528\uff09\uff1b<\/li>\n\n\n\n<li>\u8fdc\u7a0b\u8c03\u7528\uff1a<strong>Streamable HTTP\uff08\u65b0\u7248\u89c4\u8303\uff09<\/strong>\uff0c\u66ff\u4ee3\u65e7\u7248 SSE\uff0c\u652f\u6301\u8de8\u673a\u5668\u3001\u8de8\u7f51\u7edc\u8c03\u7528 MCP \u670d\u52a1\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e8c\u3001\u5927\u6a21\u578b\u300c\u53d1\u73b0 \/ \u63a2\u67e5 MCP\u300d\u539f\u7406 \ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u6a21\u578b<strong>\u4e0d\u4f1a\u4e3b\u52a8\u626b\u63cf\u7f51\u7edc\u3001\u8fdb\u7a0b<\/strong>\uff0c\u5168\u90e8\u7531 Host + MCP Client \u5b8c\u6210<strong>\u80fd\u529b\u53d1\u73b0<\/strong>\uff0c\u6a21\u578b\u53ea\u88ab\u52a8\u63a5\u6536\u5de5\u5177\u6e05\u5355\u505a\u610f\u56fe\u5224\u65ad\uff0c\u5206\u4e24\u6b65\uff1a<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u6b65\u9aa4 1\uff1aHost \u9884\u5148\u914d\u7f6e MCP Server \u5730\u5740<\/strong><\/p>\n\n\n\n<p>\u5728\u914d\u7f6e\u6587\u4ef6\u5199\u5165\u8981\u5bf9\u63a5\u7684\u6240\u6709\u670d\u52a1\uff1a<\/p>\n\n\n\n<ul>\n<li>\u672c\u5730\uff1a\u547d\u4ee4\u884c\u542f\u52a8\u8def\u5f84\uff08\u5982 <code>python weather_mcp_server.py<\/code>\uff09\uff1b<\/li>\n\n\n\n<li>\u8fdc\u7a0b\uff1aHTTP \u670d\u52a1\u5730\u5740 <code>http:\/\/xxx\/mcp<\/code>\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u6b65\u9aa4 2\uff1aClient \u53d1\u8d77\u534f\u8bae\u63e1\u624b\uff0c\u63a2\u67e5\u5168\u90e8\u53ef\u7528\u80fd\u529b\uff08\u6838\u5fc3 \u201c\u8c03\u67e5\u201d \u52a8\u4f5c\uff09<\/strong><\/p>\n\n\n\n<ol>\n<li><strong>\u65e7\u7248 MCP\uff08\u6709\u72b6\u6001\uff09<\/strong> Client \u53d1\u9001 <code>initialize<\/code> JSON\u2011RPC \u63e1\u624b\u8bf7\u6c42\uff0c\u534f\u5546\u534f\u8bae\u7248\u672c\u3001\u53cc\u65b9\u652f\u6301\u80fd\u529b\uff1b Server \u8fd4\u56de<strong>\u5b8c\u6574\u5de5\u5177\u5217\u8868 + JSON Schema \u53c2\u6570\u5b9a\u4e49 + \u5de5\u5177\u63cf\u8ff0<\/strong>\u3002<\/li>\n\n\n\n<li><strong>2026\u201107\u201128 \u65b0\u7248\u65e0\u72b6\u6001 MCP<\/strong> \u53d6\u6d88\u5f3a\u5236\u63e1\u624b\uff0c\u7528 <code>server\/discover<\/code> \u65b9\u6cd5\u4e3b\u52a8\u63a2\u6d4b Server \u66b4\u9732\u7684 Tools\/Resources\/Prompts\uff0c\u4e00\u6b21\u6027\u62c9\u53d6\u6240\u6709\u53ef\u8c03\u7528\u80fd\u529b\u6e05\u5355\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd39\u6b65\u9aa4 3\uff1aHost \u628a\u5de5\u5177\u63cf\u8ff0\u6ce8\u5165\u5927\u6a21\u578b\u4e0a\u4e0b\u6587<\/strong><\/p>\n\n\n\n<p>Host \u5c06\u63a2\u67e5\u5f97\u5230\u7684\u6240\u6709\u5de5\u5177\u540d\u79f0\u3001\u529f\u80fd\u8bf4\u660e\u3001\u5165\u53c2\u683c\u5f0f\uff0c\u4ee5<strong>\u7cfb\u7edf\u63d0\u793a\u8bcd\uff08System Prompt\uff09+ \u5de5\u5177\u5b9a\u4e49 JSON<\/strong> \u585e\u8fdb LLM \u8f93\u5165\u7a97\u53e3\u3002<\/p>\n\n\n\n<p>\ud83d\udc49 <strong>\u81f3\u6b64\u6a21\u578b\u624d\u7b97 \u201c\u77e5\u9053\u6709\u54ea\u4e9b MCP \u80fd\u529b\u53ef\u4ee5\u8c03\u7528\u201d<\/strong>\uff0c\u63a2\u67e5\u52a8\u4f5c\u7ed3\u675f\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\u5173\u952e\u70b9\uff1a\u6a21\u578b\u672c\u8eab\u6ca1\u6709\u4efb\u4f55\u7f51\u7edc \/ \u8fdb\u7a0b\u63a2\u67e5\u80fd\u529b\uff0cMCP \u670d\u52a1\u53d1\u73b0\u5b8c\u5168\u662f\u5e94\u7528\u5c42\uff08Host\/Client\uff09\u5b8c\u6210\uff0c\u6a21\u578b\u53ea\u505a\u8bed\u4e49\u7406\u89e3\u4e0e\u8c03\u7528\u51b3\u7b56\u3002<\/pre>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e09\u3001\u5927\u6a21\u578b\u5b8c\u6574\u8c03\u7528 MCP \u5168\u94fe\u8def 7 \u6b65\u539f\u7406\uff08\u6700\u6838\u5fc3\uff09<\/strong> <strong>\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u4ee5\u7528\u6237\u63d0\u95ee\uff1a<strong>\u201c\u5e2e\u6211\u67e5\u5317\u4eac\u4eca\u5929\u5929\u6c14\u201d<\/strong> \u4e3e\u4f8b\uff1a<\/p>\n\n\n\n<p><strong>\ud83d\udd391. \u7528\u6237\u8f93\u5165 \u2192 Host \u63a5\u6536\uff0c\u643a\u5e26\u5df2\u53d1\u73b0\u7684 MCP \u5de5\u5177\u96c6<\/strong><\/p>\n\n\n\n<p>Host \u628a\u7528\u6237\u95ee\u9898 + \u524d\u9762\u63a2\u6d4b\u5230\u7684 <code>get_weather<\/code> \u5de5\u5177 Schema \u4e00\u8d77\u53d1\u7ed9 LLM\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd392. LLM \u505a\u610f\u56fe\u5224\u65ad\uff0c\u8f93\u51fa\u7ed3\u6784\u5316\u5de5\u5177\u8c03\u7528\uff08Function Calling\uff09<\/strong><\/p>\n\n\n\n<p>\u5927\u6a21\u578b\u7406\u89e3\u9700\u8981\u5916\u90e8\u6570\u636e\uff0c\u4e0d\u76f4\u63a5\u56de\u7b54\u6587\u672c\uff0c\u8f93\u51fa\u89c4\u8303\u7ed3\u6784\u5316\u8c03\u7528\u6307\u4ee4\uff08OpenAI\/Claude \u6807\u51c6 tool_call\uff09\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n  \"tool_calls\": [\n    {\n      \"name\": \"get_weather\",\n      \"arguments\": {\"city\": \"\u5317\u4eac\"}\n    }\n  ]\n}<\/pre>\n\n\n\n<p>\u6a21\u578b\u53ea\u8f93\u51fa\u8981\u8c03\u7528\u54ea\u4e2a\u5de5\u5177\u3001\u4f20\u4ec0\u4e48\u53c2\u6570\uff0c\u5b8c\u5168\u4e0d\u77e5\u9053 MCP\u3001JSON\u2011RPC\u3001\u8fdb\u7a0b\u901a\u4fe1\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd393. MCP Client \u505a\u534f\u8bae\u8f6c\u8bd1\uff1aLLM \u8c03\u7528 \u2192 MCP \u6807\u51c6 JSON\u2011RPC \u8bf7\u6c42<\/strong><\/p>\n\n\n\n<p>Host \u62e6\u622a\u6a21\u578b\u8f93\u51fa\u7684 tool_call\uff0c\u7531\u5185\u7f6e MCP Client \u7ffb\u8bd1\u6210\u534f\u8bae\u62a5\u6587\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n  \"jsonrpc\":\"2.0\",\n  \"id\":1,\n  \"method\":\"call_tool\",\n  \"params\":{\n    \"name\":\"get_weather\",\n    \"arguments\":{\"city\":\"\u5317\u4eac\"}\n  }\n}<\/pre>\n\n\n\n<p>\u901a\u8fc7 Stdio \/ HTTP \u53d1\u7ed9\u5bf9\u5e94\u7684 MCP Server\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd394. MCP Server \u89e3\u6790\u8bf7\u6c42\uff0c\u6267\u884c\u771f\u5b9e\u4e1a\u52a1\u903b\u8f91<\/strong><\/p>\n\n\n\n<p>Server \u6536\u5230 <code>call_tool<\/code> \u65b9\u6cd5\uff0c\u5339\u914d\u5185\u90e8\u6ce8\u518c\u7684\u51fd\u6570\uff0c\u8c03\u7528\u5929\u6c14\u7b2c\u4e09\u65b9\u63a5\u53e3\u62ff\u5230\u6570\u636e\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd395. Server \u5c06\u6267\u884c\u7ed3\u679c\u6309 MCP \u89c4\u8303\u539f\u8def\u8fd4\u56de\u7ed9 Client<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n  \"jsonrpc\":\"2.0\",\n  \"id\":1,\n  \"result\":{\n    \"temperature\":28,\n    \"condition\":\"\u6674\"\n  }\n}<\/pre>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd396. Host \u628a\u5de5\u5177\u6267\u884c\u7ed3\u679c\u4e8c\u6b21\u5c01\u88c5\u6210\u5bf9\u8bdd\u6d88\u606f\uff0c\u56de\u586b\u7ed9 LLM<\/strong><\/p>\n\n\n\n<p>Host \u628a\u8fd4\u56de\u6570\u636e\u5305\u88c5\u6210 <code>tool<\/code> \u89d2\u8272\u6d88\u606f\uff0c\u8ffd\u52a0\u5230\u5bf9\u8bdd\u4e0a\u4e0b\u6587\uff0c\u518d\u6b21\u9001\u5165\u5927\u6a21\u578b\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd397. LLM \u7ed3\u5408\u539f\u59cb\u95ee\u9898 + \u5de5\u5177\u8fd4\u56de\u6570\u636e\uff0c\u751f\u6210\u6700\u7ec8\u81ea\u7136\u8bed\u8a00\u7b54\u6848<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\u5317\u4eac\u4eca\u65e5\u6674\u5929\uff0c\u6c14\u6e29 28 \u6444\u6c0f\u5ea6\u3002\n<\/pre>\n\n\n\n<p>\u5faa\u73af\u673a\u5236\uff08\u591a\u8f6e\u8c03\u7528\uff09\uff1a\u5982\u679c\u4e00\u6b21\u8c03\u7528\u4e0d\u591f\uff08\u6bd4\u5982\u67e5\u6570\u636e\u5e93\u2192\u518d\u8ba1\u7b97\u2192\u518d\u67e5\u6587\u4ef6\uff09\uff0c\u6a21\u578b\u4f1a\u91cd\u590d\u6b65\u9aa4 2\u20136\uff0cHost \u5faa\u73af\u8c03\u5ea6 MCP \u8c03\u7528\uff0c\u76f4\u5230\u65e0\u9700\u5916\u90e8\u5de5\u5177\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u56db\u3001\u5173\u952e\u5e95\u5c42\u6280\u672f\u7ec6\u8282\uff08\u5bb9\u6613\u6df7\u6dc6\u70b9\uff09<\/strong> <strong>\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>\ud83d\udd391. MCP vs \u539f\u751f Function Calling \u533a\u522b<\/strong><\/p>\n\n\n\n<ul>\n<li><strong>Function Calling<\/strong>\uff1a\u662f<strong>\u5927\u6a21\u578b\u8f93\u51fa\u7ed3\u6784\u5316\u8c03\u7528\u683c\u5f0f\u7684\u80fd\u529b<\/strong>\uff08\u6a21\u578b\u4fa7\u80fd\u529b\uff09\uff1b<\/li>\n\n\n\n<li><strong>MCP<\/strong>\uff1a\u662f<strong>\u8c03\u7528\u4e4b\u540e\uff0c\u5e94\u7528\u5c42\u5982\u4f55\u6807\u51c6\u5316\u8f6c\u53d1\u7ed9\u5916\u90e8\u670d\u52a1\u7684\u901a\u4fe1\u534f\u8bae<\/strong>\uff08\u5e94\u7528\u5c42\u901a\u4fe1\u6807\u51c6\uff09\uff1b \u4e8c\u8005\u662f\u4e0a\u4e0b\u6e38\u5173\u7cfb\uff1aLLM \u8f93\u51fa FC \u2192 MCP \u8d1f\u8d23\u8de8\u8fdb\u7a0b \/ \u8de8\u7f51\u7edc\u8def\u7531\u6267\u884c\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd392. \u6743\u9650\u4e0e\u5b89\u5168\u9694\u79bb\u8bbe\u8ba1\uff08MCP \u5185\u7f6e\uff09<\/strong><\/p>\n\n\n\n<ol>\n<li>Host \u7edf\u4e00\u7ba1\u63a7 MCP Server \u542f\u505c\u3001\u8bbf\u95ee\u6743\u9650\uff1b<\/li>\n\n\n\n<li>Server \u53ef\u5bf9 Tools \u505a\u6743\u9650\u6821\u9a8c\u3001\u53c2\u6570\u767d\u540d\u5355\u3001\u6267\u884c\u5ba1\u6279\uff1b<\/li>\n\n\n\n<li>\u672c\u5730 Stdio \u5b50\u8fdb\u7a0b\u5929\u7136\u505a\u8fdb\u7a0b\u6c99\u7bb1\u9694\u79bb\uff0c\u9632\u6b62\u6a21\u578b\u8d8a\u6743\u64cd\u4f5c\u672c\u5730\u6587\u4ef6\uff1b<\/li>\n\n\n\n<li>\u65b0\u7248\u65e0\u72b6\u6001\u8bf7\u6c42\u81ea\u5e26\u7b7e\u540d\u3001\u53c2\u6570\u6821\u9a8c\uff0c\u9632\u7be1\u6539\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\ud83d\udd393. \u53cc\u5411\u53cd\u5411\u8c03\u7528\uff1aServer \u4e5f\u53ef\u901a\u8fc7 MCP \u8c03\u7528\u5927\u6a21\u578b<\/strong><\/p>\n\n\n\n<p>MCP \u4e0d\u6b62\u662f\u6a21\u578b\u8c03\u7528\u5de5\u5177\uff0cServer \u53ef\u53d1\u9001 <code>sampling\/createMessage<\/code> \u8bf7\u6c42\uff0c\u53cd\u5411\u8ba9 Host \u8c03\u5ea6 LLM \u505a\u4e8c\u6b21\u63a8\u7406\uff0c\u9002\u5408\u590d\u6742 Agent \u5d4c\u5957\u573a\u666fModel Cont&#8230;\u3002<\/p>\n\n\n\n<p>\u3000\u3000<\/p>\n\n\n\n<p><strong>\u4e94\u3001\u4e00\u53e5\u8bdd\u603b\u7ed3<\/strong> <strong>\ud83d\udd16<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<ul>\n<li><strong>\u63a2\u67e5 \/ \u8c03\u67e5 MCP<\/strong>\uff1a\u7531\u5e94\u7528\u7aef Host+MCP Client \u901a\u8fc7 <code>initialize\/discover<\/code> \u534f\u8bae\u63e1\u624b\uff0c\u62c9\u53d6\u6240\u6709\u670d\u52a1\u80fd\u529b\u5217\u8868\uff0c\u6ce8\u5165\u7ed9\u5927\u6a21\u578b\uff0c\u6a21\u578b\u4ec5\u505a\u610f\u56fe\u8bc6\u522b\uff1b <\/li>\n\n\n\n<li><strong>\u8c03\u7528 MCP \u539f\u7406<\/strong>\uff1aLLM \u539f\u751f Function Calling \u8f93\u51fa\u8c03\u7528\u610f\u56fe \u2192 MCP Client \u8f6c JSON\u2011RPC \u534f\u8bae \u2192 MCP Server \u6267\u884c\u771f\u5b9e\u903b\u8f91 \u2192 \u7ed3\u679c\u56de\u704c\u6a21\u578b\u751f\u6210\u6700\u7ec8\u56de\u7b54\uff0c\u5168\u7a0b\u6a21\u578b\u53ea\u8d1f\u8d23\u601d\u8003\uff0c\u901a\u4fe1\u6267\u884c\u7531\u534f\u8bae\u5c42\u5b8c\u6210\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \ud83d\udd16 \u5f53\u5927\u6a21\u578b\u4ece\u6587\u672c\u751f\u6210\u8d70\u5411\u5de5\u5177\u8c03\u7528\u3001\u591a\u6a21\u6001\u4ea4\u4e92\u7684\u5b9e\u7528\u5316\u9636\u6bb5\uff0c\u6a21\u578b\u4e0e\u5916\u90e8\u5de5\u5177\u7684\u517c\u5bb9\u96be\u9898\u3001\u4e0a\u4e0b\u6587\u7ba1\u7406\u7684\u6548\u7387\u74f6 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[48],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/21106"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=21106"}],"version-history":[{"count":1,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/21106\/revisions"}],"predecessor-version":[{"id":21110,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/21106\/revisions\/21110"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=21106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=21106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=21106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}