Skip to main content

Crate rmcp_server_builder

Crate rmcp_server_builder 

Source
Expand description

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.

§Overview

Instead of implementing the full ServerHandler trait and delegating methods, you can compose a server from individual providers:

use rmcp_server_builder::{Server, ServerBuilder};
use rmcp::model::Implementation;

// Compose a server with tools from one provider and prompts from another
let server = ServerBuilder::new()
    .info(Implementation::from_build_env())
    .instructions("You have access to a glTF 2.0 API...")
    .tools(openapi_server)
    .prompts(my_prompts)
    .build();

§Provider Traits

Each MCP capability has a corresponding provider trait:

§Blanket Implementations

Any type implementing ServerHandler automatically implements all provider traits, so existing servers can be used as providers without modification.

§Capability Auto-Detection

The composed server automatically sets capability flags based on which providers are configured. If you set a tools provider, capabilities.tools will be enabled.

Structs§

Implementation
Server
A composable MCP server that routes requests to individual capability providers.
ServerBuilder
Builder for constructing a composed MCP server.
ServerCapabilities
Builder
SimpleInfo
A simple server info provider that wraps an Implementation.
Unset
Marker for an unset provider.

Traits§

CompletionProvider
Provider for completion capability.
LoggingProvider
Provider for logging capability.
PromptsProvider
Provider for prompts capability.
ResourcesProvider
Provider for resources capability.
ServerHandler
ServerInfoProvider
Provider for server info and initialization.
ToolsProvider
Provider for tools capability.