Optional ReadonlycleanupInterval between cleanup sweeps in milliseconds.
The housekeeper checks for expired/stale sessions at this interval.
Set to 0 to disable cleanup (e.g., stdio mode).
Optional ReadonlykeepKeep-alive heartbeat interval in milliseconds.
The housekeeper sends keep-alive pings at this interval to detect
dead connections. Set to 0 to disable heartbeats.
Optional ReadonlymaxMaximum missed heartbeats before a session is considered stale.
Optional ReadonlymaxMaximum concurrent sessions across all transports.
Optional ReadonlystoreCustom session store implementation.
When provided, replaces the built-in in-memory session store. Useful for horizontal scaling with Redis, PostgreSQL, or another shared backend.
Optional ReadonlytimeoutSession timeout in milliseconds.
Sessions inactive for longer than this value are cleaned up by the housekeeper. Lower values create "lightweight" sessions that free resources faster.
Session configuration options for the programmatic API.
Allows fine-tuning session lifecycle behavior directly from
createServer()orMcpServerBuilder.withOptions(). All properties are optional — defaults are resolved from environment variables and config files via the standard config cascade.This is particularly useful for "lightweight stateful" deployments where short session timeouts are preferred over full stateless mode, retaining cross-request features (cancellation, sampling, elicitation) that stateless mode cannot support.
Example
See
SessionConfig for default values