Crates.io | brk_rmcp |
lib.rs | brk_rmcp |
version | 0.7.1 |
created_at | 2025-06-21 16:51:17.661459+00 |
updated_at | 2025-09-25 09:10:58.886524+00 |
description | Rust SDK for Model Context Protocol |
homepage | https://github.com/modelcontextprotocol/rust-sdk |
repository | https://github.com/modelcontextprotocol/rust-sdk/ |
max_upload_size | |
id | 1720956 |
size | 1,002,169 |
An official Rust Model Context Protocol SDK implementation with tokio async runtime.
This repository contains the following crates:
rmcp = { version = "0.2.0", features = ["server"] }
## or dev channel
rmcp = { git = "https://github.com/modelcontextprotocol/rust-sdk", branch = "main" }
Basic dependencies:
use rmcp::{ServiceExt, transport::{TokioChildProcess, ConfigureCommandExt}};
use tokio::process::Command;
#[tokio::main]
async fn main() -> 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(())
}
use tokio::io::{stdin, stdout};
let transport = (stdin(), stdout());
You can easily build a service by using ServerHandler
or ClientHandler
.
let service = common::counter::Counter::new();
// this call will finish the initialization process
let server = service.serve(transport).await?;
Once the server is initialized, you can send requests or notifications:
// request
let roots = server.list_roots().await?;
// or send notification
server.notify_cancelled(...).await?;
let quit_reason = server.waiting().await?;
// or cancel it
let quit_reason = server.cancel().await?;
See examples
See oauth_support for details.
rmcp
actix_web
backend for rmcp
rmcp
See docs/CONTRIBUTE.MD to get some tips for contributing.
If you want to use dev container, see docs/DEVCONTAINER.md for instructions on using Dev Container for development.