|
| 1 | +/* |
| 2 | + * Copyright (C) 2020 Graylog, Inc. |
| 3 | + * |
| 4 | + * This program is free software: you can redistribute it and/or modify |
| 5 | + * it under the terms of the Server Side Public License, version 1, |
| 6 | + * as published by MongoDB, Inc. |
| 7 | + * |
| 8 | + * This program is distributed in the hope that it will be useful, |
| 9 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | + * Server Side Public License for more details. |
| 12 | + * |
| 13 | + * You should have received a copy of the Server Side Public License |
| 14 | + * along with this program. If not, see |
| 15 | + * <http://www.mongodb.com/licensing/server-side-public-license>. |
| 16 | + */ |
| 17 | +package org.graylog.mcp.server; |
| 18 | + |
| 19 | +import com.google.inject.BindingAnnotation; |
| 20 | + |
| 21 | +import java.lang.annotation.Retention; |
| 22 | +import java.lang.annotation.Target; |
| 23 | + |
| 24 | +import static java.lang.annotation.ElementType.FIELD; |
| 25 | +import static java.lang.annotation.ElementType.METHOD; |
| 26 | +import static java.lang.annotation.ElementType.PARAMETER; |
| 27 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; |
| 28 | + |
| 29 | +/** |
| 30 | + * Qualifier annotation for the ObjectMapper used to deserialize MCP protocol messages. |
| 31 | + * This mapper is a plain ObjectMapper configured with FAIL_ON_UNKNOWN_PROPERTIES=false, |
| 32 | + * unlike the global Graylog ObjectMapper which adds SnakeCaseStrategy and custom modules |
| 33 | + * that interfere with the MCP SDK's own Jackson annotations. |
| 34 | + * |
| 35 | + * Workaround for <a href="https://github.com/modelcontextprotocol/java-sdk/issues/766">java-sdk#766</a>. |
| 36 | + * Remove once the SDK adds @JsonIgnoreProperties(ignoreUnknown=true) to its capability records. |
| 37 | + */ |
| 38 | +@BindingAnnotation |
| 39 | +@Target({FIELD, PARAMETER, METHOD}) |
| 40 | +@Retention(RUNTIME) |
| 41 | +public @interface McpProtocolObjectMapper { |
| 42 | +} |
0 commit comments