Class McpServerConfig

java.lang.Object
com.ssgllc.fish.config.mcp.McpServerConfig

@Configuration public class McpServerConfig extends Object
Core MCP server infrastructure configuration.

Registers the minimal set of tools, prompts, and resources that must be present at server startup so that MCP capability negotiation succeeds, then applies two compatibility patches needed for Spring AI 1.1.2 / mcp-core 0.17.0 with Claude Code 2.1.74+ (see mcpServerCompatibilityPatch(org.springframework.beans.factory.ObjectProvider<io.modelcontextprotocol.server.McpStatelessSyncServer>, com.fasterxml.jackson.databind.ObjectMapper)).

Initial tool

  • get-version-information — returns the Casetivity application version string

Initial prompt

  • casetivity-description — one-line platform description for AI context

Initial resources

  • texttemplate://EnvConfig — compact JSON of the EnvConfig text template
  • file://datamodel.json — compact JSON of the full application data model

Additional tools, prompts, and resources are registered by the other Mcp*Config beans and dynamically refreshed via McpRegistryRefresher.

Active only when spring.ai.mcp.server.enabled=true. Enable by adding mcp to SPRING_PROFILES_ACTIVE; the profile loads application-mcp.yml.

Local inspection

 npx @modelcontextprotocol/inspector
 # Connect to: http://localhost:8080/mcp
 
See Also:
  • McpRegistryRefresher
  • Constructor Summary

    Constructors
    Constructor
    Description
    McpServerConfig(com.ssgllc.fish.config.CasetivityProperties casetivityProperties, com.fasterxml.jackson.databind.ObjectMapper mapper)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncPromptSpecification>
    Registers initial prompts on startup so prompt capabilities are enabled.
    List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncResourceSpecification>
    Registers initial resources on startup so resource capabilities are enabled.
    List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification>
    Registers initial tools on startup so tool capabilities are enabled.
    org.springframework.beans.factory.SmartInitializingSingleton
    mcpServerCompatibilityPatch(org.springframework.beans.factory.ObjectProvider<io.modelcontextprotocol.server.McpStatelessSyncServer> syncServerProvider, com.fasterxml.jackson.databind.ObjectMapper mcpServerObjectMapper)
    Workaround for two Spring AI 1.1.2 / mcp-core 0.17.0 compatibility issues with Claude Code 2.1.74+ (which sends protocol 2025-11-25): jsonMapper: McpServerStatelessAutoConfiguration never calls .jsonMapper(...) on the server builder, so the server falls back to McpJsonMapper.getDefault() — a plain new ObjectMapper() with FAIL_ON_UNKNOWN_PROPERTIES=true.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • McpServerConfig

      public McpServerConfig(com.ssgllc.fish.config.CasetivityProperties casetivityProperties, com.fasterxml.jackson.databind.ObjectMapper mapper)
  • Method Details

    • initialTools

      @Bean public List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification> initialTools() throws com.fasterxml.jackson.core.JsonProcessingException
      Registers initial tools on startup so tool capabilities are enabled.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • initialPrompts

      @Bean public List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncPromptSpecification> initialPrompts()
      Registers initial prompts on startup so prompt capabilities are enabled.
    • initialResources

      @Bean public List<io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncResourceSpecification> initialResources()
      Registers initial resources on startup so resource capabilities are enabled.
    • mcpServerCompatibilityPatch

      @Bean public org.springframework.beans.factory.SmartInitializingSingleton mcpServerCompatibilityPatch(org.springframework.beans.factory.ObjectProvider<io.modelcontextprotocol.server.McpStatelessSyncServer> syncServerProvider, @Qualifier("mcpServerObjectMapper") com.fasterxml.jackson.databind.ObjectMapper mcpServerObjectMapper)
      Workaround for two Spring AI 1.1.2 / mcp-core 0.17.0 compatibility issues with Claude Code 2.1.74+ (which sends protocol 2025-11-25):
      1. jsonMapper: McpServerStatelessAutoConfiguration never calls .jsonMapper(...) on the server builder, so the server falls back to McpJsonMapper.getDefault() — a plain new ObjectMapper() with FAIL_ON_UNKNOWN_PROPERTIES=true. Claude Code sends capabilities.elicitation.form/url; the SDK's Elicitation record has 0 known fields and no @JsonIgnoreProperties, causing a silent -32603 error. Fix: replace with mcpServerObjectMapper which has FAIL_ON_UNKNOWN_PROPERTIES=false.
      2. protocolVersions: The transport hardcodes ["2025-03-26", "2025-06-18"]. When Claude Code sends 2025-11-25, the server downgrades to 2025-06-18 and Claude Code rejects the connection. Fix: add "2025-11-25" to the supported list. The two protocol versions are backward-compatible for our feature set.