You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2026/01/15 14:40:29 UTC
(sling-org-apache-sling-mcp-server) 23/27: fix(mcp-server): ignore unknown properties during deserialisation
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-mcp-server.git
commit 8e6ffef6b6ab363ece13b125ca347349bcbe60a1
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Tue Jan 13 13:30:01 2026 +0100
fix(mcp-server): ignore unknown properties during deserialisation
Workaround for upstream issue https://github.com/modelcontextprotocol/java-sdk/issues/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.
---
.../org/apache/sling/mcp/server/impl/McpJsonMapperProvider.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/main/java/org/apache/sling/mcp/server/impl/McpJsonMapperProvider.java b/src/main/java/org/apache/sling/mcp/server/impl/McpJsonMapperProvider.java
index 74bece1..5df93df 100644
--- a/src/main/java/org/apache/sling/mcp/server/impl/McpJsonMapperProvider.java
+++ b/src/main/java/org/apache/sling/mcp/server/impl/McpJsonMapperProvider.java
@@ -27,6 +27,8 @@ import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
+import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
+
@Component
public class McpJsonMapperProvider {
@@ -34,7 +36,10 @@ public class McpJsonMapperProvider {
@Activate
public void activate(BundleContext bundleContext) {
- McpJsonMapper jsonMapper = new JacksonMcpJsonMapper(new ObjectMapper());
+ ObjectMapper objectMapper = new ObjectMapper();
+ // work around https://github.com/modelcontextprotocol/java-sdk/issues/724
+ objectMapper.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
+ McpJsonMapper jsonMapper = new JacksonMcpJsonMapper(objectMapper);
serviceRegistration = bundleContext.registerService(McpJsonMapper.class, jsonMapper, null);
}