Class McpServerObjectMapperAutoConfiguration
java.lang.Object
org.springframework.ai.mcp.server.autoconfigure.McpServerObjectMapperAutoConfiguration
@AutoConfiguration(before={McpServerAutoConfiguration.class,McpWebMvcServerAutoConfiguration.class,McpWebFluxServerAutoConfiguration.class})
@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
Auto-configuration for the MCP server ObjectMapper.
Provides a dedicated ObjectMapper bean named mcpServerObjectMapper
configured for MCP protocol compliance. It can be overridden by providing a custom
ObjectMapper bean with the name mcpServerObjectMapper.
- Since:
- 1.0.0
- Author:
- Spring AI
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.databind.ObjectMapperCreates a configuredObjectMapperfor 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 configuredObjectMapperfor MCP server JSON serialization.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
ObjectMapperbean with the namemcpServerObjectMapper.- Returns:
- configured
ObjectMapperinstance for MCP server operations
-