Description
Context:
I'm trying to integrate an MCP service and a MCP client into the same Spring Boot project with the ultimate goal of adding a chat in the presentation layer of the application that, through the client, can access the tools exposed by the MCP server.
With the MCP server and the MCP client in separate projects everything works fine, but when I try to integrate everything into the same project, the application starts throwing errors just by launching it.
Problem:
I believe the problem is that the client is trying to connect to the service before the Spring Boot application has fully started.
I have tried various approaches without success:
- Using the
spring-ai-client-chat
dependency instead ofspring-ai-starter-mcp-client
- Removing the
spring.ai.mcp.client.sse.connections.server1
entries fromapplication.properties
and then attempting to register them manually in code once the application has started
Environment:
spring boot: 3.5.5
spring ai : 1.0.0
java: 17
Sample
I have shared a full sample at https://github.com/darkman97i/spring-ai-sample
Thanks for your time