Skip to content

Commit b46f7c3

Browse files
chore(dependencies): upgrade MCP SDK to 2.0.0-M3
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 2213a96 commit b46f7c3

3 files changed

Lines changed: 24 additions & 23 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<jetty.version>12.1.9</jetty.version>
6161
<junit.version>6.1.0</junit.version>
6262
<logback.version>1.5.32</logback.version>
63-
<mcp-sdk.version>1.1.2</mcp-sdk.version>
63+
<mcp-sdk.version>2.0.0-M3</mcp-sdk.version>
6464
<mockito.version>5.23.0</mockito.version>
6565
<reflections.version>0.10.2</reflections.version>
6666
</properties>

src/main/java/com/github/thought2code/mcp/annotated/server/component/McpServerTool.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
* @see McpJsonSchemaDefinition
5656
* @see McpJsonSchemaProperty
5757
* @see McpSchema.Tool
58-
* @see McpSchema.JsonSchema
5958
* @see McpStructuredContent
6059
*/
6160
public class McpServerTool
@@ -86,7 +85,6 @@ public McpServerTool() {
8685
* @return a synchronous tool specification for the MCP server
8786
* @see McpTool
8887
* @see McpSchema.Tool
89-
* @see McpSchema.JsonSchema
9088
*/
9189
@Override
9290
public McpServerFeatures.SyncToolSpecification from(
@@ -224,7 +222,7 @@ private McpSchema.CallToolResult invoke(
224222
* @see McpJsonSchemaProperty
225223
* @see JavaTypeToJsonSchemaMapper
226224
*/
227-
private McpSchema.JsonSchema createJsonSchema(
225+
private Map<String, Object> createJsonSchema(
228226
McpApplicationContext context, Parameter[] methodParams) {
229227
Map<String, Object> properties = new LinkedHashMap<>();
230228
Map<String, Object> definitions = new LinkedHashMap<>();
@@ -255,14 +253,14 @@ private McpSchema.JsonSchema createJsonSchema(
255253
}
256254
}
257255

258-
final boolean hasAdditionalProperties = false;
259-
return new McpSchema.JsonSchema(
260-
JavaTypeToJsonSchemaMapper.OBJECT.getJsonSchemaType(),
261-
properties,
262-
required,
263-
hasAdditionalProperties,
264-
definitions,
265-
definitions);
256+
Map<String, Object> schema = new LinkedHashMap<>();
257+
schema.put("type", JavaTypeToJsonSchemaMapper.OBJECT.getJsonSchemaType());
258+
schema.put("properties", properties);
259+
schema.put("required", required);
260+
schema.put("additionalProperties", false);
261+
schema.put("definitions", definitions);
262+
263+
return schema;
266264
}
267265

268266
/**
@@ -331,7 +329,7 @@ private ToolDefinition createToolDefinition(
331329
final String name = StringHelper.defaultIfBlank(mcpTool.name(), method.getName());
332330
final String title = context.getLocalizedString(mcpTool.title(), name);
333331
final String description = context.getLocalizedString(mcpTool.description(), name);
334-
McpSchema.JsonSchema inputSchema = createJsonSchema(context, method.getParameters());
332+
Map<String, Object> inputSchema = createJsonSchema(context, method.getParameters());
335333
Map<String, Object> outputSchema = createJsonSchemaDefinition(context, method.getReturnType());
336334
McpSchema.Tool tool =
337335
McpSchema.Tool.builder()

src/test/java/com/github/thought2code/mcp/annotated/McpApplicationTest.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -487,18 +487,21 @@ private void verifyToolRegistered(
487487
assertEquals(toolName, tool.name());
488488
assertEquals(toolTitle, tool.title());
489489
assertEquals(toolDescription, tool.description());
490-
assertEquals(inputSchemaPropertiesTypes.size(), tool.inputSchema().properties().size());
490+
Map<String, Object> inputSchema = tool.inputSchema();
491+
assertNotNull(inputSchema);
492+
@SuppressWarnings("unchecked")
493+
Map<String, Object> properties = (Map<String, Object>) inputSchema.get("properties");
494+
assertNotNull(properties);
495+
assertEquals(inputSchemaPropertiesTypes.size(), properties.size());
491496

492497
// verify input schema properties types
493-
tool.inputSchema()
494-
.properties()
495-
.forEach(
496-
(name, property) -> {
497-
Map<String, String> props = (Map<String, String>) property;
498-
Class<?> javaClass = inputSchemaPropertiesTypes.get(name);
499-
final String jsonSchemaType = JavaTypeToJsonSchemaMapper.getJsonSchemaType(javaClass);
500-
assertEquals(jsonSchemaType, props.get("type"));
501-
});
498+
properties.forEach(
499+
(name, property) -> {
500+
Map<String, String> props = (Map<String, String>) property;
501+
Class<?> javaClass = inputSchemaPropertiesTypes.get(name);
502+
final String jsonSchemaType = JavaTypeToJsonSchemaMapper.getJsonSchemaType(javaClass);
503+
assertEquals(jsonSchemaType, props.get("type"));
504+
});
502505
}
503506

504507
private void verifyToolsCalled(McpSyncClient client) {

0 commit comments

Comments
 (0)