forked frommodelcontextprotocol/rust-sdk
- Notifications
You must be signed in to change notification settings - Fork0
The official Rust SDK for the Model Context Protocol
License
NotificationsYou must be signed in to change notification settings
whamcloud/mcp-rust-sdk
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
An official Rust Model Context Protocol SDK implementation with tokio async runtime.
This repository contains the following crates:
- rmcp: The core crate providing the RMCP protocol implementation (If you want to get more information, please visitrmcp)
- rmcp-macros: A procedural macro crate for generating RMCP tool implementations (If you want to get more information, please visitrmcp-macros)
rmcp = {version ="0.2.0",features = ["server"] }## or dev channelrmcp = {git ="https://github.com/modelcontextprotocol/rust-sdk",branch ="main" }
Basic dependencies:
Start a client
use rmcp::{ServiceExt, transport::{TokioChildProcess,ConfigureCommandExt}};use tokio::process::Command;#[tokio::main]asyncfnmain() ->Result<(),Box<dyn std::error::Error>>{let client =().serve(TokioChildProcess::new(Command::new("npx").configure(|cmd|{ cmd.arg("-y").arg("@modelcontextprotocol/server-everything");}))?).await?;Ok(())}
Build a transport
use tokio::io::{stdin, stdout};let transport =(stdin(),stdout());
Build a service
You can easily build a service by usingServerHandler orClientHandler.
let service = common::counter::Counter::new();
Start the server
// this call will finish the initialization processlet server = service.serve(transport).await?;
Interact with the server
Once the server is initialized, you can send requests or notifications:
// requestlet roots = server.list_roots().await?;// or send notificationserver.notify_cancelled(...).await?;
Waiting for service shutdown
let quit_reason = server.waiting().await?;// or cancel itlet quit_reason = server.cancel().await?;
Seeexamples
Seeoauth_support for details.
- rmcp-actix-web - An
actix_webbackend forrmcp - rmcp-openapi - Transform OpenAPI definition endpoints into MCP tools
- rustfs-mcp - High-performance MCP server providing S3-compatible object storage operations for AI/LLM integration
- containerd-mcp-server - A containerd-based MCP server implementation
- rmcp-openapi-server - High-performance MCP server that exposes OpenAPI definition endpoints as MCP tools
- nvim-mcp - A MCP server to interact with Neovim
Seedocs/CONTRIBUTE.MD to get some tips for contributing.
If you want to use dev container, seedocs/DEVCONTAINER.md for instructions on using Dev Container for development.
About
The official Rust SDK for the Model Context Protocol
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.
Languages
- Rust99.1%
- Other0.9%