pub struct HttpMcpServerBuilder { /* private fields */ }Expand description
Builder for HTTP MCP server with pluggable storage
Implementations§
Source§impl HttpMcpServerBuilder
impl HttpMcpServerBuilder
Sourcepub fn with_storage(session_storage: Arc<BoxedSessionStorage>) -> Self
pub fn with_storage(session_storage: Arc<BoxedSessionStorage>) -> Self
Create a new builder with specific session storage
Sourcepub fn with_middleware_stack(
self,
middleware_stack: Arc<MiddlewareStack>,
) -> Self
pub fn with_middleware_stack( self, middleware_stack: Arc<MiddlewareStack>, ) -> Self
Set the middleware stack (for HTTP transport middleware support)
Sourcepub fn route_registry(self, registry: Arc<RouteRegistry>) -> Self
pub fn route_registry(self, registry: Arc<RouteRegistry>) -> Self
Set the route registry for custom HTTP paths (e.g., .well-known)
Sourcepub fn bind_address(self, addr: SocketAddr) -> Self
pub fn bind_address(self, addr: SocketAddr) -> Self
Set the bind address
Sourcepub fn max_body_size(self, size: usize) -> Self
pub fn max_body_size(self, size: usize) -> Self
Set maximum request body size
Sourcepub fn get_sse(self, enable: bool) -> Self
pub fn get_sse(self, enable: bool) -> Self
Enable or disable GET SSE for persistent event streams
Sourcepub fn post_sse(self, enable: bool) -> Self
pub fn post_sse(self, enable: bool) -> Self
Enable or disable POST SSE for streaming tool call responses (disabled by default for compatibility)
Sourcepub fn sse(self, enable: bool) -> Self
pub fn sse(self, enable: bool) -> Self
Enable or disable both GET and POST SSE (convenience method)
Sourcepub fn session_expiry_minutes(self, minutes: u64) -> Self
pub fn session_expiry_minutes(self, minutes: u64) -> Self
Set session expiry time in minutes
Sourcepub fn allow_unauthenticated_ping(self, allow: bool) -> Self
pub fn allow_unauthenticated_ping(self, allow: bool) -> Self
Allow or disallow ping requests without Mcp-Session-Id header
Default: true (sessionless pings allowed per MCP spec).
Set to false for hardened deployments requiring session for all methods.
Sourcepub fn stream_config(self, config: StreamConfig) -> Self
pub fn stream_config(self, config: StreamConfig) -> Self
Configure SSE streaming settings
Sourcepub fn register_handler<H>(self, methods: Vec<String>, handler: H) -> Selfwhere
H: JsonRpcHandler<Error = McpError> + 'static,
pub fn register_handler<H>(self, methods: Vec<String>, handler: H) -> Selfwhere
H: JsonRpcHandler<Error = McpError> + 'static,
Register a JSON-RPC handler for specific methods
Sourcepub fn default_handler<H>(self, handler: H) -> Selfwhere
H: JsonRpcHandler<Error = McpError> + 'static,
pub fn default_handler<H>(self, handler: H) -> Selfwhere
H: JsonRpcHandler<Error = McpError> + 'static,
Register a default handler for unhandled methods
Sourcepub fn server_capabilities(self, capabilities: ServerCapabilities) -> Self
pub fn server_capabilities(self, capabilities: ServerCapabilities) -> Self
Set server capabilities
Sourcepub fn build(self) -> HttpMcpServer
pub fn build(self) -> HttpMcpServer
Build the HTTP MCP server