modelcontextprotocol / modelcontextprotocol/java-sdk

Missing `@JsonIgnoreProperties(ignoreUnknown = true)` on capability sub-records

Offen
#766 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug P1
Vorherrschende Sprache
Java
Sterne
3.7k
Forks
1.1k
Ø Merge
1 T. 15 Std.
Gemergte PRs (30 T.)
9

Beschreibung

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.jsonadditionalProperties: 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 ToolCapabilities specifically
  • #724 / #731 — the elicitation breakage that was fixed by adding fields, not by adding the annotation

AI Disclaimer

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie in mcp-core/src/main/java/io/modelcontextprotocol/spec/McpSchema.java und überprüfen Sie die aufgeführten Capability-Records, indem Sie sie mit ClientCapabilities und ServerCapabilities vergleichen. Als abgeschlossen gilt die Aufgabe, wenn unbekannte Felder in jedem betroffenen Capability-Unterdatensatz bei der Deserialisierung ignoriert werden, einschließlich verschachtelter elicitation-Records.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
java
Bereich
api
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.