agenterra-rmcp

Crates.ioagenterra-rmcp
lib.rsagenterra-rmcp
version0.1.5
created_at2025-06-25 00:27:04.107042+00
updated_at2025-06-25 00:27:04.107042+00
descriptionAgenterra fork of Rust SDK for Model Context Protocol
homepagehttps://github.com/clafollett/agenterra-rmcp
repositoryhttps://github.com/clafollett/agenterra-rmcp/
max_upload_size
id1725150
size605,948
Cali LaFollett (clafollett)

documentation

https://docs.rs/agenterra-rmcp

README

简体中文(待更新)

agenterra-rmcp

Crates.io Version docs.rs Coverage

An Agenterra fork of the official Rust Model Context Protocol SDK implementation with tokio async runtime.

Note: This is a fork of the official Rust SDK for the Model Context Protocol. We maintain this fork to provide a stable, published version on crates.io while staying in sync with upstream changes.

Attribution

This project is based on the official Model Context Protocol Rust SDK developed by Anthropic and the MCP community. The original repository can be found at: https://github.com/modelcontextprotocol/rust-sdk

All credit for the core implementation goes to the original authors. This fork exists to:

  • Provide published crates on crates.io under the agenterra-rmcp namespace

  • Enable easier integration for projects that need a stable, versioned dependency

  • Maintain compatibility with upstream changes

This repository contains the following crates:

Usage

Import the crate

agenterra-rmcp = { version = "0.1", features = ["server"] }
## or from git
agenterra-rmcp = { git = "https://github.com/agenterra/agenterra-rmcp", branch = "main" }

Third Dependencies

Basic dependencies:

Build a Client

Start a client
use agenterra_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(())
}

Build a Server

Build a transport
use tokio::io::{stdin, stdout};
let transport = (stdin(), stdout());
Build a service

You can easily build a service by using ServerHandler or ClientHandler.

let service = common::counter::Counter::new();
Start the server
// this call will finish the initialization process
let server = service.serve(transport).await?;
Interact with the server

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?;
Waiting for service shutdown
let quit_reason = server.waiting().await?;
// or cancel it
let quit_reason = server.cancel().await?;

Examples

See examples

OAuth Support

See oauth_support for details.

Related Resources

Related Projects

Development

Tips for Contributors

See docs/CONTRIBUTE.MD to get some tips for contributing.

Using Dev Container

If you want to use dev container, see docs/DEVCONTAINER.md for instructions on using Dev Container for development.

Commit count: 0

cargo fmt