Please follow the steps to reproduce the issue, because the project couldn’t be attached with the post:
- create a security project and download it (vaadin version latest: 24.9.0, my version: 24.8.4).
- add a MCP server WeatherService:
package com.example.application.mcp;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.stereotype.Service;
@Service
public class WeatherService {
@Tool(name = "getWeather", description = "Get weather information by city name")
public String getWeather(String cityName) {
// Implementation
return "Weather information for " + cityName;
}
@Tool(name = "getPMI", description = "Get PMI information by city name")
public String getPMIr(String cityName) {
// Implementation
return "PMI information for " + cityName;
}
}
- modify Application.java:
@SpringBootApplication
@Theme(value = "my-app")
public class Application implements AppShellConfigurator {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public ToolCallbackProvider weatherTools(WeatherService weatherService) {
return MethodToolCallbackProvider.builder().toolObjects(weatherService).build();
}
}
- add mcp dependency in pom.xlm:
<dependency>
<groupId>org.springframework.ai</groupId>
<artifactId>spring-ai-starter-mcp-server-webflux</artifactId>
<version>1.0.0-M7</version>
</dependency>
- run the project. Log info ‘Registered tools: 2, notification: true’ is printed out in console.
- access http://localhost:8080/sse, the issue could be reproduced.
- If no issue, it will return message like:
event:endpoint data:/mcp/message?sessionId=ef575c6c-6cf6-45ba-b076-38d26c5b7d57
Actually I would like to integrate the vaadin project with a MCP server. If you leave your email, I could send the project to you.
Thanks for your patient and your help.