Class McpSessionStore.Builder

java.lang.Object
com.soklet.McpSessionStore.Builder
Enclosing interface:
McpSessionStore

@NotThreadSafe public static final class McpSessionStore.Builder extends Object
Builder for Soklet's default in-memory MCP session store.
Author:
Mark Allen
  • Method Details

    • idleTimeout

      Sets the idle timeout, or Duration.ZERO to disable idle expiry.

      Warning: with idle expiry disabled, sessions only release their slots via explicit termination or McpSessionStore.deleteBySessionId(String). If you also configure a finite concurrentSessionLimit(Integer), abandoned sessions (e.g. clients that disappear without terminating) will occupy slots indefinitely and can eventually block all new session admission. Ensure your application enforces session lifecycle cleanup, or keep a nonzero idle timeout.

      Parameters:
      idleTimeout - the idle timeout, or null for the default
      Returns:
      this builder
    • sessionIdGenerator

      Sets the generator used for newly-created MCP session IDs.

      Custom generators must return globally unique, cryptographically strong, visible-ASCII IDs suitable for MCP-Session-Id header values.

      Parameters:
      sessionIdGenerator - the session ID generator, or null for the default
      Returns:
      this builder
    • concurrentSessionLimit

      Sets the concurrent MCP session limit.

      A value of 0 disables the in-memory store's session cap.

      Parameters:
      concurrentSessionLimit - the concurrent MCP session limit, or null for the default
      Returns:
      this builder
    • build

      Builds the MCP session store.
      Returns:
      the built MCP session store