Skip to content

Commit c657c54

Browse files
authored
Merge branch 'main' into main
2 parents ea0c7ab + e307927 commit c657c54

File tree

12 files changed

+51
-55
lines changed

12 files changed

+51
-55
lines changed

mcp-bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>io.modelcontextprotocol.sdk</groupId>
99
<artifactId>mcp-parent</artifactId>
10-
<version>0.16.0-SNAPSHOT</version>
10+
<version>0.17.0-SNAPSHOT</version>
1111
</parent>
1212

1313
<artifactId>mcp-bom</artifactId>

mcp-core/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.modelcontextprotocol.sdk</groupId>
88
<artifactId>mcp-parent</artifactId>
9-
<version>0.16.0-SNAPSHOT</version>
9+
<version>0.17.0-SNAPSHOT</version>
1010
</parent>
1111
<artifactId>mcp-core</artifactId>
1212
<packaging>jar</packaging>
@@ -68,7 +68,7 @@
6868
<dependency>
6969
<groupId>io.modelcontextprotocol.sdk</groupId>
7070
<artifactId>mcp-json</artifactId>
71-
<version>0.16.0-SNAPSHOT</version>
71+
<version>0.17.0-SNAPSHOT</version>
7272
</dependency>
7373

7474
<dependency>
@@ -101,7 +101,7 @@
101101
<dependency>
102102
<groupId>io.modelcontextprotocol.sdk</groupId>
103103
<artifactId>mcp-json-jackson2</artifactId>
104-
<version>0.16.0-SNAPSHOT</version>
104+
<version>0.17.0-SNAPSHOT</version>
105105
<scope>test</scope>
106106
</dependency>
107107

mcp-core/src/main/java/io/modelcontextprotocol/server/McpServer.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,6 @@ public AsyncSpecification<S> resources(McpServerFeatures.AsyncResourceSpecificat
598598
* null.
599599
* @return This builder instance for method chaining
600600
* @throws IllegalArgumentException if resourceTemplates is null.
601-
* @see #resourceTemplates(ResourceTemplate...)
602601
*/
603602
public AsyncSpecification<S> resourceTemplates(
604603
List<McpServerFeatures.AsyncResourceTemplateSpecification> resourceTemplates) {
@@ -1195,7 +1194,6 @@ public SyncSpecification<S> resources(McpServerFeatures.SyncResourceSpecificatio
11951194
* null.
11961195
* @return This builder instance for method chaining
11971196
* @throws IllegalArgumentException if resourceTemplates is null.
1198-
* @see #resourceTemplates(ResourceTemplate...)
11991197
*/
12001198
public SyncSpecification<S> resourceTemplates(
12011199
List<McpServerFeatures.SyncResourceTemplateSpecification> resourceTemplates) {
@@ -1703,7 +1701,6 @@ public StatelessAsyncSpecification resources(
17031701
* templates.
17041702
* @return This builder instance for method chaining
17051703
* @throws IllegalArgumentException if resourceTemplates is null.
1706-
* @see #resourceTemplates(ResourceTemplate...)
17071704
*/
17081705
public StatelessAsyncSpecification resourceTemplates(
17091706
List<McpStatelessServerFeatures.AsyncResourceTemplateSpecification> resourceTemplates) {
@@ -2166,7 +2163,6 @@ public StatelessSyncSpecification resources(
21662163
* existing templates.
21672164
* @return This builder instance for method chaining
21682165
* @throws IllegalArgumentException if resourceTemplates is null.
2169-
* @see #resourceTemplates(ResourceTemplate...)
21702166
*/
21712167
public StatelessSyncSpecification resourceTemplates(
21722168
List<McpStatelessServerFeatures.SyncResourceTemplateSpecification> resourceTemplatesSpec) {

mcp-core/src/main/java/io/modelcontextprotocol/spec/McpSchema.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ public sealed interface Request extends Meta
167167
permits InitializeRequest, CallToolRequest, CreateMessageRequest, ElicitRequest, CompleteRequest,
168168
GetPromptRequest, ReadResourceRequest, SubscribeRequest, UnsubscribeRequest, PaginatedRequest {
169169

170-
default String progressToken() {
170+
default Object progressToken() {
171171
if (meta() != null && meta().containsKey("progressToken")) {
172-
return meta().get("progressToken").toString();
172+
return meta().get("progressToken");
173173
}
174174
return null;
175175
}
@@ -277,12 +277,12 @@ public record JSONRPCNotification( // @formatter:off
277277
}
278278

279279
/**
280-
* A successful (non-error) response to a request.
280+
* A response to a request (successful, or error).
281281
*
282282
* @param jsonrpc The JSON-RPC version (must be "2.0")
283283
* @param id The request identifier that this response corresponds to
284-
* @param result The result of the successful request
285-
* @param error Error information if the request failed
284+
* @param result The result of the successful request; null if error
285+
* @param error Error information if the request failed; null if has result
286286
*/
287287
@JsonInclude(JsonInclude.Include.NON_ABSENT)
288288
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -1502,7 +1502,7 @@ public Builder meta(Map<String, Object> meta) {
15021502
return this;
15031503
}
15041504

1505-
public Builder progressToken(String progressToken) {
1505+
public Builder progressToken(Object progressToken) {
15061506
if (this.meta == null) {
15071507
this.meta = new HashMap<>();
15081508
}
@@ -1912,7 +1912,7 @@ public Builder meta(Map<String, Object> meta) {
19121912
return this;
19131913
}
19141914

1915-
public Builder progressToken(String progressToken) {
1915+
public Builder progressToken(Object progressToken) {
19161916
if (this.meta == null) {
19171917
this.meta = new HashMap<>();
19181918
}
@@ -2080,7 +2080,7 @@ public Builder meta(Map<String, Object> meta) {
20802080
return this;
20812081
}
20822082

2083-
public Builder progressToken(String progressToken) {
2083+
public Builder progressToken(Object progressToken) {
20842084
if (this.meta == null) {
20852085
this.meta = new HashMap<>();
20862086
}
@@ -2217,13 +2217,13 @@ public record PaginatedResult(@JsonProperty("nextCursor") String nextCursor) {
22172217
@JsonInclude(JsonInclude.Include.NON_ABSENT)
22182218
@JsonIgnoreProperties(ignoreUnknown = true)
22192219
public record ProgressNotification( // @formatter:off
2220-
@JsonProperty("progressToken") String progressToken,
2220+
@JsonProperty("progressToken") Object progressToken,
22212221
@JsonProperty("progress") Double progress,
22222222
@JsonProperty("total") Double total,
22232223
@JsonProperty("message") String message,
22242224
@JsonProperty("_meta") Map<String, Object> meta) implements Notification { // @formatter:on
22252225

2226-
public ProgressNotification(String progressToken, double progress, Double total, String message) {
2226+
public ProgressNotification(Object progressToken, double progress, Double total, String message) {
22272227
this(progressToken, progress, total, message, null);
22282228
}
22292229
}

mcp-json-jackson2/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.modelcontextprotocol.sdk</groupId>
88
<artifactId>mcp-parent</artifactId>
9-
<version>0.16.0-SNAPSHOT</version>
9+
<version>0.17.0-SNAPSHOT</version>
1010
</parent>
1111
<artifactId>mcp-json-jackson2</artifactId>
1212
<packaging>jar</packaging>
@@ -37,7 +37,7 @@
3737
<dependency>
3838
<groupId>io.modelcontextprotocol.sdk</groupId>
3939
<artifactId>mcp-json</artifactId>
40-
<version>0.16.0-SNAPSHOT</version>
40+
<version>0.17.0-SNAPSHOT</version>
4141
</dependency>
4242
<dependency>
4343
<groupId>com.fasterxml.jackson.core</groupId>

mcp-json-jackson2/src/main/java/io/modelcontextprotocol/json/schema/jackson/DefaultJsonSchemaValidator.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
*/
44
package io.modelcontextprotocol.json.schema.jackson;
55

6+
import java.util.List;
67
import java.util.Map;
7-
import java.util.Set;
88
import java.util.concurrent.ConcurrentHashMap;
99

1010
import com.fasterxml.jackson.core.JsonProcessingException;
1111
import com.fasterxml.jackson.databind.JsonNode;
1212
import com.fasterxml.jackson.databind.ObjectMapper;
13-
import com.networknt.schema.JsonSchema;
14-
import com.networknt.schema.JsonSchemaFactory;
15-
import com.networknt.schema.SpecVersion;
16-
import com.networknt.schema.ValidationMessage;
13+
import com.networknt.schema.Schema;
14+
import com.networknt.schema.SchemaRegistry;
15+
import com.networknt.schema.Error;
16+
import com.networknt.schema.dialect.Dialects;
1717
import io.modelcontextprotocol.json.schema.JsonSchemaValidator;
1818
import org.slf4j.Logger;
1919
import org.slf4j.LoggerFactory;
@@ -31,18 +31,18 @@ public class DefaultJsonSchemaValidator implements JsonSchemaValidator {
3131

3232
private final ObjectMapper objectMapper;
3333

34-
private final JsonSchemaFactory schemaFactory;
34+
private final SchemaRegistry schemaFactory;
3535

3636
// TODO: Implement a strategy to purge the cache (TTL, size limit, etc.)
37-
private final ConcurrentHashMap<String, JsonSchema> schemaCache;
37+
private final ConcurrentHashMap<String, Schema> schemaCache;
3838

3939
public DefaultJsonSchemaValidator() {
4040
this(new ObjectMapper());
4141
}
4242

4343
public DefaultJsonSchemaValidator(ObjectMapper objectMapper) {
4444
this.objectMapper = objectMapper;
45-
this.schemaFactory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V202012);
45+
this.schemaFactory = SchemaRegistry.withDialect(Dialects.getDraft202012());
4646
this.schemaCache = new ConcurrentHashMap<>();
4747
}
4848

@@ -62,7 +62,7 @@ public ValidationResponse validate(Map<String, Object> schema, Object structured
6262
? this.objectMapper.readTree((String) structuredContent)
6363
: this.objectMapper.valueToTree(structuredContent);
6464

65-
Set<ValidationMessage> validationResult = this.getOrCreateJsonSchema(schema).validate(jsonStructuredOutput);
65+
List<Error> validationResult = this.getOrCreateJsonSchema(schema).validate(jsonStructuredOutput);
6666

6767
// Check if validation passed
6868
if (!validationResult.isEmpty()) {
@@ -85,36 +85,36 @@ public ValidationResponse validate(Map<String, Object> schema, Object structured
8585
}
8686

8787
/**
88-
* Gets a cached JsonSchema or creates and caches a new one.
88+
* Gets a cached Schema or creates and caches a new one.
8989
* @param schema the schema map to convert
90-
* @return the compiled JsonSchema
90+
* @return the compiled Schema
9191
* @throws JsonProcessingException if schema processing fails
9292
*/
93-
private JsonSchema getOrCreateJsonSchema(Map<String, Object> schema) throws JsonProcessingException {
93+
private Schema getOrCreateJsonSchema(Map<String, Object> schema) throws JsonProcessingException {
9494
// Generate cache key based on schema content
9595
String cacheKey = this.generateCacheKey(schema);
9696

9797
// Try to get from cache first
98-
JsonSchema cachedSchema = this.schemaCache.get(cacheKey);
98+
Schema cachedSchema = this.schemaCache.get(cacheKey);
9999
if (cachedSchema != null) {
100100
return cachedSchema;
101101
}
102102

103103
// Create new schema if not in cache
104-
JsonSchema newSchema = this.createJsonSchema(schema);
104+
Schema newSchema = this.createJsonSchema(schema);
105105

106106
// Cache the schema
107-
JsonSchema existingSchema = this.schemaCache.putIfAbsent(cacheKey, newSchema);
107+
Schema existingSchema = this.schemaCache.putIfAbsent(cacheKey, newSchema);
108108
return existingSchema != null ? existingSchema : newSchema;
109109
}
110110

111111
/**
112-
* Creates a new JsonSchema from the given schema map.
112+
* Creates a new Schema from the given schema map.
113113
* @param schema the schema map
114-
* @return the compiled JsonSchema
114+
* @return the compiled Schema
115115
* @throws JsonProcessingException if schema processing fails
116116
*/
117-
private JsonSchema createJsonSchema(Map<String, Object> schema) throws JsonProcessingException {
117+
private Schema createJsonSchema(Map<String, Object> schema) throws JsonProcessingException {
118118
// Convert schema map directly to JsonNode (more efficient than string
119119
// serialization)
120120
JsonNode schemaNode = this.objectMapper.valueToTree(schema);

mcp-json/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.modelcontextprotocol.sdk</groupId>
88
<artifactId>mcp-parent</artifactId>
9-
<version>0.16.0-SNAPSHOT</version>
9+
<version>0.17.0-SNAPSHOT</version>
1010
</parent>
1111
<artifactId>mcp-json</artifactId>
1212
<packaging>jar</packaging>

mcp-spring/mcp-spring-webflux/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.modelcontextprotocol.sdk</groupId>
88
<artifactId>mcp-parent</artifactId>
9-
<version>0.16.0-SNAPSHOT</version>
9+
<version>0.17.0-SNAPSHOT</version>
1010
<relativePath>../../pom.xml</relativePath>
1111
</parent>
1212
<artifactId>mcp-spring-webflux</artifactId>
@@ -25,19 +25,19 @@
2525
<dependency>
2626
<groupId>io.modelcontextprotocol.sdk</groupId>
2727
<artifactId>mcp-json-jackson2</artifactId>
28-
<version>0.16.0-SNAPSHOT</version>
28+
<version>0.17.0-SNAPSHOT</version>
2929
</dependency>
3030

3131
<dependency>
3232
<groupId>io.modelcontextprotocol.sdk</groupId>
3333
<artifactId>mcp</artifactId>
34-
<version>0.16.0-SNAPSHOT</version>
34+
<version>0.17.0-SNAPSHOT</version>
3535
</dependency>
3636

3737
<dependency>
3838
<groupId>io.modelcontextprotocol.sdk</groupId>
3939
<artifactId>mcp-test</artifactId>
40-
<version>0.16.0-SNAPSHOT</version>
40+
<version>0.17.0-SNAPSHOT</version>
4141
<scope>test</scope>
4242
</dependency>
4343

mcp-spring/mcp-spring-webmvc/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.modelcontextprotocol.sdk</groupId>
88
<artifactId>mcp-parent</artifactId>
9-
<version>0.16.0-SNAPSHOT</version>
9+
<version>0.17.0-SNAPSHOT</version>
1010
<relativePath>../../pom.xml</relativePath>
1111
</parent>
1212
<artifactId>mcp-spring-webmvc</artifactId>
@@ -25,13 +25,13 @@
2525
<dependency>
2626
<groupId>io.modelcontextprotocol.sdk</groupId>
2727
<artifactId>mcp-json-jackson2</artifactId>
28-
<version>0.16.0-SNAPSHOT</version>
28+
<version>0.17.0-SNAPSHOT</version>
2929
</dependency>
3030

3131
<dependency>
3232
<groupId>io.modelcontextprotocol.sdk</groupId>
3333
<artifactId>mcp</artifactId>
34-
<version>0.16.0-SNAPSHOT</version>
34+
<version>0.17.0-SNAPSHOT</version>
3535
</dependency>
3636

3737
<dependency>
@@ -43,14 +43,14 @@
4343
<dependency>
4444
<groupId>io.modelcontextprotocol.sdk</groupId>
4545
<artifactId>mcp-test</artifactId>
46-
<version>0.16.0-SNAPSHOT</version>
46+
<version>0.17.0-SNAPSHOT</version>
4747
<scope>test</scope>
4848
</dependency>
4949

5050
<dependency>
5151
<groupId>io.modelcontextprotocol.sdk</groupId>
5252
<artifactId>mcp-spring-webflux</artifactId>
53-
<version>0.16.0-SNAPSHOT</version>
53+
<version>0.17.0-SNAPSHOT</version>
5454
<scope>test</scope>
5555
</dependency>
5656

mcp-test/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>io.modelcontextprotocol.sdk</groupId>
88
<artifactId>mcp-parent</artifactId>
9-
<version>0.16.0-SNAPSHOT</version>
9+
<version>0.17.0-SNAPSHOT</version>
1010
</parent>
1111
<artifactId>mcp-test</artifactId>
1212
<packaging>jar</packaging>
@@ -24,7 +24,7 @@
2424
<dependency>
2525
<groupId>io.modelcontextprotocol.sdk</groupId>
2626
<artifactId>mcp</artifactId>
27-
<version>0.16.0-SNAPSHOT</version>
27+
<version>0.17.0-SNAPSHOT</version>
2828
</dependency>
2929

3030
<dependency>

0 commit comments

Comments
 (0)