Class McpServerJsonMapperAutoConfiguration

java.lang.Object
org.springframework.ai.mcp.server.common.autoconfigure.McpServerJsonMapperAutoConfiguration

@AutoConfiguration @ConditionalOnClass(io.modelcontextprotocol.spec.McpSchema.class) @ConditionalOnProperty(prefix="spring.ai.mcp.server", name="enabled", havingValue="true", matchIfMissing=true) @ConditionalOnMissingBean(name="mcpServerJsonMapper") public class McpServerJsonMapperAutoConfiguration extends Object
  • Constructor Details

    • McpServerJsonMapperAutoConfiguration

      public McpServerJsonMapperAutoConfiguration()
  • Method Details

    • mcpServerJsonMapper

      @Bean(name="mcpServerJsonMapper", defaultCandidate=false) public tools.jackson.databind.json.JsonMapper mcpServerJsonMapper()
      Creates a configured JsonMapper for MCP server JSON serialization.

      This JsonMapper is specifically configured for MCP protocol compliance with:

      • Lenient deserialization that doesn't fail on unknown properties
      • Proper handling of empty beans during serialization
      • Exclusion of null values from JSON output
      • Jackson modules via service loader

      This bean can be overridden by providing a custom JsonMapper bean with the name "mcpServerJsonMapper".

      Returns:
      configured JsonMapper instance for MCP server operations