Skip to content

Startup error when mcp server and mcp client are in the same spring boot project #3815

Open
@darkman97i

Description

@darkman97i

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 of spring-ai-starter-mcp-client
  • Removing the spring.ai.mcp.client.sse.connections.server1 entries from application.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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions