Skip to main content

ServerBuilder

Struct ServerBuilder 

Source
pub struct ServerBuilder<T, P, R, C, L, I> { /* private fields */ }
Expand description

Builder for constructing a composed MCP server.

§Example

use rmcp_server_builder::ServerBuilder;
use rmcp::model::Implementation;

let server = ServerBuilder::new()
    .info(Implementation::from_build_env())
    .tools(my_tools_provider)
    .prompts(my_prompts_provider)
    .build();

Implementations§

Source§

impl ServerBuilder<Unset, Unset, Unset, Unset, Unset, Unset>

Source

pub fn new() -> Self

Create a new server builder with no providers set.

Source§

impl<T, P, R, C, L, I> ServerBuilder<T, P, R, C, L, I>

Source

pub fn tools<NewT: ToolsProvider>( self, provider: NewT, ) -> ServerBuilder<NewT, P, R, C, L, I>

Set the tools provider.

Source

pub fn prompts<NewP: PromptsProvider>( self, provider: NewP, ) -> ServerBuilder<T, NewP, R, C, L, I>

Set the prompts provider.

Source

pub fn resources<NewR: ResourcesProvider>( self, provider: NewR, ) -> ServerBuilder<T, P, NewR, C, L, I>

Set the resources provider.

Source

pub fn completion<NewC: CompletionProvider>( self, provider: NewC, ) -> ServerBuilder<T, P, R, NewC, L, I>

Set the completion provider.

Source

pub fn logging<NewL: LoggingProvider>( self, provider: NewL, ) -> ServerBuilder<T, P, R, C, NewL, I>

Set the logging provider.

Source

pub fn info<NewI: ServerInfoProvider>( self, provider: NewI, ) -> ServerBuilder<T, P, R, C, L, NewI>

Set the server info provider.

Source

pub fn instructions(self, instructions: impl Into<String>) -> Self

Set human-readable instructions for using this server.

Source§

impl<T, P, R, C, L, I> ServerBuilder<T, P, R, C, L, I>

Source

pub fn build(self) -> Server<T, P, R, C, L, I>

Build the server.

This will use Unset for any providers that weren’t explicitly set, which will return “method not found” errors for those capabilities.

Trait Implementations§

Source§

impl Default for ServerBuilder<Unset, Unset, Unset, Unset, Unset, Unset>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T, P, R, C, L, I> Freeze for ServerBuilder<T, P, R, C, L, I>
where T: Freeze, P: Freeze, R: Freeze, C: Freeze, L: Freeze, I: Freeze,

§

impl<T, P, R, C, L, I> RefUnwindSafe for ServerBuilder<T, P, R, C, L, I>

§

impl<T, P, R, C, L, I> Send for ServerBuilder<T, P, R, C, L, I>
where T: Send, P: Send, R: Send, C: Send, L: Send, I: Send,

§

impl<T, P, R, C, L, I> Sync for ServerBuilder<T, P, R, C, L, I>
where T: Sync, P: Sync, R: Sync, C: Sync, L: Sync, I: Sync,

§

impl<T, P, R, C, L, I> Unpin for ServerBuilder<T, P, R, C, L, I>
where T: Unpin, P: Unpin, R: Unpin, C: Unpin, L: Unpin, I: Unpin,

§

impl<T, P, R, C, L, I> UnsafeUnpin for ServerBuilder<T, P, R, C, L, I>

§

impl<T, P, R, C, L, I> UnwindSafe for ServerBuilder<T, P, R, C, L, I>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more