Class McpConfig.Builder

java.lang.Object
dev.relism.flash.ext.mcp.McpConfig.Builder
Enclosing class:
McpConfig

public static final class McpConfig.Builder extends Object
  • Method Details

    • version

      public McpConfig.Builder version(String version)
      Server version reported in initialize's serverInfo. Default "1.0.0".
    • instructions

      public McpConfig.Builder instructions(String instructions)
      Free-text instructions surfaced to the client at initialize time.
    • rootPath

      public McpConfig.Builder rootPath(String rootPath)
      HTTP path for the Streamable HTTP endpoint. Default "/mcp".
    • toolsPackage

      public McpConfig.Builder toolsPackage(String toolsPackage)
      Package scanned for @Tool/@Resource/@Prompt classes. Required.
    • security

      public McpConfig.Builder security(McpSecurity security)
    • requireTokenAudience

      public McpConfig.Builder requireTokenAudience(boolean require)
      Whether a bearer token must name this endpoint in its aud (RFC 8707), as the MCP authorization spec requires. Default true. Turn it off for an authorization server that cannot mint a resource audience — every token a registered issuer signs is then accepted on the endpoint, and a warning is logged at boot.
    • allowedOrigins

      public McpConfig.Builder allowedOrigins(String... origins)
      Origins allowed to call the MCP endpoint (DNS-rebinding protection, per the Streamable HTTP transport spec). If never set, Origin validation is skipped and a warning is logged at boot.
    • scopesSupported

      public McpConfig.Builder scopesSupported(String... scopes)
      Published as scopes_supported in the RFC 9728 metadata, so OAuth clients request them.
    • mechanisms

      public McpConfig.Builder mechanisms(dev.relism.flash.ext.security.AuthenticationMechanism... mechanisms)
      The only mechanisms that authenticate the endpoint, and the only issuers its RFC 9728 metadata names: any other credential, the session cookie included, is none here. Default: the whole chain.
    • middleware

      public McpConfig.Builder middleware(dev.relism.flash.routing.Middleware... middleware)
      Runs on the MCP route after the transport guards and authentication — rate limiting, auditing, tracing.
    • build

      public McpConfig build()