Class McpSessionConfig

java.lang.Object
com.soklet.McpSessionConfig

@ThreadSafe public final class McpSessionConfig extends Object
Immutable server-wide ownership and bounds for explicitly enabled MCP 2025-06-18 and 2025-11-25 sessions. Soklet's 2026-07-28 implementation does not use this configuration.

Configure this value on McpServer.Builder.sessionConfig(McpSessionConfig) and select exact session revisions on each applicable endpoint through McpEndpoint.Builder.sessionProtocolVersions(java.util.Set). Configuration alone does not enable sessions on every endpoint. Sessions are bounded, node-local state owned by the MCP server's lifecycle; session IDs are correlation handles, not credentials. Every use requires fresh admission and owner verification. Multi-node deployments require affinity to the initializing node for all session traffic. There is no application-supplied session-store hook; node loss requires client reinitialization and resubscription. Application-owned task storage, publishers, and authorization services may be distributed independently of these local sessions.

Capacity reclamation replaces only the initializing owner's quiescent sessions after at least 30 seconds without client activity or physically active client work. Repeated reconnects without DELETE can reach the owner limit before any record becomes eligible. There is no global fair-share reclamation: the default 256 slots can be filled by 16 owners at their 16-session limits, denying new owners until slots are released or abandoned sessions reach the 24-hour idle limit. Configure counts for the owner population and idle duration for abandoned clients. Session capacity failures do not supply an invented retry delay. Anonymous sessions, when enabled, also share a 64-session global ceiling.

Instances retain reference identity because the application-owned resolver is a live callback. Configuration does not make its state immutable or transfer its lifecycle to Soklet. Defaults are initial operational limits, not a recovery or capacity guarantee for a particular deployment.

Author:
Mark Allen
  • Method Details

    • withOwnerKeyResolver

      Vends a builder primed with its required application owner resolver.
      Parameters:
      sessionOwnerKeyResolver - application-owned stable owner resolver
      Returns:
      a session-configuration builder
      Throws:
      NullPointerException - if the resolver is null
    • getOwnerKeyResolver

      Returns:
      application-owned stable owner resolver
    • getMaximumSessions

      Returns:
      maximum live and provisional sessions across this server; default 256
    • getMaximumSessionsPerOwner

      Returns:
      maximum sessions for one resolved owner; default 16
    • getMaximumSessionIdleDuration

      Returns the lifetime of a quiescent session without accepted owner-bound activity. Physically active initialization, POST and GET work prevents idle expiry. Background URI authorization renewal does not refresh this lifetime or prevent logical expiry; unfinished callbacks retain their evidence until they exit. Invalid requests and transport keep-alives do not refresh this lifetime.
      Returns:
      positive idle lifetime; default 24 hours
    • getMaximumSessionDuration

      Returns the absolute session lifetime, independent of activity.
      Returns:
      positive hard lifetime; default 7 days
    • getMaximumClientMetadataSizeInBytes

      Returns the maximum retained initialization client-info and capability projection size. Existing JSON byte and node limits also apply; an oversized snapshot is rejected rather than partially retained.
      Returns:
      maximum encoded projection size in bytes; default 65536
    • isAnonymousSessionsAllowed

      Indicates whether identities for which McpAdmissionIdentity.isAuthenticated() is false may allocate sessions. Anonymous owners use separate internal namespaces and a bounded shared sub-budget in addition to the configured owner and server limits.
      Returns:
      whether anonymous sessions are allowed; default false
    • getTransportAdmissionController

      Returns the HTTP controller for GET delivery and DELETE cleanup on the explicitly session-enabled 2025 revisions. Absence disables both methods. A controller enables DELETE cleanup; GET additionally requires an explicit endpoint subscription revision and effective notification families.
      Returns:
      application-owned HTTP transport admission controller, when configured