Composable MCP server builder for zero-boilerplate capability composition.
This crate provides a builder pattern for composing MCP servers from individual capability providers, eliminating the boilerplate of implementing ServerHandler and manually delegating methods.
Instead of implementing the full ServerHandler trait:
// Traditional approach - lots of boilerplate
impl ServerHandler for MyServer {
fn list_tools(&self, ...) -> ... { self.tools.list_tools(...) }
fn call_tool(&self, ...) -> ... { self.tools.call_tool(...) }
fn list_prompts(&self, ...) -> ... { self.prompts.list_prompts(...) }
fn get_prompt(&self, ...) -> ... { self.prompts.get_prompt(...) }
// ... many more delegations
}You can compose a server from individual providers:
use rmcp_server_builder::ServerBuilder;
use rmcp::model::Implementation;
let server = ServerBuilder::new()
.info(Implementation::from_build_env())
.instructions("A helpful assistant with access to various tools.")
.tools(my_tools_provider)
.prompts(my_prompts_provider)
.build();Add to your Cargo.toml:
[dependencies]
rmcp-server-builder = "0.1"
rmcp = { version = "0.12", features = ["server"] }cargo build
cargo test
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt --all -- --checkMIT