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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiontools.jackson.databind.json.JsonMapperCreates a configuredJsonMapperfor MCP server JSON serialization.
-
Constructor Details
-
McpServerJsonMapperAutoConfiguration
public McpServerJsonMapperAutoConfiguration()
-
-
Method Details
-
mcpServerJsonMapper
@Bean(name="mcpServerJsonMapper", defaultCandidate=false) public tools.jackson.databind.json.JsonMapper mcpServerJsonMapper()Creates a configuredJsonMapperfor 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
JsonMapperbean with the name "mcpServerJsonMapper".- Returns:
- configured
JsonMapperinstance for MCP server operations
-