pub struct HttpServerConfig {
pub health_path: String,
pub max_connections: usize,
pub handler_config: HttpHandlerConfig,
pub request_capacity: usize,
pub legacy_sse_path: String,
pub legacy_message_path: String,
}Expand description
Configuration for the live HTTP listener used by Server::run_http.
The listener serves modern Streamable HTTP at Self::mcp_path. Enabling
the dated legacy feature additionally exposes the exact MCP 2024-11-05 SSE
and message POST routes. It runs on the caller-owned asupersync context and
does not create a runtime of its own.
§Example
use fastmcp_server::HttpServerConfig;
let config = HttpServerConfig::new()
.mcp_path("/api/mcp")
.health_path("/healthz")
.max_connections(128);Fields§
§health_path: StringPath for the health-check endpoint (default: "/health").
max_connections: usizeMaximum number of concurrent connections (default: 64).
handler_config: HttpHandlerConfigInner HTTP handler configuration (endpoint path, CORS, and body size).
request_capacity: usizeMaximum requests buffered for one live HTTP session.
legacy_sse_path: StringGET path for the exact MCP 2024-11-05 SSE stream.
legacy_message_path: StringPOST path advertised to an exact MCP 2024-11-05 SSE client.
Implementations§
Source§impl HttpServerConfig
impl HttpServerConfig
Sourcepub fn health_path(self, path: impl Into<String>) -> Self
pub fn health_path(self, path: impl Into<String>) -> Self
Sets the health-check endpoint path.
Sourcepub fn max_connections(self, max: usize) -> Self
pub fn max_connections(self, max: usize) -> Self
Sets the maximum number of concurrent connections.
Sourcepub fn handler_config(self, config: HttpHandlerConfig) -> Self
pub fn handler_config(self, config: HttpHandlerConfig) -> Self
Sets the inner HTTP handler configuration.
Sourcepub fn request_capacity(self, capacity: usize) -> Self
pub fn request_capacity(self, capacity: usize) -> Self
Sets the per-session HTTP request queue capacity.
Sourcepub fn legacy_sse_path(self, path: impl Into<String>) -> Self
pub fn legacy_sse_path(self, path: impl Into<String>) -> Self
Sets the exact MCP 2024-11-05 SSE stream path.
Sourcepub fn legacy_message_path(self, path: impl Into<String>) -> Self
pub fn legacy_message_path(self, path: impl Into<String>) -> Self
Sets the exact MCP 2024-11-05 POST path advertised through SSE.
Trait Implementations§
Source§impl Clone for HttpServerConfig
impl Clone for HttpServerConfig
Source§fn clone(&self) -> HttpServerConfig
fn clone(&self) -> HttpServerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more