pub struct ServerBuilder { /* private fields */ }Expand description
Builder for creating MCP servers with fluent API
§Examples
use prism_mcp_rs::server::ServerBuilder;
let server = ServerBuilder::new()
.name("my-server")
.version("1.0.0")
.with_prompts()
.with_resources()
.with_tools()
.build();Implementations§
Source§impl ServerBuilder
impl ServerBuilder
Sourcepub fn capabilities(self, capabilities: ServerCapabilities) -> Self
pub fn capabilities(self, capabilities: ServerCapabilities) -> Self
Set full server capabilities
Sourcepub fn with_prompts(self) -> Self
pub fn with_prompts(self) -> Self
Enable prompt capabilities
Sourcepub fn with_resources(self) -> Self
pub fn with_resources(self) -> Self
Enable resource capabilities with optional subscription support
Sourcepub fn with_tools(self) -> Self
pub fn with_tools(self) -> Self
Enable tool capabilities
Sourcepub fn with_sampling(self) -> Self
pub fn with_sampling(self) -> Self
Enable sampling capabilities
Sourcepub fn with_logging(self) -> Self
pub fn with_logging(self) -> Self
Enable logging capabilities
Sourcepub fn with_completions(self) -> Self
pub fn with_completions(self) -> Self
Enable completion capabilities
Sourcepub fn with_roots(self) -> Self
pub fn with_roots(self) -> Self
Enable roots capabilities (for clients)
Sourcepub fn with_experimental<K: Into<String>>(self, key: K, value: Value) -> Self
pub fn with_experimental<K: Into<String>>(self, key: K, value: Value) -> Self
Add experimental capabilities
Sourcepub fn config(self, config: ServerConfig) -> Self
pub fn config(self, config: ServerConfig) -> Self
Set server configuration
Sourcepub fn protocol_mode(self, mode: ProtocolMode) -> Self
pub fn protocol_mode(self, mode: ProtocolMode) -> Self
Select dual-stack, modern-only, or legacy-only protocol behavior.
Sourcepub fn max_concurrent_requests(self, max: usize) -> Self
pub fn max_concurrent_requests(self, max: usize) -> Self
Set maximum concurrent requests
Sourcepub fn request_timeout_ms(self, timeout: u64) -> Self
pub fn request_timeout_ms(self, timeout: u64) -> Self
Set request timeout in milliseconds
Sourcepub fn validate_requests(self, validate: bool) -> Self
pub fn validate_requests(self, validate: bool) -> Self
Enable or disable request validation
Sourcepub fn enable_logging(self, enable: bool) -> Self
pub fn enable_logging(self, enable: bool) -> Self
Enable or disable logging
Sourcepub fn add_resource(self, resource: Resource) -> Self
pub fn add_resource(self, resource: Resource) -> Self
Add a resource to the server
Sourcepub fn add_prompt(self, prompt: Prompt) -> Self
pub fn add_prompt(self, prompt: Prompt) -> Self
Add a prompt to the server
Sourcepub fn add_resource_template(self, template: ResourceTemplate) -> Self
pub fn add_resource_template(self, template: ResourceTemplate) -> Self
Add a resource template to the server
Sourcepub fn try_build(self) -> Result<McpServer, ServerBuilderError>
pub fn try_build(self) -> Result<McpServer, ServerBuilderError>
Try to build the MCP server, returning an error if required fields are missing
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ServerBuilder
impl !UnwindSafe for ServerBuilder
impl Freeze for ServerBuilder
impl Send for ServerBuilder
impl Sync for ServerBuilder
impl Unpin for ServerBuilder
impl UnsafeUnpin for ServerBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].