pub struct SessionConfig {
pub ttl: Duration,
pub max_sessions: Option<usize>,
pub cleanup_interval: Duration,
pub strict_initialization: bool,
}Expand description
Configuration for session management
Fields§
§ttl: DurationTime-to-live for inactive sessions
max_sessions: Option<usize>Maximum number of sessions (None = unlimited)
cleanup_interval: DurationHow often to run the cleanup task
strict_initialization: boolWhether to enforce that clients send notifications/initialized before
making any non-initialize requests, per the MCP 2025-11-25 spec.
When true (the default), the transport returns a JSON-RPC
InvalidRequest error (-32600) to any request received before
notifications/initialized on a 2025-11-25 session-based connection.
Set to false to restore the previous lenient behavior, e.g. in
dev/test scenarios where the full MCP handshake is inconvenient.
Implementations§
Source§impl SessionConfig
impl SessionConfig
Sourcepub fn max_sessions(self, max: usize) -> Self
pub fn max_sessions(self, max: usize) -> Self
Set the maximum number of sessions
Sourcepub fn cleanup_interval(self, interval: Duration) -> Self
pub fn cleanup_interval(self, interval: Duration) -> Self
Set the cleanup interval
Sourcepub fn strict_initialization(self, enabled: bool) -> Self
pub fn strict_initialization(self, enabled: bool) -> Self
Enable or disable strict initialization enforcement.
When enabled (default), the transport enforces that clients send
notifications/initialized before any other requests on a
2025-11-25 session-based connection, per the MCP spec. Requests
that arrive before this notification receive a JSON-RPC
InvalidRequest error (-32600).
Disable this for dev/test scenarios where the full MCP handshake is inconvenient.
Trait Implementations§
Source§impl Clone for SessionConfig
impl Clone for SessionConfig
Source§fn clone(&self) -> SessionConfig
fn clone(&self) -> SessionConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more