Overview
The Rust MCP SDK is the official library for building MCP servers in Rust. It supports tools, resources, prompts, transports, and the stdio and streamable-http transport.
Installation
cargo add rmcpMinimal Server Example
# See https://modelcontextprotocol.io/sdks/rust for examplesAdding a Tool
Tools are the primary way MCP servers expose functionality to clients. Each tool has a name, input schema, and handler function.
# Tool registration varies by SDKSupported Features
tools
resources
prompts
transports
Testing Your Server
- Start the server and verify it prints no startup errors.
- Run
npx @modelcontextprotocol/inspectorand connect over stdio. - Call your tools and verify they return the expected responses.
- Connect from Claude Desktop and confirm tool visibility.