From 9a7fcd517faacd7ce53a0b706e9292b382b03be1 Mon Sep 17 00:00:00 2001 From: Christian Tzolov Date: Tue, 14 Jan 2025 15:17:16 +0100 Subject: [PATCH] Update MCP version to 0.5.1 --- model-context-protocol/brave/pom.xml | 2 +- model-context-protocol/filesystem/pom.xml | 2 +- .../mcp-servlet-server/pom.xml | 2 +- .../sample/webmvc/server/McpServerConfig.java | 15 +++++----- .../mcp-webflux-server/pom.xml | 2 +- .../ai/mcp/sample/server/McpServerConfig.java | 30 +++++++++---------- .../mcp-webmvc-server/pom.xml | 2 +- .../sample/webmvc/server/McpServerConfig.java | 19 ++++++------ model-context-protocol/sqlite/chatbot/pom.xml | 2 +- model-context-protocol/sqlite/simple/pom.xml | 2 +- 10 files changed, 38 insertions(+), 40 deletions(-) diff --git a/model-context-protocol/brave/pom.xml b/model-context-protocol/brave/pom.xml index 3fa1cb4..060816f 100644 --- a/model-context-protocol/brave/pom.xml +++ b/model-context-protocol/brave/pom.xml @@ -43,7 +43,7 @@ org.springframework.experimental spring-ai-mcp - 0.5.0 + 0.5.1 diff --git a/model-context-protocol/filesystem/pom.xml b/model-context-protocol/filesystem/pom.xml index 2fb7f8d..e1ac77f 100644 --- a/model-context-protocol/filesystem/pom.xml +++ b/model-context-protocol/filesystem/pom.xml @@ -43,7 +43,7 @@ org.springframework.experimental spring-ai-mcp - 0.5.0 + 0.5.1 diff --git a/model-context-protocol/mcp-servlet-server/pom.xml b/model-context-protocol/mcp-servlet-server/pom.xml index 0db5ba4..7c72cda 100644 --- a/model-context-protocol/mcp-servlet-server/pom.xml +++ b/model-context-protocol/mcp-servlet-server/pom.xml @@ -18,7 +18,7 @@ Sample application demonstrating MCP Servlet server usage - 0.5.0 + 0.5.1 diff --git a/model-context-protocol/mcp-servlet-server/src/main/java/org/springframework/ai/mcp/sample/webmvc/server/McpServerConfig.java b/model-context-protocol/mcp-servlet-server/src/main/java/org/springframework/ai/mcp/sample/webmvc/server/McpServerConfig.java index 5332945..04a47bd 100644 --- a/model-context-protocol/mcp-servlet-server/src/main/java/org/springframework/ai/mcp/sample/webmvc/server/McpServerConfig.java +++ b/model-context-protocol/mcp-servlet-server/src/main/java/org/springframework/ai/mcp/sample/webmvc/server/McpServerConfig.java @@ -58,6 +58,9 @@ public class McpServerConfig implements WebMvcConfigurer { return new StdioServerTransport(); } + public static record ToUpperCaseInput(String input) { + } + @Bean public McpAsyncServer mcpServer(ServerMcpTransport transport, OpenLibrary openLibrary) { // @formatter:off @@ -84,14 +87,14 @@ public class McpServerConfig implements WebMvcConfigurer { .build()), ToolHelper.toToolRegistration( FunctionCallback.builder() - .function("toUpperCase", new Function() { + .function("toUpperCase", new Function() { @Override - public String apply(String s) { - return s.toUpperCase(); + public String apply(ToUpperCaseInput s) { + return s.input().toUpperCase(); } }) .description("To upper case") - .inputType(String.class) + .inputType(ToUpperCaseInput.class) .build())) .tools(openLibraryToolRegistrations(openLibrary)) .async(); @@ -203,10 +206,6 @@ public class McpServerConfig implements WebMvcConfigurer { return "The status for " + transactionId + ", by " + accountName + " is PENDING"; } - public Function toUpperCase() { - return String::toUpperCase; - } - @Bean public OpenLibrary openLibrary() { return new OpenLibrary(RestClient.builder()); diff --git a/model-context-protocol/mcp-webflux-server/pom.xml b/model-context-protocol/mcp-webflux-server/pom.xml index 385b7d4..0c5d325 100644 --- a/model-context-protocol/mcp-webflux-server/pom.xml +++ b/model-context-protocol/mcp-webflux-server/pom.xml @@ -19,7 +19,7 @@ Sample Spring Boot application demonstrating MCP server usage - 0.5.0 + 0.5.1 diff --git a/model-context-protocol/mcp-webflux-server/src/main/java/org/springframework/ai/mcp/sample/server/McpServerConfig.java b/model-context-protocol/mcp-webflux-server/src/main/java/org/springframework/ai/mcp/sample/server/McpServerConfig.java index 798cef9..04ecd54 100644 --- a/model-context-protocol/mcp-webflux-server/src/main/java/org/springframework/ai/mcp/sample/server/McpServerConfig.java +++ b/model-context-protocol/mcp-webflux-server/src/main/java/org/springframework/ai/mcp/sample/server/McpServerConfig.java @@ -58,6 +58,9 @@ public class McpServerConfig { return transport.getRouterFunction(); } + public static record ToUpperCaseInput(String input) { + } + @Bean public McpAsyncServer mcpServer(ServerMcpTransport transport, OpenLibrary openLibrary) { // @formatter:off @@ -84,15 +87,16 @@ public class McpServerConfig { .build()), ToolHelper.toToolRegistration( FunctionCallback.builder() - .function("toUpperCase", new Function() { - @Override - public String apply(String s) { - return s.toUpperCase(); - } - }) - .description("To upper case") - .inputType(String.class) - .build())) + .function("toUpperCase", new Function() { + @Override + public String apply(ToUpperCaseInput s) { + return s.input().toUpperCase(); + } + }) + .description("To upper case") + .inputType(ToUpperCaseInput.class) + .build()) + ) .tools(openLibraryToolRegistrations(openLibrary)) .async(); @@ -223,8 +227,8 @@ public class McpServerConfig { } """), arguments -> { String operation = (String) arguments.get("operation"); - double a = (Double) arguments.get("a"); - double b = (Double) arguments.get("b"); + double a = (Integer) arguments.get("a"); + double b = (Integer) arguments.get("b"); double result; switch (operation) { @@ -259,10 +263,6 @@ public class McpServerConfig { return "The status for " + transactionId + ", by " + accountName + " is PENDING"; } - public Function toUpperCase() { - return String::toUpperCase; - } - @Bean public OpenLibrary openLibrary() { return new OpenLibrary(RestClient.builder()); diff --git a/model-context-protocol/mcp-webmvc-server/pom.xml b/model-context-protocol/mcp-webmvc-server/pom.xml index 1494f74..e888bf4 100644 --- a/model-context-protocol/mcp-webmvc-server/pom.xml +++ b/model-context-protocol/mcp-webmvc-server/pom.xml @@ -18,7 +18,7 @@ Sample Spring Boot application demonstrating MCP WebMvc server usage - 0.5.0 + 0.5.1 diff --git a/model-context-protocol/mcp-webmvc-server/src/main/java/org/springframework/ai/mcp/sample/webmvc/server/McpServerConfig.java b/model-context-protocol/mcp-webmvc-server/src/main/java/org/springframework/ai/mcp/sample/webmvc/server/McpServerConfig.java index 573dc31..adc2da5 100644 --- a/model-context-protocol/mcp-webmvc-server/src/main/java/org/springframework/ai/mcp/sample/webmvc/server/McpServerConfig.java +++ b/model-context-protocol/mcp-webmvc-server/src/main/java/org/springframework/ai/mcp/sample/webmvc/server/McpServerConfig.java @@ -59,6 +59,9 @@ public class McpServerConfig implements WebMvcConfigurer { return new StdioServerTransport(); } + public static record ToUpperCaseInput(String input) { + } + @Bean public McpAsyncServer mcpServer(ServerMcpTransport transport, OpenLibrary openLibrary) { // @formatter:off @@ -85,14 +88,14 @@ public class McpServerConfig implements WebMvcConfigurer { .build()), ToolHelper.toToolRegistration( FunctionCallback.builder() - .function("toUpperCase", new Function() { + .function("toUpperCase", new Function() { @Override - public String apply(String s) { - return s.toUpperCase(); + public String apply(ToUpperCaseInput s) { + return s.input().toUpperCase(); } }) .description("To upper case") - .inputType(String.class) + .inputType(ToUpperCaseInput.class) .build())) .tools(openLibraryToolRegistrations(openLibrary)) .async(); @@ -224,8 +227,8 @@ public class McpServerConfig implements WebMvcConfigurer { } """), arguments -> { String operation = (String) arguments.get("operation"); - double a = (Double) arguments.get("a"); - double b = (Double) arguments.get("b"); + double a = (Integer) arguments.get("a"); + double b = (Integer) arguments.get("b"); double result; switch (operation) { @@ -260,10 +263,6 @@ public class McpServerConfig implements WebMvcConfigurer { return "The status for " + transactionId + ", by " + accountName + " is PENDING"; } - public Function toUpperCase() { - return String::toUpperCase; - } - @Bean public OpenLibrary openLibrary() { return new OpenLibrary(RestClient.builder()); diff --git a/model-context-protocol/sqlite/chatbot/pom.xml b/model-context-protocol/sqlite/chatbot/pom.xml index f0f95d4..27104e0 100644 --- a/model-context-protocol/sqlite/chatbot/pom.xml +++ b/model-context-protocol/sqlite/chatbot/pom.xml @@ -43,7 +43,7 @@ org.springframework.experimental spring-ai-mcp - 0.5.0 + 0.5.1 diff --git a/model-context-protocol/sqlite/simple/pom.xml b/model-context-protocol/sqlite/simple/pom.xml index ad41de3..992b79b 100644 --- a/model-context-protocol/sqlite/simple/pom.xml +++ b/model-context-protocol/sqlite/simple/pom.xml @@ -43,7 +43,7 @@ org.springframework.experimental spring-ai-mcp - 0.5.0 + 0.5.1