Class McpServerObjectMapperAutoConfiguration
java.lang.Object
org.springframework.ai.mcp.server.common.autoconfigure.McpServerObjectMapperAutoConfiguration
@AutoConfiguration
@ConditionalOnClass(io.modelcontextprotocol.spec.McpSchema.class)
@ConditionalOnProperty(prefix="spring.ai.mcp.server",
name="enabled",
havingValue="true",
matchIfMissing=true)
@ConditionalOnMissingBean(name="mcpServerObjectMapper")
public class McpServerObjectMapperAutoConfiguration
extends Object
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.ObjectMapperCreates a configured ObjectMapper for MCP server JSON serialization.
-
Constructor Details
-
McpServerObjectMapperAutoConfiguration
public McpServerObjectMapperAutoConfiguration()
-
-
Method Details
-
mcpServerObjectMapper
@Bean(name="mcpServerObjectMapper", defaultCandidate=false) public com.fasterxml.jackson.databind.ObjectMapper mcpServerObjectMapper()Creates a configured ObjectMapper for MCP server JSON serialization.This ObjectMapper 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
- Standard Jackson modules for Java 8, JSR-310, and Kotlin support
This bean can be overridden by providing a custom ObjectMapper bean with the name "mcpServerObjectMapper".
- Returns:
- configured ObjectMapper instance for MCP server operations
-