Skip to content

Commit 2277ae7

Browse files
committed
fix(mcp-server): ignore unknown properties during deserialisation
Workaround for upstream issue modelcontextprotocol/java-sdk#724 . This appears with MCP clients implementing the 2025-11-25 version of the spec which supports more properties for the 'elicitation' object. For now, we ignore unknown properties since there is no release of the MCP Java SDK that contains the fix.
1 parent 71af2c4 commit 2277ae7

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎mcp-server/src/main/java/org/apache/sling/mcp/server/impl/McpJsonMapperProvider.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,19 @@
2727
import org.osgi.service.component.annotations.Component;
2828
import org.osgi.service.component.annotations.Deactivate;
2929

30+
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
31+
3032
@Component
3133
public class McpJsonMapperProvider {
3234

3335
private ServiceRegistration<McpJsonMapper> serviceRegistration;
3436

3537
@Activate
3638
public void activate(BundleContext bundleContext) {
37-
McpJsonMapper jsonMapper = new JacksonMcpJsonMapper(new ObjectMapper());
39+
ObjectMapper objectMapper = new ObjectMapper();
40+
// work around https://github.com/modelcontextprotocol/java-sdk/issues/724
41+
objectMapper.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
42+
McpJsonMapper jsonMapper = new JacksonMcpJsonMapper(objectMapper);
3843
serviceRegistration = bundleContext.registerService(McpJsonMapper.class, jsonMapper, null);
3944
}
4045

0 commit comments

Comments
 (0)