{"id":113729,"date":"2026-10-07T09:41:25","date_gmt":"2026-10-07T01:41:25","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/113729.html"},"modified":"2026-10-07T09:41:25","modified_gmt":"2026-10-07T01:41:25","slug":"%e7%94%a8-rust-%e4%b8%8e-rmcp-%e4%bb%8e%e9%9b%b6%e6%9e%84%e5%bb%ba-mcp-%e8%ae%a1%e7%ae%97%e5%99%a8%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%9atool_router-%e5%ae%8f%e3%80%81stdio-%e4%bc%a0%e8%be%93%e4%b8%8e-in","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/113729.html","title":{"rendered":"\u7528 Rust \u4e0e rmcp \u4ece\u96f6\u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668\uff1atool_router \u5b8f\u3001stdio \u4f20\u8f93\u4e0e Inspector \u8c03\u8bd5\u5b9e\u6218"},"content":{"rendered":"<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u6559\u7a0b<\/span><\/li>\n<li><span class=\"gcb-tag\">\u6587\u6863<\/span><\/li>\n<li><span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011mcp-for-beginners<\/h3>\n<p class=\"gcb-project-desc\">This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/GitHub_Trending\/mc\/mcp-for-beginners<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<p>Model Context Protocol&#xff08;MCP&#xff09;\u4e3a AI \u5e94\u7528\u63d0\u4f9b\u4e86\u4e00\u5957\u6807\u51c6\u5316\u7684&#034;\u4e0a\u4e0b\u6587\u8fde\u63a5&#034;\u65b9\u5f0f&#xff0c;\u800c Rust \u51ed\u501f\u5176\u5185\u5b58\u5b89\u5168\u4e0e\u9ad8\u6027\u80fd\u7279\u6027&#xff0c;\u6210\u4e3a\u5b9e\u73b0 MCP \u670d\u52a1\u5668\u7684\u7406\u60f3\u8bed\u8a00\u4e4b\u4e00\u3002\u672c\u7bc7\u6280\u672f\u6307\u5357\u4ee5 mcp-for-beginners \u5f00\u6e90\u8bfe\u7a0b\u4e2d\u7684 Rust \u793a\u4f8b \u4e3a\u9aa8\u67b6&#xff0c;\u7ed3\u5408\u4ed3\u5e93\u5185\u7684 \u5b8c\u6574\u6e90\u7801 \u4e0e Cargo.toml&#xff0c;\u9010\u884c\u5256\u6790\u5982\u4f55\u57fa\u4e8e rmcp SDK \u6784\u5efa\u4e00\u4e2a\u901a\u8fc7\u6807\u51c6\u8f93\u5165\u8f93\u51fa&#xff08;stdio&#xff09;\u8fd0\u884c\u7684 MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668\u3002\u8bfb\u5b8c\u672c\u6587&#xff0c;\u4f60\u5c06\u638c\u63e1 #[tool_router] \/ #[tool] \u8fc7\u7a0b\u5b8f\u7684\u7528\u6cd5\u3001\u5de5\u5177\u53c2\u6570\u7684\u7ed3\u6784\u5316\u58f0\u660e\u65b9\u5f0f\u3001ServerHandler \u7684\u670d\u52a1\u5668\u5143\u4fe1\u606f\u914d\u7f6e&#xff0c;\u4ee5\u53ca\u4f7f\u7528 MCP Inspector \u5bf9\u5de5\u5177\u8fdb\u884c\u7aef\u5230\u7aef\u8c03\u7528\u9a8c\u8bc1\u7684\u5b8c\u6574\u5b9e\u6218\u65b9\u6848\u3002<\/p>\n<h3>\u793a\u4f8b\u6982\u89c8&#xff1a;\u4e00\u4e2a\u56db\u5219\u8fd0\u7b97\u7684 MCP \u670d\u52a1\u5668<\/h3>\n<p>\u4ed3\u5e93\u4e2d\u7684 Rust \u793a\u4f8b \u662f\u4e00\u4e2a\u9ebb\u96c0\u867d\u5c0f\u4e94\u810f\u4ff1\u5168\u7684 MCP \u670d\u52a1\u5668&#xff1a;\u5b83\u6ce8\u518c\u4e86 add&#xff08;\u52a0\u6cd5&#xff09;\u3001subtract&#xff08;\u51cf\u6cd5&#xff09;\u3001multiply&#xff08;\u4e58\u6cd5&#xff09;\u3001divide&#xff08;\u9664\u6cd5&#xff09;\u56db\u4e2a\u5de5\u5177&#xff0c;\u5168\u90e8\u901a\u8fc7 rmcp \u6846\u67b6\u7684\u58f0\u660e\u5f0f\u5b8f\u66b4\u9732\u7ed9\u4efb\u610f MCP \u5ba2\u6237\u7aef\u8c03\u7528\u3002\u6574\u4e2a\u9879\u76ee\u4ec5\u5305\u542b\u4e00\u4e2a src\/main.rs&#xff08;\u7ea6 83 \u884c&#xff09;&#xff0c;\u914d\u5408 Cargo.toml \u4e2d\u6781\u7b80\u7684\u4f9d\u8d56\u58f0\u660e\u5373\u53ef\u8fd0\u884c&#xff0c;\u975e\u5e38\u9002\u5408\u4f5c\u4e3a\u5b66\u4e60 MCP \u670d\u52a1\u5668\u5f00\u53d1\u7684\u7b2c\u4e00\u5757\u8df3\u677f\u3002<\/p>\n<p>\u4ece\u534f\u8bae\u5c42\u9762\u770b&#xff0c;\u8fd9\u4e2a\u793a\u4f8b\u6f14\u793a\u4e86 MCP \u670d\u52a1\u5668\u7aef\u4e09\u4e2a\u5173\u952e\u7ec4\u6210\u90e8\u5206&#xff1a;<\/p>\n<ul>\n<li>\u5de5\u5177&#xff08;Tools&#xff09;&#xff1a;\u6a21\u578b\u53ef\u8c03\u7528\u7684\u51fd\u6570&#xff0c;\u672c\u793a\u4f8b\u4e2d\u7684\u56db\u4e2a\u8ba1\u7b97\u51fd\u6570\u5373\u4e3a\u5de5\u5177&#xff1b;<\/li>\n<li>\u80fd\u529b\u58f0\u660e&#xff08;Capabilities&#xff09;&#xff1a;\u670d\u52a1\u5668\u901a\u8fc7 ServerCapabilities::builder().enable_tools() \u5411\u5ba2\u6237\u7aef\u5ba3\u544a\u81ea\u5df1\u652f\u6301\u5de5\u5177\u8c03\u7528&#xff1b;<\/li>\n<li>\u4f20\u8f93\u5c42&#xff08;Transport&#xff09;&#xff1a;\u901a\u8fc7 stdio() \u5728\u6807\u51c6\u8f93\u5165\/\u8f93\u51fa\u4e0a\u627f\u8f7d MCP JSON-RPC \u6d88\u606f&#xff0c;\u8fd9\u662f\u672c\u5730 MCP \u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u901a\u4fe1\u7684\u63a8\u8350\u6807\u51c6&#xff0c;\u5177\u5907\u5b50\u8fdb\u7a0b\u9694\u79bb\u7684\u5929\u7136\u5b89\u5168\u4f18\u52bf\u3002<\/li>\n<\/ul>\n<h3>\u9879\u76ee\u7ed3\u6784\u4e0e\u4f9d\u8d56\u58f0\u660e<\/h3>\n<p>\u793a\u4f8b\u9879\u76ee\u7ed3\u6784\u975e\u5e38\u6e05\u6670&#xff1a;<\/p>\n<p>03-GettingStarted\/samples\/rust\/<br \/>\n\u251c\u2500\u2500 Cargo.toml     # \u5305\u5143\u6570\u636e\u4e0e\u4f9d\u8d56<br \/>\n\u251c\u2500\u2500 Cargo.lock     # \u4f9d\u8d56\u9501\u5b9a\u6587\u4ef6<br \/>\n\u251c\u2500\u2500 README.md      # \u793a\u4f8b\u8bf4\u660e&#xff08;\u82f1\u6587\u539f\u7248&#xff09;<br \/>\n\u2514\u2500\u2500 src\/<br \/>\n    \u2514\u2500\u2500 main.rs    # \u5168\u90e8\u670d\u52a1\u5668\u5b9e\u73b0<\/p>\n<p>\u67e5\u770b Cargo.toml&#xff0c;\u53ef\u4ee5\u770b\u5230\u8fd9\u4efd\u4f9d\u8d56\u6e05\u5355\u6b63\u662f\u8ba9 MCP \u670d\u52a1\u5668\u8fd0\u8f6c\u7684\u6838\u5fc3&#xff1a;<\/p>\n<p>[package]<br \/>\nname &#061; &#034;calculator&#034;<br \/>\nversion &#061; &#034;1.0.0&#034;<br \/>\nedition &#061; &#034;2024&#034;<\/p>\n<p>[dependencies]<br \/>\nrmcp &#061; { version &#061; &#034;2.1.0&#034;, features &#061; [&#034;server&#034;, &#034;transport-io&#034;] }<br \/>\nserde &#061; &#034;1.0.219&#034;<br \/>\ntokio &#061; { version &#061; &#034;1.46.0&#034;, features &#061; [&#034;rt-multi-thread&#034;] }<\/p>\n<p>[dev-dependencies]<br \/>\nslab &#061; &#034;0.4.11&#034;<\/p>\n<p>\u4e09\u4e2a\u4f9d\u8d56\u5404\u53f8\u5176\u804c&#xff1a;<\/p>\n<table>\n<tr>\u4f9d\u8d56\u7528\u9014\u5173\u952e\u914d\u7f6e\u8bf4\u660e<\/tr>\n<tbody>\n<tr>\n<td>rmcp<\/td>\n<td>Rust \u5b98\u65b9 MCP \u534f\u8bae SDK&#xff08;Rust Model Context Protocol&#xff09;<\/td>\n<td>server \u7279\u6027\u5f00\u542f\u670d\u52a1\u5668\u7aef\u80fd\u529b&#xff0c;transport-io \u63d0\u4f9b stdio \u4f20\u8f93\u5b9e\u73b0&#xff1b;\u7248\u672c\u9501\u5b9a\u4e3a 2.1.0<\/td>\n<\/tr>\n<tr>\n<td>serde<\/td>\n<td>\u5de5\u5177\u53c2\u6570\u7684\u5e8f\u5217\u5316\/\u53cd\u5e8f\u5217\u5316<\/td>\n<td>\u4e0e schemars \u914d\u5408&#xff0c;\u4ece Rust \u7ed3\u6784\u4f53\u81ea\u52a8\u751f\u6210\u5de5\u5177\u5165\u53c2\u7684 JSON Schema<\/td>\n<\/tr>\n<tr>\n<td>tokio<\/td>\n<td>\u5f02\u6b65\u8fd0\u884c\u65f6<\/td>\n<td>\u542f\u7528 rt-multi-thread \u591a\u7ebf\u7a0b\u8fd0\u884c\u65f6&#xff0c;\u652f\u6491 #[tokio::main] \u5165\u53e3\u4e0e\u5f02\u6b65\u5de5\u5177\u51fd\u6570<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>edition &#061; &#034;2024&#034; \u8868\u793a\u9879\u76ee\u4f7f\u7528 Rust 2024 edition&#xff0c;\u9700\u8981\u8f83\u65b0\u7684 Rust \u5de5\u5177\u94fe\u652f\u6301\u3002\u6b64\u5916&#xff0c;rmcp \u5185\u90e8\u4f1a\u7528\u5230 schemars&#xff08;\u901a\u8fc7 #[tool_router] \u5b8f\u9690\u5f0f\u96c6\u6210&#xff09;&#xff0c;\u7528\u4e8e\u628a\u5de5\u5177\u53c2\u6570\u7ed3\u6784\u4f53\u7f16\u8bd1\u4e3a\u53ef\u4f9b LLM \u4e0e\u5ba2\u6237\u7aef\u7406\u89e3\u7684 JSON Schema\u3002<\/p>\n<h3>\u6838\u5fc3\u5b9e\u73b0\u9010\u6bb5\u62c6\u89e3<\/h3>\n<h4>1. \u5f15\u5165 SDK \u6a21\u5757<\/h4>\n<p>src\/main.rs \u7684\u7b2c\u4e00\u6bb5\u4ee3\u7801\u5b8c\u6210\u4e86\u6240\u6709\u5fc5\u8981\u7684\u5bfc\u5165&#xff1a;<\/p>\n<p>use rmcp::{<br \/>\n    ServerHandler, ServiceExt,<br \/>\n    handler::server::{router::tool::ToolRouter, tool::Parameters},<br \/>\n    model::{ServerCapabilities, ServerInfo},<br \/>\n    schemars, tool, tool_handler, tool_router,<br \/>\n    transport::stdio,<br \/>\n};<br \/>\nuse std::error::Error;<\/p>\n<p>\u8fd9\u91cc\u6bcf\u4e2a\u7b26\u53f7\u90fd\u6709\u660e\u786e\u804c\u8d23&#xff1a;<\/p>\n<ul>\n<li>ServerHandler&#xff1a;MCP \u670d\u52a1\u5668\u4e3b\u5904\u7406\u5668 trait&#xff0c;\u5b9e\u73b0\u5b83\u5373\u53ef\u5411\u5ba2\u6237\u7aef\u63d0\u4f9b\u670d\u52a1\u5668\u4fe1\u606f\u4e0e\u80fd\u529b&#xff1b;<\/li>\n<li>ServiceExt&#xff1a;\u4e3a\u670d\u52a1\u5668\u7c7b\u578b\u63d0\u4f9b serve() \u4e0e waiting() \u7b49\u751f\u547d\u5468\u671f\u65b9\u6cd5&#xff1b;<\/li>\n<li>ToolRouter&#xff1a;\u5de5\u5177\u8def\u7531\u5668\u7c7b\u578b&#xff0c;\u8d1f\u8d23\u805a\u5408\u548c\u5206\u53d1\u6ce8\u518c\u7684\u5de5\u5177&#xff1b;<\/li>\n<li>Parameters&#xff1a;\u5de5\u5177\u53c2\u6570\u7684\u5305\u88c5\u7c7b\u578b&#xff0c;\u7528\u4e8e\u5728\u51fd\u6570\u7b7e\u540d\u4e2d\u89e3\u6784\u51fa\u7ed3\u6784\u5316\u5165\u53c2&#xff1b;<\/li>\n<li>ServerCapabilities \/ ServerInfo&#xff1a;\u670d\u52a1\u5668\u80fd\u529b\u4e0e\u5143\u4fe1\u606f\u6a21\u578b&#xff1b;<\/li>\n<li>schemars&#xff1a;JSON Schema \u751f\u6210\u652f\u6301&#xff08;\u7ecf tool_router \u5b8f\u5f15\u5165&#xff09;&#xff1b;<\/li>\n<li>tool\u3001tool_handler\u3001tool_router&#xff1a;\u4e09\u4e2a\u6838\u5fc3\u8fc7\u7a0b\u5b8f&#xff1b;<\/li>\n<li>transport::stdio&#xff1a;\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u4f20\u8f93\u6784\u9020\u5668\u3002<\/li>\n<\/ul>\n<h4>2. \u58f0\u660e\u5de5\u5177\u53c2\u6570\u7ed3\u6784\u4f53<\/h4>\n<p>#[derive(Debug, serde::Deserialize, schemars::JsonSchema)]<br \/>\npub struct CalculatorRequest {<br \/>\n    pub a: f64,<br \/>\n    pub b: f64,<br \/>\n}<\/p>\n<p>CalculatorRequest \u5b9a\u4e49\u4e86\u5de5\u5177\u5165\u53c2\u7684\u7ed3\u6784&#xff1a;\u4e24\u4e2a f64 \u6d6e\u70b9\u6570\u5b57 a \u548c b\u3002derive \u7684\u4e09\u4e2a trait \u7f3a\u4e00\u4e0d\u53ef&#xff1a;<\/p>\n<ul>\n<li>Debug&#xff1a;\u4fbf\u4e8e\u8c03\u8bd5\u8f93\u51fa&#xff1b;<\/li>\n<li>serde::Deserialize&#xff1a;\u628a\u5ba2\u6237\u7aef\u4f20\u6765\u7684 JSON \u53c2\u6570\u53cd\u5e8f\u5217\u5316\u4e3a Rust \u7ed3\u6784\u4f53&#xff1b;<\/li>\n<li>schemars::JsonSchema&#xff1a;\u81ea\u52a8\u751f\u6210\u53c2\u6570\u7684 JSON Schema&#xff0c;\u4f9b\u5ba2\u6237\u7aef&#xff08;\u5c24\u5176\u662f LLM&#xff09;\u4e86\u89e3\u5de5\u5177\u7684\u8f93\u5165\u7ea6\u675f\u2014\u2014\u8fd9\u662f MCP \u5de5\u5177\u53ef\u88ab\u6a21\u578b&#034;\u7406\u89e3\u5e76\u6b63\u786e\u8c03\u7528&#034;\u7684\u5173\u952e\u673a\u5236\u3002<\/li>\n<\/ul>\n<h4>3. \u670d\u52a1\u5668\u7ed3\u6784\u4e0e #[tool_router] \u5b8f<\/h4>\n<p>#[derive(Debug, Clone)]<br \/>\npub struct Calculator {<br \/>\n    tool_router: ToolRouter&lt;Self&gt;,<br \/>\n}<\/p>\n<p>#[tool_router]<br \/>\nimpl Calculator {<br \/>\n    pub fn new() -&gt; Self {<br \/>\n        Self {<br \/>\n            tool_router: Self::tool_router(),<br \/>\n        }<br \/>\n    }<\/p>\n<p>    #[tool(description &#061; &#034;Adds a and b&#034;)]<br \/>\n    async fn add(<br \/>\n        &amp;self,<br \/>\n        Parameters(CalculatorRequest { a, b }): Parameters&lt;CalculatorRequest&gt;,<br \/>\n    ) -&gt; String {<br \/>\n        (a &#043; b).to_string()<br \/>\n    }<\/p>\n<p>    \/\/ subtract \/ multiply \/ divide \u7ed3\u6784\u76f8\u540c\u2026\u2026<br \/>\n}<\/p>\n<p>\u4ece\u6e90\u7801\u7ed3\u6784\u53ef\u4ee5\u6e05\u6670\u770b\u5230 #[tool_router] \u5b8f\u7684\u5de5\u4f5c\u65b9\u5f0f&#xff1a;\u5b83\u626b\u63cf impl Calculator \u5757\u5185\u6240\u6709\u6807\u6ce8\u4e86 #[tool(description &#061; &#034;&#8230;&#034;)] \u7684\u65b9\u6cd5&#xff0c;\u81ea\u52a8\u751f\u6210\u4e00\u4e2a Self::tool_router() \u5173\u8054\u51fd\u6570&#xff0c;\u628a\u6bcf\u4e2a\u5de5\u5177\u65b9\u6cd5\u6ce8\u518c\u8fdb ToolRouter&lt;Self&gt;\u3002new() \u6784\u9020\u51fd\u6570\u5728\u521d\u59cb\u5316\u65f6\u5373\u8c03\u7528\u8be5\u751f\u6210\u51fd\u6570\u5b8c\u6210\u5de5\u5177\u6ce8\u518c&#xff0c;\u4ece\u800c\u8ba9&#034;\u6ce8\u518c\u5de5\u5177&#034;\u8fd9\u4e00\u52a8\u4f5c\u5b8c\u5168\u58f0\u660e\u5316\u2014\u2014\u5f00\u53d1\u8005\u53ea\u9700\u5199\u666e\u901a\u65b9\u6cd5&#xff0c;\u5b8f\u8d1f\u8d23\u751f\u6210\u534f\u8bae\u6240\u9700\u7684\u6ce8\u518c\u4e0e\u8def\u7531\u903b\u8f91\u3002<\/p>\n<p>\u56db\u4e2a\u5de5\u5177\u65b9\u6cd5\u9010\u4e00\u89e3\u6790&#xff1a;<\/p>\n<table>\n<tr>\u5de5\u5177\u884c\u4e3a\u8fb9\u754c\u5904\u7406<\/tr>\n<tbody>\n<tr>\n<td>add<\/td>\n<td>\u8fd4\u56de a &#043; b<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>subtract<\/td>\n<td>\u8fd4\u56de a &#8211; b<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>multiply<\/td>\n<td>\u8fd4\u56de a * b<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>divide<\/td>\n<td>\u8fd4\u56de a \/ b<\/td>\n<td>\u5f53 b &#061;&#061; 0.0 \u65f6\u8fd4\u56de\u9519\u8bef\u5b57\u7b26\u4e32 &#034;Error: Division by zero&#034;&#xff0c;\u907f\u514d\u6d6e\u70b9\u9664\u96f6\u5f02\u5e38<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u503c\u5f97\u6ce8\u610f\u7684\u7ec6\u8282&#xff1a;<\/p>\n<ul>\n<li>\u6bcf\u4e2a\u5de5\u5177\u65b9\u6cd5\u90fd\u8fd4\u56de String&#xff0c;\u8fd9\u662f MCP \u5de5\u5177\u7ea6\u5b9a\u7684\u4e00\u79cd\u6587\u672c\u7ed3\u679c\u683c\u5f0f&#xff0c;\u5ba2\u6237\u7aef\u53ef\u76f4\u63a5\u6d88\u8d39&#xff1b;<\/li>\n<li>\u53c2\u6570\u901a\u8fc7\u6a21\u5f0f\u89e3\u6784 Parameters(CalculatorRequest { a, b }) \u4e00\u6b21\u6027\u62c6\u51fa\u4e24\u4e2a\u5b57\u6bb5&#xff0c;\u8bed\u6cd5\u7d27\u51d1&#xff1b;<\/li>\n<li>description \u5143\u6570\u636e\u4f1a\u88ab\u5b8f\u5199\u5165\u5de5\u5177 schema&#xff0c;\u5411\u5ba2\u6237\u7aef\u63cf\u8ff0\u5de5\u5177\u7684\u7528\u9014&#xff0c;\u662f LLM \u51b3\u5b9a\u4f55\u65f6\u8c03\u7528\u54ea\u4e2a\u5de5\u5177\u7684\u76f4\u63a5\u4f9d\u636e&#xff1b;<\/li>\n<li>\u9664\u96f6\u573a\u666f\u4ee5\u8fd4\u56de\u503c\u800c\u975e panic \u7684\u65b9\u5f0f\u5904\u7406&#xff0c;\u4f53\u73b0\u4e86\u5de5\u5177\u5b9e\u73b0\u4e2d&#034;\u9519\u8bef\u5e94\u4f5c\u4e3a\u7ed3\u679c\u8fd4\u56de\u800c\u975e\u4e2d\u65ad\u8fdb\u7a0b&#034;\u7684\u5065\u58ee\u6027\u8bbe\u8ba1\u3002<\/li>\n<\/ul>\n<h4>4. #[tool_handler] \u4e0e\u670d\u52a1\u5668\u5143\u4fe1\u606f<\/h4>\n<p>#[tool_handler]<br \/>\nimpl ServerHandler for Calculator {<br \/>\n    fn get_info(&amp;self) -&gt; ServerInfo {<br \/>\n        ServerInfo {<br \/>\n            instructions: Some(&#034;A simple calculator tool&#034;.into()),<br \/>\n            capabilities: ServerCapabilities::builder().enable_tools().build(),<br \/>\n            ..Default::default()<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>#[tool_handler] \u5b8f\u628a Calculator \u6865\u63a5\u5230 MCP \u670d\u52a1\u5668\u5904\u7406\u5668\u3002get_info() \u8fd4\u56de\u7684 ServerInfo \u5305\u542b\u4e24\u4e2a\u5173\u952e\u5b57\u6bb5&#xff1a;<\/p>\n<ul>\n<li>instructions&#xff1a;\u9762\u5411\u5ba2\u6237\u7aef\u6a21\u578b\u7684\u670d\u52a1\u5668\u8bf4\u660e\u6587\u672c&#xff0c;\u6b64\u5904\u4e3a &#034;A simple calculator tool&#034;&#xff0c;\u5e2e\u52a9 LLM \u7406\u89e3\u670d\u52a1\u5668\u7528\u9014&#xff1b;<\/li>\n<li>capabilities&#xff1a;\u80fd\u529b\u58f0\u660e&#xff0c;enable_tools() \u660e\u786e\u544a\u8bc9\u5ba2\u6237\u7aef&#034;\u672c\u670d\u52a1\u5668\u652f\u6301\u5de5\u5177\u8c03\u7528&#034;&#xff1b;<\/li>\n<li>..Default::default()&#xff1a;\u5176\u4f59\u5b57\u6bb5&#xff08;\u5982\u534f\u8bae\u7248\u672c&#xff09;\u91c7\u7528\u9ed8\u8ba4\u503c\u3002<\/li>\n<\/ul>\n<h4>5. \u5165\u53e3\u51fd\u6570\u4e0e stdio \u4f20\u8f93<\/h4>\n<p>#[tokio::main]<br \/>\nasync fn main() -&gt; Result&lt;(), Box&lt;dyn Error&gt;&gt; {<br \/>\n    let service &#061; Calculator::new().serve(stdio()).await?;<br \/>\n    service.waiting().await?;<br \/>\n    Ok(())<br \/>\n}<\/p>\n<ul>\n<li>#[tokio::main] \u542f\u52a8\u591a\u7ebf\u7a0b\u5f02\u6b65\u8fd0\u884c\u65f6&#xff1b;<\/li>\n<li>Calculator::new() \u521b\u5efa\u670d\u52a1\u5668\u5b9e\u4f8b&#xff08;\u540c\u65f6\u5b8c\u6210\u5de5\u5177\u6ce8\u518c&#xff09;&#xff1b;<\/li>\n<li>.serve(stdio()) \u5c06\u670d\u52a1\u5668\u6302\u8f7d\u5230\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u4f20\u8f93\u4e0a&#xff1a;MCP \u5ba2\u6237\u7aef\u901a\u8fc7\u5411\u8fdb\u7a0b\u7684 stdin \u5199\u5165 JSON-RPC \u6d88\u606f\u3001\u4ece stdout \u8bfb\u53d6\u54cd\u5e94\u6765\u4e0e\u670d\u52a1\u5668\u901a\u4fe1&#xff1b;<\/li>\n<li>.waiting() \u4fdd\u6301\u8fdb\u7a0b\u8fd0\u884c&#xff0c;\u76f4\u81f3\u6536\u5230\u7ec8\u6b62\u4fe1\u53f7\u3002<\/li>\n<\/ul>\n<p>\u81f3\u6b64&#xff0c;\u4e00\u4e2a\u5b8c\u6574\u53ef\u7528\u7684 MCP \u670d\u52a1\u5668\u4fbf\u5ba3\u544a\u5b8c\u6210\u3002<\/p>\n<h3>\u7f16\u8bd1\u4e0e\u8fd0\u884c<\/h3>\n<p>\u6309\u7167\u793a\u4f8b\u6587\u6863\u7ed9\u51fa\u7684\u4e24\u6b65\u547d\u4ee4\u5373\u53ef\u5b8c\u6210\u6784\u5efa\u4e0e\u542f\u52a8&#xff1a;<\/p>\n<p># \u7f16\u8bd1\u9879\u76ee&#xff08;\u542b\u4f9d\u8d56\u89e3\u6790\u4e0e\u7c7b\u578b\u68c0\u67e5&#xff09;<br \/>\ncargo build<\/p>\n<p># \u542f\u52a8\u670d\u52a1\u5668&#xff08;\u9ed8\u8ba4\u901a\u8fc7 stdio \u7b49\u5f85\u5ba2\u6237\u7aef\u8fde\u63a5&#xff09;<br \/>\ncargo run<\/p>\n<p>cargo build \u9996\u6b21\u6267\u884c\u4f1a\u62c9\u53d6\u5e76\u7f16\u8bd1 rmcp\u3001serde\u3001tokio \u53ca\u5176\u4f9d\u8d56&#xff08;\u4ed3\u5e93\u4e2d Cargo.lock \u5df2\u9501\u5b9a\u5168\u90e8\u4f9d\u8d56\u7248\u672c&#xff0c;\u4fdd\u8bc1\u53ef\u590d\u73b0\u6784\u5efa&#xff09;\u3002cargo run \u542f\u52a8\u540e&#xff0c;\u7531\u4e8e\u91c7\u7528 stdio \u4f20\u8f93&#xff0c;\u8fdb\u7a0b\u672c\u8eab\u4e0d\u4f1a\u6253\u5370\u4ea4\u4e92\u754c\u9762&#xff0c;\u800c\u662f\u7b49\u5f85 MCP \u5ba2\u6237\u7aef\u901a\u8fc7\u6807\u51c6\u8f93\u5165\u53d1\u8d77\u8bf7\u6c42\u2014\u2014\u8fd9\u6b63\u662f\u672c\u5730 MCP \u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef&#xff08;\u5982 Claude Desktop\u3001VS Code \u6269\u5c55\u7b49&#xff09;\u534f\u4f5c\u7684\u6807\u51c6\u6a21\u5f0f\u3002<\/p>\n<p>\u63d0\u793a&#xff1a;\u82e5\u8981\u5feb\u901f\u9a8c\u8bc1\u670d\u52a1\u5668\u80fd\u5426\u6b63\u5e38\u54cd\u5e94&#xff0c;\u63a8\u8350\u7528\u4e0b\u9762\u7684 MCP Inspector \u8fdb\u884c\u4ea4\u4e92\u5f0f\u6d4b\u8bd5&#xff1b;\u76f4\u63a5\u8fd0\u884c cargo run \u540e&#xff0c;\u4e5f\u53ef\u4ee5\u914d\u5408\u8bfe\u7a0b 02-client \u4e2d\u7f16\u5199\u7684\u5ba2\u6237\u7aef\u7a0b\u5e8f\u53d1\u8d77\u771f\u5b9e\u8c03\u7528\u3002<\/p>\n<h3>\u7528 MCP Inspector \u8c03\u8bd5\u4e0e\u9a8c\u8bc1\u5de5\u5177<\/h3>\n<p>\u8bfe\u7a0b 01-first-server \u4e3a Rust \u670d\u52a1\u5668\u63d0\u4f9b\u4e86\u4e13\u95e8\u7684 Inspector \u8c03\u8bd5\u547d\u4ee4\u3002MCP Inspector \u662f MCP \u5b98\u65b9\u7684\u53ef\u89c6\u5316\u8c03\u8bd5\u5de5\u5177&#xff0c;\u80fd\u81ea\u52a8\u53d1\u73b0\u670d\u52a1\u5668\u80fd\u529b\u3001\u5b9e\u65f6\u6267\u884c\u5de5\u5177\u5e76\u67e5\u770b\u54cd\u5e94\u3002\u5bf9 Rust \u793a\u4f8b&#xff0c;\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b CLI \u65b9\u5f0f\u8c03\u7528 add \u5de5\u5177&#xff1a;<\/p>\n<p>npx &#064;modelcontextprotocol\/inspector cargo run &#8211;cli &#8211;method tools\/call &#8211;tool-name add &#8211;tool-arg a&#061;1 b&#061;2<\/p>\n<p>\u547d\u4ee4\u53c2\u6570\u62c6\u89e3&#xff1a;<\/p>\n<table>\n<tr>\u53c2\u6570\u542b\u4e49<\/tr>\n<tbody>\n<tr>\n<td>npx &#064;modelcontextprotocol\/inspector<\/td>\n<td>\u542f\u52a8 Inspector \u5de5\u5177&#xff08;\u9700\u5df2\u5b89\u88c5 Node.js\/npx&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>cargo run<\/td>\n<td>\u6307\u5b9a\u542f\u52a8\u670d\u52a1\u5668\u8fdb\u7a0b\u7684\u547d\u4ee4<\/td>\n<\/tr>\n<tr>\n<td>&#8211;cli<\/td>\n<td>\u4ee5\u547d\u4ee4\u884c\u975e\u4ea4\u4e92\u6a21\u5f0f\u6267\u884c<\/td>\n<\/tr>\n<tr>\n<td>&#8211;method tools\/call<\/td>\n<td>\u8c03\u7528 MCP \u534f\u8bae\u4e2d\u7684 tools\/call \u65b9\u6cd5<\/td>\n<\/tr>\n<tr>\n<td>&#8211;tool-name add<\/td>\n<td>\u6307\u5b9a\u8981\u8c03\u7528\u7684\u5de5\u5177\u540d&#xff08;\u5373\u5b8f\u6ce8\u518c\u7684 add&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>&#8211;tool-arg a&#061;1 b&#061;2<\/td>\n<td>\u4f20\u5165\u5de5\u5177\u53c2\u6570 a &#061; 1\u3001b &#061; 2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u9884\u671f\u8f93\u51fa\u4e3a 3&#xff08;\u5373 1 &#043; 2 \u7684\u7ed3\u679c&#xff09;\u3002\u540c\u6837\u7684\u65b9\u6cd5\u53ef\u4ee5\u4f9d\u6b21\u9a8c\u8bc1 subtract\u3001multiply\u3001divide&#xff0c;\u5305\u62ec\u9664\u96f6\u573a\u666f&#xff1a;\u8c03\u7528 divide \u5e76\u4f20\u5165 b&#061;0 \u65f6\u5e94\u5f97\u5230 &#034;Error: Division by zero&#034; \u5b57\u7b26\u4e32\u3002\u8fd9\u4e5f\u9a8c\u8bc1\u4e86 #[tool_router] \u751f\u6210\u7684 schema \u4e0e\u5de5\u5177\u5206\u53d1\u903b\u8f91\u786e\u5b9e\u6309\u58f0\u660e\u751f\u6548\u3002<\/p>\n<h3>\u4ece\u96f6\u590d\u73b0&#xff1a;\u8ddf\u968f\u8bfe\u7a0b\u6784\u5efa\u4f60\u81ea\u5df1\u7684 Rust MCP \u670d\u52a1\u5668<\/h3>\n<p>\u5982\u679c\u4f60\u5e0c\u671b\u4eb2\u624b\u521b\u5efa\u800c\u975e\u76f4\u63a5\u8fd0\u884c\u4ed3\u5e93\u793a\u4f8b&#xff0c;\u8bfe\u7a0b 01-first-server \u7ed9\u51fa\u4e86 Rust \u8def\u5f84\u7684\u5b8c\u6574\u6b65\u9aa4&#xff1a;<\/p>\n<p># 1. \u521d\u59cb\u5316 Cargo \u9879\u76ee<br \/>\nmkdir calculator-server<br \/>\ncd calculator-server<br \/>\ncargo init<\/p>\n<p># 2. \u6dfb\u52a0\u4f9d\u8d56&#xff08;\u4e0e\u793a\u4f8b Cargo.toml \u4e00\u81f4&#xff09;<br \/>\ncargo add rmcp &#8211;features server,transport-io<br \/>\ncargo add serde<br \/>\ncargo add tokio &#8211;features rt-multi-thread<\/p>\n<p>\u968f\u540e\u5220\u9664 cargo init \u751f\u6210\u7684\u9ed8\u8ba4 main.rs \u5185\u5bb9&#xff0c;\u6309\u4e0a\u6587\u62c6\u89e3\u7684\u987a\u5e8f\u4f9d\u6b21\u5199\u5165&#xff1a;\u6a21\u5757\u5bfc\u5165 \u2192 CalculatorRequest \u7ed3\u6784\u4f53 \u2192 Calculator \u7ed3\u6784\u4f53\u4e0e #[tool_router] \u5b9e\u73b0 \u2192 #[tool_handler] \u7684 ServerHandler \u5b9e\u73b0 \u2192 main \u5165\u53e3\u3002\u6700\u540e\u6267\u884c&#xff1a;<\/p>\n<p>cargo fmt<br \/>\ncargo run<\/p>\n<p>\u8bfe\u7a0b\u7684 Assignment \u8fdb\u4e00\u6b65\u5efa\u8bae\u8bfb\u8005\u7528\u81ea\u5df1\u64c5\u957f\u7684\u8bed\u8a00\u5b9e\u73b0\u4e00\u4e2a\u81ea\u9009\u5de5\u5177\u5e76\u5b9a\u4e49\u8f93\u5165\u53c2\u6570\u4e0e\u8fd4\u56de\u503c&#xff0c;\u518d\u7528 Inspector \u9a8c\u8bc1\u2014\u2014\u672c\u793a\u4f8b\u6b63\u662f\u5b8c\u6210\u8be5\u7ec3\u4e60\u7684 Rust \u53c2\u8003\u7b54\u6848\u3002<\/p>\n<h3>\u5173\u952e\u8981\u70b9\u603b\u7ed3<\/h3>\n<ul>\n<li>\u58f0\u660e\u5f0f\u5de5\u5177\u6ce8\u518c&#xff1a;#[tool_router] &#043; #[tool(description &#061; &#034;&#8230;&#034;)] \u5b8f\u8ba9\u5de5\u5177\u6ce8\u518c\u5b8c\u5168\u58f0\u660e\u5316&#xff0c;\u5f00\u53d1\u8005\u53ea\u9700\u7f16\u5199\u666e\u901a\u5f02\u6b65\u65b9\u6cd5&#xff0c;\u5b8f\u81ea\u52a8\u751f\u6210\u8def\u7531\u4e0e schema&#xff1b;<\/li>\n<li>\u7ed3\u6784\u5316\u53c2\u6570\u4e0e\u81ea\u52a8 Schema&#xff1a;CalculatorRequest \u901a\u8fc7 serde::Deserialize \u4e0e schemars::JsonSchema \u540c\u65f6\u89e3\u51b3\u53c2\u6570\u53cd\u5e8f\u5217\u5316\u548c\u5de5\u5177\u5165\u53c2 schema \u751f\u6210&#xff0c;\u8fd9\u662f MCP \u5de5\u5177\u53ef\u88ab LLM \u6b63\u786e\u8c03\u7528\u7684\u57fa\u7840&#xff1b;<\/li>\n<li>\u80fd\u529b\u4e0e\u5143\u4fe1\u606f\u58f0\u660e&#xff1a;ServerHandler::get_info() \u8fd4\u56de\u7684 instructions \u4e0e capabilities \u51b3\u5b9a\u4e86\u5ba2\u6237\u7aef\u5982\u4f55\u770b\u5f85\u548c\u4f7f\u7528\u8fd9\u53f0\u670d\u52a1\u5668&#xff1b;<\/li>\n<li>stdio \u4f20\u8f93&#xff1a;serve(stdio()) \u4f7f\u670d\u52a1\u5668\u901a\u8fc7\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u901a\u4fe1&#xff0c;\u9002\u5408\u672c\u5730\u3001\u8fdb\u7a0b\u9694\u79bb\u7684\u5b89\u5168\u573a\u666f&#xff1b;<\/li>\n<li>\u53ef\u9a8c\u8bc1\u6027&#xff1a;cargo build \/ cargo run \u4e24\u547d\u4ee4\u5373\u53ef\u6784\u5efa\u8fd0\u884c&#xff0c;MCP Inspector \u7684 CLI \u8c03\u7528\u5219\u63d0\u4f9b\u4e86\u4e0d\u4f9d\u8d56\u56fe\u5f62\u754c\u9762\u7684\u5de5\u5177\u7ea7\u9a8c\u8bc1\u624b\u6bb5\u3002<\/li>\n<\/ul>\n<h3>\u5ef6\u4f38\u9605\u8bfb<\/h3>\n<ul>\n<li>\u672c\u793a\u4f8b\u7684\u82f1\u6587\u539f\u7248\u8bf4\u660e&#xff1a;Rust \u793a\u4f8b README<\/li>\n<li>\u5b8c\u6574\u5b9e\u73b0\u6e90\u7801&#xff1a;src\/main.rs<\/li>\n<li>\u4f9d\u8d56\u58f0\u660e\u4e0e\u7248\u672c&#xff1a;Cargo.toml<\/li>\n<li>\u8bfe\u7a0b\u4e3b\u6559\u7a0b&#xff08;\u542b TypeScript \/ Python \/ .NET \/ Java \/ Rust \u591a\u8bed\u8a00\u5bf9\u7167\u4e0e Inspector \u8c03\u8bd5&#xff09;&#xff1a;01-first-server<\/li>\n<li>\u66f4\u591a\u8bed\u8a00\u7684\u8ba1\u7b97\u5668\u793a\u4f8b\u4e0e\u7ec3\u4e60\u5165\u53e3&#xff1a;03-GettingStarted \u603b\u89c8<\/li>\n<\/ul>\n<p>  <img loading=\"lazy\" decoding=\"async\" class=\"gcb-icon-like\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261007014123-6ac5a343e66d4.svg\" alt=\"\" width=\"16\" height=\"16\" \/> <span class=\"gcb-like-text\">\u8d5e<\/span>  <\/p>\n<p>   <span class=\"gcb-share-text\">\u5206\u4eab<\/span>  <\/p>\n<ul class=\"gcb-tag-list\">\n<li><span class=\"gcb-tag\">\u6559\u7a0b<\/span><\/li>\n<li><span class=\"gcb-tag\">\u6587\u6863<\/span><\/li>\n<li><span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span><\/li>\n<\/ul>\n<h3 class=\"gcb-project-title\">\u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011mcp-for-beginners<\/h3>\n<p class=\"gcb-project-desc\">This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.<\/p>\n<p>    <span class=\"gcb-project-addr-label\">\u9879\u76ee\u5730\u5740&#xff1a;<\/span><br \/>\n    <span class=\"gcb-project-addr-link\">https:\/\/gitcode.com\/GitHub_Trending\/mc\/mcp-for-beginners<\/span> <\/p>\n<p>  <span class=\"gcb-project-btn\"> <span class=\"gcb-project-btn-main\">\u70b9\u51fb\u67e5\u770b<\/span> <span class=\"gcb-project-btn-sub\">\u514d\u8d39\u4e0b\u8f7d<\/span> <\/span> <\/p>\n<h4 class=\"gcb-related-title\">\u76f8\u5173\u63a8\u8350<\/h4>\n<ul class=\"gcb-related-list\">\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">\u4f7f\u7528 Rust \u4e0e rmcp \u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668&#xff1a;\u4ece tool \u5b8f\u5230 stdio \u4f20\u8f93\u5b9e\u6218<\/h5>\n<p class=\"gcb-related-item-desc\">\u4f7f\u7528 Rust \u4e0e rmcp \u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668&#xff1a;\u4ece tool \u5b8f\u5230 stdio \u4f20\u8f93\u5b9e\u6218 \u5bfc\u8bfb \u672c\u6587\u4ee5\u672c\u4ed3\u5e93 03 GettingStarted\/sa<\/p>\n<p>     <span class=\"gcb-tag\">\u6559\u7a0b<\/span><br \/>\n     <span class=\"gcb-tag\">\u6587\u6863<\/span><br \/>\n     <span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">mcp-for-beginners Rust \u5b9e\u6218&#xff1a;\u4f7f\u7528 rmcp \u6784\u5efa\u57fa\u4e8e stdio \u7684 MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668<\/h5>\n<p class=\"gcb-related-item-desc\">mcp for beginners Rust \u5b9e\u6218&#xff1a;\u4f7f\u7528 rmcp \u6784\u5efa\u57fa\u4e8e stdio \u7684 MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668 \u672c\u7bc7\u6280\u672f\u6307\u5357\u4ee5 mcp for beginn<\/p>\n<p>     <span class=\"gcb-tag\">\u6559\u7a0b<\/span><br \/>\n     <span class=\"gcb-tag\">\u6587\u6863<\/span><br \/>\n     <span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span>\n      <\/li>\n<li class=\"gcb-related-item\">\n<h5 class=\"gcb-related-item-title\">.NET 9 \u6784\u5efa MCP stdio \u670d\u52a1\u5668\u5b9e\u6218&#xff1a;\u4f20\u8f93\u673a\u5236\u3001\u5de5\u5177\u5b9e\u73b0\u4e0e MCP Inspector \u8c03\u8bd5\u6307\u5357&#xff08;mcp-for-beginners&#xff09;<\/h5>\n<p class=\"gcb-related-item-desc\">.NET 9 \u6784\u5efa MCP stdio \u670d\u52a1\u5668\u5b9e\u6218&#xff1a;\u4f20\u8f93\u673a\u5236\u3001\u5de5\u5177\u5b9e\u73b0\u4e0e MCP Inspector \u8c03\u8bd5\u6307\u5357&#xff08;mcp for beginners&#xff09; \u672c\u6587\u4ee5 m<\/p>\n<p>     <span class=\"gcb-tag\">\u6559\u7a0b<\/span><br \/>\n     <span class=\"gcb-tag\">\u6587\u6863<\/span><br \/>\n     <span class=\"gcb-tag\">\u4eba\u5de5\u667a\u80fd<\/span>\n      <\/li>\n<\/ul>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0a\u4e00\u7bc7&#xff1a;<\/span><br \/>\n  TensorRT \u793a\u4f8b\u8be6\u89e3&#xff1a;sampleNamedDimensions \u2014\u2014 \u4f7f\u7528 ONNX \u547d\u540d\u7ef4\u5ea6&#xff08;Named Input Dimensions&#xff09;\u6784\u5efa\u52a8\u6001\u63a8\u7406\u5f15\u64ce <\/p>\n<p>  <span class=\"gcb-prev-next-label\">\u4e0b\u4e00\u7bc7&#xff1a;<\/span><br \/>\n  \u5982\u4f55\u5feb\u901f\u4e0a\u624bWhatTheHack&#xff1a;\u65b0\u624b\u56e2\u961f\u534f\u4f5c\u5b66\u4e60\u7684\u7ec8\u6781\u6559\u7a0b &#x1f680; <\/p>\n<p>\u521b\u4f5c\u58f0\u660e\uff1a\u672c\u6587\u90e8\u5206\u5185\u5bb9\u7531AI\u8f85\u52a9\u751f\u6210\uff08AIGC\uff09\uff0c\u4ec5\u4f9b\u53c2\u8003<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6559\u7a0b\u6587\u6863\u4eba\u5de5\u667a\u80fd \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011mcp-for-beginners This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for deve<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"topic":[],"class_list":["post-113729","post","type-post","status-publish","format-standard","hentry","category-server"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7528 Rust \u4e0e rmcp \u4ece\u96f6\u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668\uff1atool_router \u5b8f\u3001stdio \u4f20\u8f93\u4e0e Inspector \u8c03\u8bd5\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/113729.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7528 Rust \u4e0e rmcp \u4ece\u96f6\u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668\uff1atool_router \u5b8f\u3001stdio \u4f20\u8f93\u4e0e Inspector \u8c03\u8bd5\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6559\u7a0b\u6587\u6863\u4eba\u5de5\u667a\u80fd \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011mcp-for-beginners This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for deve\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/113729.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-07T01:41:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261007014123-6ac5a343e66d4.svg\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/113729.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/113729.html\",\"name\":\"\u7528 Rust \u4e0e rmcp \u4ece\u96f6\u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668\uff1atool_router \u5b8f\u3001stdio \u4f20\u8f93\u4e0e Inspector \u8c03\u8bd5\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-07T01:41:25+00:00\",\"dateModified\":\"2026-10-07T01:41:25+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/113729.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/113729.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/113729.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7528 Rust \u4e0e rmcp \u4ece\u96f6\u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668\uff1atool_router \u5b8f\u3001stdio \u4f20\u8f93\u4e0e Inspector \u8c03\u8bd5\u5b9e\u6218\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u7528 Rust \u4e0e rmcp \u4ece\u96f6\u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668\uff1atool_router \u5b8f\u3001stdio \u4f20\u8f93\u4e0e Inspector \u8c03\u8bd5\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/113729.html","og_locale":"zh_CN","og_type":"article","og_title":"\u7528 Rust \u4e0e rmcp \u4ece\u96f6\u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668\uff1atool_router \u5b8f\u3001stdio \u4f20\u8f93\u4e0e Inspector \u8c03\u8bd5\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6559\u7a0b\u6587\u6863\u4eba\u5de5\u667a\u80fd \u3010\u514d\u8d39\u4e0b\u8f7d\u94fe\u63a5\u3011mcp-for-beginners This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for deve","og_url":"https:\/\/www.wsisp.com\/helps\/113729.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-07T01:41:25+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261007014123-6ac5a343e66d4.svg"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/113729.html","url":"https:\/\/www.wsisp.com\/helps\/113729.html","name":"\u7528 Rust \u4e0e rmcp \u4ece\u96f6\u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668\uff1atool_router \u5b8f\u3001stdio \u4f20\u8f93\u4e0e Inspector \u8c03\u8bd5\u5b9e\u6218 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-07T01:41:25+00:00","dateModified":"2026-10-07T01:41:25+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/113729.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/113729.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/113729.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u7528 Rust \u4e0e rmcp \u4ece\u96f6\u6784\u5efa MCP \u8ba1\u7b97\u5668\u670d\u52a1\u5668\uff1atool_router \u5b8f\u3001stdio \u4f20\u8f93\u4e0e Inspector \u8c03\u8bd5\u5b9e\u6218"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/113729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=113729"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/113729\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=113729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=113729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=113729"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=113729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}