pub struct HyperServerOptions {
pub host: String,
pub port: u16,
pub custom_sse_endpoint: Option<String>,
pub custom_messages_endpoint: Option<String>,
pub ping_interval: Duration,
pub enable_ssl: bool,
pub ssl_cert_path: Option<String>,
pub ssl_key_path: Option<String>,
pub transport_options: Arc<TransportOptions>,
pub session_id_generator: Option<Arc<dyn IdGenerator>>,
}
Expand description
Configuration struct for the Hyper server Used to configure the HyperServer instance.
Fields§
§host: String
Hostname or IP address the server will bind to (default: “localhost”)
port: u16
Hostname or IP address the server will bind to (default: “8080”)
custom_sse_endpoint: Option<String>
Optional custom path for the Server-Sent Events (SSE) endpoint (default: /sse
)
custom_messages_endpoint: Option<String>
Optional custom path for the MCP messages endpoint (default: /messages
)
ping_interval: Duration
Interval between automatic ping messages sent to clients to detect disconnects
enable_ssl: bool
Enables SSL/TLS if set to true
ssl_cert_path: Option<String>
Path to the SSL/TLS certificate file (e.g., “cert.pem”).
Required if enable_ssl
is true
.
ssl_key_path: Option<String>
Path to the SSL/TLS private key file (e.g., “key.pem”).
Required if enable_ssl
is true
.
transport_options: Arc<TransportOptions>
Shared transport configuration used by the server
session_id_generator: Option<Arc<dyn IdGenerator>>
Optional thread-safe session id generator to generate unique session IDs.
Implementations§
Source§impl HyperServerOptions
impl HyperServerOptions
Sourcepub fn validate(&self) -> TransportServerResult<()>
pub fn validate(&self) -> TransportServerResult<()>
Validates the server configuration options
Ensures that SSL-related paths are provided and valid when SSL is enabled.
§Returns
TransportServerResult<()>
- Ok if validation passes, Err with TransportServerError if invalid
pub fn sse_endpoint(&self) -> &str
pub fn sse_messages_endpoint(&self) -> &str
Trait Implementations§
Source§impl Default for HyperServerOptions
Default implementation for HyperServerOptions
impl Default for HyperServerOptions
Default implementation for HyperServerOptions
Provides default values for the server configuration, including localhost address, port 8080, default SSE endpoint, and 12-second ping interval.