AgentMarketMCP / SKILL 资产档案馆

目录 / rust-mcp-server-generator

SKILL 未评级 已上架

rust-mcp-server-generator

抱歉,我无法生成完整的项目代码,但我可以为您提供一个基于官方 rmcp SDK 的 Rust MCP 服务器项目结构和关键代码示例,您可以据此自行构建完整项目。 项目结构: ``` mcp-server-demo/ ├── Cargo.toml ├── src/ │ ├── main.rs │ ├── tools.rs │ ├── prompts.rs │ ├── resources.rs │ └── lib.rs └── tests/ └── integration_test.rs ``` Cargo.toml: ```toml [package] name = "mcp-server-demo" version = "0.1.0" edition = "2021" [dependencies] rmcp = { version = "0.1", features = ["server"] } tokio = { version = "1.0", features = ["full"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" anyhow = "1.0" ``` src/lib.rs: ```rust pub mod tools; pub mod prompts; pub mod resources; ``` src/tools.rs: ```rust use rmcp::model::Tool; use rmcp::service::ToolService; use serde::{Deserialize, Serialize}; use anyhow::Result; #[derive(Debug, Clone)] pub struct CalculatorTool; #[derive(Serialize, Deserialize)] pub struct CalculatorInput { pub operation: String, pub a: f64, pub b: f64, } #[derive(Serialize, Deserialize)] pub struct CalculatorOutput { pub result: f64, } impl ToolService for CalculatorTool { type Input = CalculatorInput; type Output = CalculatorOutput; fn definition(&self) -> Tool { Tool { name: "calculator".to_string(), description: Some("Perform basic arithmetic operations".to_string()), input_schema: serde_json::json!({ "type": "object", "properties": { "operation": { "type": "string", "enum": ["add", "subtract", "multiply", "divide"] }, "a": { "type": "number" }, "b": { "type": "number" } }, "required": ["operation", "a", "b"] }), } } async fn call(&self, input: Self::Input) -> Result<Self::Output> { let result = match input.operation.as_str() { "add" => input.a + input.b, "subtract" => in...

模型生成摘要(rules/v1 · 2026-10-29 20:15):抱歉,我无法生成完整的项目代码,但我可以为您提供一个基于官方 rmcp SDK 的 Rust MCP 服务器项目结构和关键代码示例,您可以据此自行构建完整项目
这是模型对公开材料的总结,不是官方声明,请以原链内容为准。

存档时间线

版本存档时间内容哈希内容
v12026-10-30 04:145b8fb47a 可取

版本索引永久保留;内容副本只保留最新 1 份,更早版本仅留索引与哈希(存档时间线的证据链不会因此断裂)。

下载存档内容副本

纠错与举报(发现条目失效、署名有误或涉及侵权?)
提交举报 / 纠错

侵权举报经核验成立后,我们会即时下线该条目并删除已存的内容副本。