Define an URL into the whitelist

Please follow the steps to reproduce the issue, because the project couldn’t be attached with the post:

  1. create a security project and download it (vaadin version latest: 24.9.0, my version: 24.8.4).
  2. 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;
    }
}
  1. 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();
    }
}
  1. 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>
  1. run the project. Log info ‘Registered tools: 2, notification: true’ is printed out in console.
  2. access http://localhost:8080/sse, the issue could be reproduced.
  3. 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.