Missing `@JsonIgnoreProperties(ignoreUnknown = true)` on capability sub-records
还没有人认领这个 Issue。
评估
调研方向
从 mcp-core/src/main/java/io/modelcontextprotocol/spec/McpSchema.java 开始,检查列出的 capability record,并将其与 ClientCapabilities 和 ServerCapabilities 进行比较。完成标准是:在反序列化期间,忽略每个受影响的 capability 子记录中的未知字段,包括嵌套的 elicitation record。
由索引模型根据 Issue 内容生成。
描述
Bug description
The top-level ClientCapabilities and ServerCapabilities records have @JsonIgnoreProperties(ignoreUnknown = true), but their nested sub-records do not. Since the ObjectMapper is constructed with default settings (FAIL_ON_UNKNOWN_PROPERTIES = true), any unknown field on a capability sub-object causes a deserialization failure.
This already caused a real breakage when the elicitation capability gained form and url fields (#724, fixed in #731), but the systemic issue remains — the next spec addition to any capability sub-object will break older SDK versions again.
Affected records
In McpSchema.java:
| Record | Line | Has annotation? |
|---|---|---|
ClientCapabilities |
383 | Yes |
RootCapabilities |
397 | Yes |
Sampling |
410 | No |
Elicitation |
437 | No |
Elicitation.Form |
443 | No |
Elicitation.Url |
450 | No |
ServerCapabilities |
535 | Yes |
CompletionCapabilities |
548 | No |
LoggingCapabilities |
555 | No |
PromptCapabilities |
565 | No |
ResourceCapabilities |
576 | No |
ToolCapabilities |
587 | No |
Spec reference
The spec schema explicitly states capabilities are not a closed set:
"Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities."
ClientCapabilities in schema.json — additionalProperties: false is never set on any capability object or sub-object. Several sub-capabilities (sampling, elicitation, completions, logging) explicitly set additionalProperties: true.
Expected behavior
Unknown fields on capability sub-objects should be silently ignored, matching the behavior of the top-level ClientCapabilities and ServerCapabilities records.
Related
- #734 — reports the same issue for
ToolCapabilitiesspecifically - #724 / #731 — the elicitation breakage that was fixed by adding fields, not by adding the annotation
- 主要语言
- Java
- 星标
- 3.7k
- 派生
- 1.1k
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 9
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/java-sdk 的其他 Issue
-
area/transport bug P2
难度 2/5 1-3 小时 新手友好度 88/100
modelcontextprotocol/java-sdk#1136 ·
-
area/client bug P2
难度 2/5 1-3 小时 新手友好度 84/100
modelcontextprotocol/java-sdk#1124 · 1 条评论 ·
-
ServerCapabilities.logging is added unconditionally, overriding the caller's explicit capabilities 未关闭bug P2 ready for work
难度 2/5 1-3 小时 新手友好度 68/100
modelcontextprotocol/java-sdk#1086 · 1 条评论 ·
-
enhancement good first issue P3
难度 2/5 1-3 小时 新手友好度 82/100
modelcontextprotocol/java-sdk#1067 ·
-
bug P2 ready for work
难度 2/5 1-3 小时 新手友好度 74/100
modelcontextprotocol/java-sdk#898 · 1 条评论 ·
查看 modelcontextprotocol/java-sdk 的全部 Issue
相似的 Issue
-
bug untriaged
难度 2/5 1-3 小时 新手友好度 84/100
opensearch-project/ml-commons#5094 ·
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
-
emitter:client:csharp feature
难度 2/5 1-3 小时 新手友好度 72/100
-
affects/8.10 affects/8.9 component/clients kind/bug likelihood/mid severity/mid
难度 2/5 1-3 小时 新手友好度 78/100
-
bug frontend maui-pilot
难度 2/5 1-3 小时 新手友好度 72/100