Class McpSessionConfig.Builder
java.lang.Object
com.soklet.McpSessionConfig.Builder
- Enclosing class:
McpSessionConfig
Builder for immutable
McpSessionConfig values.
This class is intended for use by a single thread. Null tuning arguments
restore their defaults; failed replacements leave prior values intact.- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionanonymousSessionsAllowed(@Nullable Boolean anonymousSessionsAllowed) Explicitly permits session allocation for unauthenticated admitted identities.build()Builds an immutable configuration without invoking its owner resolver.maximumClientMetadataSizeInBytes(@Nullable Integer maximumClientMetadataSizeInBytes) Sets the encoded initialization metadata projection limit.maximumSessionDuration(@Nullable Duration maximumSessionDuration) Sets the positive absolute session lifetime.maximumSessionIdleDuration(@Nullable Duration maximumSessionIdleDuration) Sets the positive quiescent session lifetime, no longer than the hard lifetime.maximumSessions(@Nullable Integer maximumSessions) Sets the server-wide live and provisional session limit.maximumSessionsPerOwner(@Nullable Integer maximumSessionsPerOwner) Sets the limit for one resolved owner; it must not exceed the server limit.transportAdmissionController(@Nullable McpSessionTransportAdmissionController sessionTransportAdmissionController) Sets fresh HTTP admission for session GET delivery and DELETE cleanup.
-
Method Details
-
maximumSessions
Sets the server-wide live and provisional session limit.- Parameters:
maximumSessions- positive limit, or null to restore 256- Returns:
- this builder
- Throws:
IllegalArgumentException- if the limit is not positive
-
maximumSessionsPerOwner
public @NonNull McpSessionConfig.Builder maximumSessionsPerOwner(@Nullable Integer maximumSessionsPerOwner) Sets the limit for one resolved owner; it must not exceed the server limit.- Parameters:
maximumSessionsPerOwner- positive limit, or null to restore 16- Returns:
- this builder
- Throws:
IllegalArgumentException- if the limit is not positive
-
maximumSessionIdleDuration
public @NonNull McpSessionConfig.Builder maximumSessionIdleDuration(@Nullable Duration maximumSessionIdleDuration) Sets the positive quiescent session lifetime, no longer than the hard lifetime.- Parameters:
maximumSessionIdleDuration- positive finite duration, or null to restore 24 hours- Returns:
- this builder
- Throws:
IllegalArgumentException- if the duration is not positive or does not fit in signed nanoseconds
-
maximumSessionDuration
public @NonNull McpSessionConfig.Builder maximumSessionDuration(@Nullable Duration maximumSessionDuration) Sets the positive absolute session lifetime.- Parameters:
maximumSessionDuration- positive finite duration, or null to restore 7 days- Returns:
- this builder
- Throws:
IllegalArgumentException- if the duration is not positive or does not fit in signed nanoseconds
-
maximumClientMetadataSizeInBytes
public @NonNull McpSessionConfig.Builder maximumClientMetadataSizeInBytes(@Nullable Integer maximumClientMetadataSizeInBytes) Sets the encoded initialization metadata projection limit.- Parameters:
maximumClientMetadataSizeInBytes- positive byte limit, or null to restore 65536- Returns:
- this builder
- Throws:
IllegalArgumentException- if the limit is not positive
-
anonymousSessionsAllowed
public @NonNull McpSessionConfig.Builder anonymousSessionsAllowed(@Nullable Boolean anonymousSessionsAllowed) Explicitly permits session allocation for unauthenticated admitted identities.- Parameters:
anonymousSessionsAllowed- whether anonymous allocation is allowed, or null to restore false- Returns:
- this builder
-
transportAdmissionController
public @NonNull McpSessionConfig.Builder transportAdmissionController(@Nullable McpSessionTransportAdmissionController sessionTransportAdmissionController) Sets fresh HTTP admission for session GET delivery and DELETE cleanup. The callback is application-owned and must support concurrent calls. Configuration alone does not enable GET notification delivery on every session endpoint. Null clears the controller and disables both methods.- Parameters:
sessionTransportAdmissionController- HTTP admission callback, or null to clear- Returns:
- this builder
-
build
Builds an immutable configuration without invoking its owner resolver.- Returns:
- session configuration
- Throws:
IllegalStateException- if the owner limit exceeds the server limit or the idle lifetime exceeds the hard lifetime
-