@@ -577,14 +577,23 @@ public InitializeResult build() {
577577 * @param roots Present if the client supports listing roots
578578 * @param sampling Present if the client supports sampling from an LLM
579579 * @param elicitation Present if the client supports elicitation from the server
580+ * @param extensions Present if the client supports MCP extensions, keyed by extension
581+ * identifier
580582 */
581583 @ JsonInclude (JsonInclude .Include .NON_ABSENT )
582584 @ JsonIgnoreProperties (ignoreUnknown = true )
583585 public record ClientCapabilities ( // @formatter:off
584586 @ JsonProperty ("experimental" ) Map <String , Object > experimental ,
585587 @ JsonProperty ("roots" ) RootCapabilities roots ,
586588 @ JsonProperty ("sampling" ) Sampling sampling ,
587- @ JsonProperty ("elicitation" ) Elicitation elicitation ) { // @formatter:on
589+ @ JsonProperty ("elicitation" ) Elicitation elicitation ,
590+ @ JsonProperty ("extensions" ) Map <String , Map <String , Object >> extensions ) { // @formatter:on
591+
592+ // Keep the old constructor so existing callers still compile
593+ public ClientCapabilities (Map <String , Object > experimental , RootCapabilities roots , Sampling sampling ,
594+ Elicitation elicitation ) {
595+ this (experimental , roots , sampling , elicitation , null );
596+ }
588597
589598 /**
590599 * Present if the client supports listing roots.
@@ -723,6 +732,8 @@ public static class Builder {
723732
724733 private Elicitation elicitation ;
725734
735+ private Map <String , Map <String , Object >> extensions ;
736+
726737 public Builder experimental (Map <String , Object > experimental ) {
727738 this .experimental = experimental ;
728739 return this ;
@@ -765,8 +776,13 @@ public Builder elicitation(Elicitation elicitation) {
765776 return this ;
766777 }
767778
779+ public Builder extensions (Map <String , Map <String , Object >> extensions ) {
780+ this .extensions = extensions ;
781+ return this ;
782+ }
783+
768784 public ClientCapabilities build () {
769- return new ClientCapabilities (experimental , roots , sampling , elicitation );
785+ return new ClientCapabilities (experimental , roots , sampling , elicitation , extensions );
770786 }
771787
772788 }
@@ -785,6 +801,8 @@ public ClientCapabilities build() {
785801 * @param prompts Present if the server offers any prompt templates
786802 * @param resources Present if the server offers any resources to read
787803 * @param tools Present if the server offers any tools to call
804+ * @param extensions Present if the server supports MCP extensions, keyed by extension
805+ * identifier
788806 */
789807 @ JsonInclude (JsonInclude .Include .NON_ABSENT )
790808 @ JsonIgnoreProperties (ignoreUnknown = true )
@@ -794,7 +812,15 @@ public record ServerCapabilities( // @formatter:off
794812 @ JsonProperty ("logging" ) LoggingCapabilities logging ,
795813 @ JsonProperty ("prompts" ) PromptCapabilities prompts ,
796814 @ JsonProperty ("resources" ) ResourceCapabilities resources ,
797- @ JsonProperty ("tools" ) ToolCapabilities tools ) { // @formatter:on
815+ @ JsonProperty ("tools" ) ToolCapabilities tools ,
816+ @ JsonProperty ("extensions" ) Map <String , Map <String , Object >> extensions ) { // @formatter:on
817+
818+ // Keep the old constructor so existing callers still compile
819+ public ServerCapabilities (CompletionCapabilities completions , Map <String , Object > experimental ,
820+ LoggingCapabilities logging , PromptCapabilities prompts , ResourceCapabilities resources ,
821+ ToolCapabilities tools ) {
822+ this (completions , experimental , logging , prompts , resources , tools , null );
823+ }
798824
799825 /**
800826 * Present if the server supports argument autocompletion suggestions.
@@ -923,6 +949,7 @@ public Builder mutate() {
923949 builder .prompts = this .prompts ;
924950 builder .resources = this .resources ;
925951 builder .tools = this .tools ;
952+ builder .extensions = this .extensions ;
926953 return builder ;
927954 }
928955
@@ -944,6 +971,8 @@ public static class Builder {
944971
945972 private ToolCapabilities tools ;
946973
974+ private Map <String , Map <String , Object >> extensions ;
975+
947976 public Builder completions () {
948977 this .completions = new CompletionCapabilities ();
949978 return this ;
@@ -974,8 +1003,14 @@ public Builder tools(Boolean listChanged) {
9741003 return this ;
9751004 }
9761005
1006+ public Builder extensions (Map <String , Map <String , Object >> extensions ) {
1007+ this .extensions = extensions ;
1008+ return this ;
1009+ }
1010+
9771011 public ServerCapabilities build () {
978- return new ServerCapabilities (completions , experimental , logging , prompts , resources , tools );
1012+ return new ServerCapabilities (completions , experimental , logging , prompts , resources , tools ,
1013+ extensions );
9791014 }
9801015
9811016 }
0 commit comments