pub struct HttpMcpServerBuilder { /* private fields */ }Expand description
Builder for HTTP MCP server with pluggable storage
Implementations§
Source§impl HttpMcpServerBuilder
impl HttpMcpServerBuilder
Sourcepub fn new() -> HttpMcpServerBuilder
pub fn new() -> HttpMcpServerBuilder
Create a new builder with in-memory storage (zero-configuration)
Source§impl HttpMcpServerBuilder
impl HttpMcpServerBuilder
Sourcepub fn with_storage(
session_storage: Arc<dyn SessionStorage<Error = SessionStorageError>>,
) -> HttpMcpServerBuilder
pub fn with_storage( session_storage: Arc<dyn SessionStorage<Error = SessionStorageError>>, ) -> HttpMcpServerBuilder
Create a new builder with specific session storage
Sourcepub fn with_middleware_stack(
self,
middleware_stack: Arc<MiddlewareStack>,
) -> HttpMcpServerBuilder
pub fn with_middleware_stack( self, middleware_stack: Arc<MiddlewareStack>, ) -> HttpMcpServerBuilder
Set the middleware stack (for HTTP transport middleware support)
Sourcepub fn bind_address(self, addr: SocketAddr) -> HttpMcpServerBuilder
pub fn bind_address(self, addr: SocketAddr) -> HttpMcpServerBuilder
Set the bind address
Sourcepub fn mcp_path(self, path: impl Into<String>) -> HttpMcpServerBuilder
pub fn mcp_path(self, path: impl Into<String>) -> HttpMcpServerBuilder
Set the MCP endpoint path
Sourcepub fn cors(self, enable: bool) -> HttpMcpServerBuilder
pub fn cors(self, enable: bool) -> HttpMcpServerBuilder
Enable or disable CORS
Sourcepub fn max_body_size(self, size: usize) -> HttpMcpServerBuilder
pub fn max_body_size(self, size: usize) -> HttpMcpServerBuilder
Set maximum request body size
Sourcepub fn get_sse(self, enable: bool) -> HttpMcpServerBuilder
pub fn get_sse(self, enable: bool) -> HttpMcpServerBuilder
Enable or disable GET SSE for persistent event streams
Sourcepub fn post_sse(self, enable: bool) -> HttpMcpServerBuilder
pub fn post_sse(self, enable: bool) -> HttpMcpServerBuilder
Enable or disable POST SSE for streaming tool call responses (disabled by default for compatibility)
Sourcepub fn sse(self, enable: bool) -> HttpMcpServerBuilder
pub fn sse(self, enable: bool) -> HttpMcpServerBuilder
Enable or disable both GET and POST SSE (convenience method)
Sourcepub fn session_expiry_minutes(self, minutes: u64) -> HttpMcpServerBuilder
pub fn session_expiry_minutes(self, minutes: u64) -> HttpMcpServerBuilder
Set session expiry time in minutes
Sourcepub fn stream_config(self, config: StreamConfig) -> HttpMcpServerBuilder
pub fn stream_config(self, config: StreamConfig) -> HttpMcpServerBuilder
Configure SSE streaming settings
Sourcepub fn register_handler<H>(
self,
methods: Vec<String>,
handler: H,
) -> HttpMcpServerBuilderwhere
H: JsonRpcHandler<Error = McpError> + 'static,
pub fn register_handler<H>(
self,
methods: Vec<String>,
handler: H,
) -> HttpMcpServerBuilderwhere
H: JsonRpcHandler<Error = McpError> + 'static,
Register a JSON-RPC handler for specific methods
Sourcepub fn default_handler<H>(self, handler: H) -> HttpMcpServerBuilderwhere
H: JsonRpcHandler<Error = McpError> + 'static,
pub fn default_handler<H>(self, handler: H) -> HttpMcpServerBuilderwhere
H: JsonRpcHandler<Error = McpError> + 'static,
Register a default handler for unhandled methods
Sourcepub fn server_capabilities(
self,
capabilities: ServerCapabilities,
) -> HttpMcpServerBuilder
pub fn server_capabilities( self, capabilities: ServerCapabilities, ) -> HttpMcpServerBuilder
Set server capabilities
Sourcepub fn build(self) -> HttpMcpServer
pub fn build(self) -> HttpMcpServer
Build the HTTP MCP server
Trait Implementations§
Source§impl Default for HttpMcpServerBuilder
impl Default for HttpMcpServerBuilder
Source§fn default() -> HttpMcpServerBuilder
fn default() -> HttpMcpServerBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for HttpMcpServerBuilder
impl !RefUnwindSafe for HttpMcpServerBuilder
impl Send for HttpMcpServerBuilder
impl Sync for HttpMcpServerBuilder
impl Unpin for HttpMcpServerBuilder
impl !UnwindSafe for HttpMcpServerBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.