Description
After I started the mcp server, I failed to configure mcp through the cursor client. After debugging, I found that the cursor's mcp protocol interaction message contained undefined fields, which could not be recognized during json serialization, resulting in the error Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "tools"
Solution:
Specifically in McpWebFluxServerAutoConfiguration
You can add mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) during initialization
For example:
@bean
@ConditionalOnMissingBean
public WebFluxSseServerTransport webFluxTransport(McpServerProperties serverProperties) {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return new WebFluxSseServerTransport(mapper, serverProperties.getSseMessageEndpoint());
}