# mcp-sdk **Repository Path**: MoleSir/mcp-sdk ## Basic Information - **Project Name**: mcp-sdk - **Description**: Rust 实现 MCP(model context protocol)模型上下文协议 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-23 - **Last Updated**: 2025-04-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Rust MCP SDK 使用 Rust 实现 MCP(Model Context Protocol) ## 进度 - Server/Client - [x] initialize - [x] shutdown - [x] tools/list - [x] tools/call - Transport - [x] Stdio - [x] Tcp(Server 无法识别到 Client 关闭而关闭) 参考 Python 的 mcp,实现了 fastmcp,使用方式十分类似!使用一个 tool 宏装饰函数即可实现一个 Tool! ````rust use mcp_sdk::fastmcp::prelude::*; #[tool( struct_name = GetMyName, name = "get_my_name", description = "Return my name", args = [] )] fn get_my_name() -> String { "molesir".into() } #[tool( struct_name = GetWeather, name = "get_weather", description = "get weather in given place", args = [ "place": { "title": "place", "description": "the place you want to know weather", "type": "string" } ] )] fn get_weather(place: &str) -> Result { match place { "Shanghai" | "上海" => Ok("Sunny".into()), _ => Err(anyhow::anyhow!("Unspport place!")), } } #[tokio::main] async fn main() { let tools: Vec> = vec![ Box::new(GetMyName::new()), Box::new(GetWeather::new()) ]; let mcp = FastMcp::new(Transport::Stdio, tools); mcp.run().await.unwrap() } ```` ## References - https://github.com/conikeec/mcpr.git - https://github.com/MarkTechStation/VideoCode - https://github.com/Derek-X-Wang/mcp-rust-sdk.git - https://modelcontextprotocol.io/introduction