Bug description
We are trying to implement the MCP Server using the spring-ai-starter-mcp-server-webmvc dependency in a Spring Boot application that includes both spring-boot-starter-web and spring-boot-starter-webflux. Our goal is to register tools via @Tool annotations and expose MCP endpoints (e.g., /mcp, /sse) as configured in application.yml.
However, during runtime:
-
There are no logs indicating that tools were registered or capabilities enabled by the MCP server.
-
When we attempt to hit the
/mcpor/sseendpoints via Postman or curl, the application returns:No static resource found for /mcpor a
404 Not Found.
It appears the MCP server is not fully initializing or exposing the defined endpoints under this setup.
Environment
| Component | Value |
|---|---|
| Spring Boot | 3.2.x |
| Spring AI | 1.0.0 |
| MCP Starter | spring-ai-starter-mcp-server-webmvc |
| Java | 17 |
| Web dependencies | Both spring-boot-starter-web and spring-boot-starter-webflux are on classpath |
| Lazy Init | spring.main.lazy-initialization=true |
| Model | echo |
| Mode | SYNC |
Steps to reproduce
-
Create a Spring Boot app with both
starter-webandstarter-webflux -
Add
spring-ai-starter-mcp-server-webmvcas a dependency -
Add a
@Tool-annotated class and register it via aToolCallbackProviderbean -
Enable MCP server in
application.ymlwith endpoints/mcpand/sse -
Run the app
-
Observe:
-
No tool registration logs
-
No endpoint registration confirmation
-
-
Try calling
/mcpor/ssevia Postman or curl → receive 404
Expected behavior
-
MCP Server logs should indicate that tools were registered and capabilities enabled (e.g., “Registered tools: X”)
-
Endpoints
/mcpand/sse(or/completionsfor SYNC mode) should be exposed and respond correctly -
/completionsshould accept standard payloads and return tool responses
Minimal Complete Reproducible example
@Component
@Lazy(false)
public class SampleTool {
@Tool(name = "sayHello", description = "Greets user")
public String sayHello(String name) {
return "Hello, " + name;
}
}
@Bean
@Lazy(false)
public ToolCallbackProvider toolCallbackProvider(SampleTool tool) {
return MethodToolCallbackProvider.builder()
.toolObjects(tool)
.build();
}
spring:
main:
lazy-initialization: true
ai:
mcp:
server:
enabled: true
type: SYNC
model: echo
sse-endpoint: /sse
sse-message-endpoint: /mcp
curl -X POST http://localhost:8080/completions \
-H "Content-Type: application/json" \
-d '{ "prompt": "call tool sayHello with name MCP" }'
Expected: "Hello MCP"
Actual: 404 Not Found / "No static resource found for /completions"
Comment From: vaibhav-v-verma
Hi @wilocu , What is the timeline for this fix to be available publicly ? Also, how can we use this server when both spring-boot-starter-web and spring-boot-starter-webflux dependency ? Does spring-ai support this ? if not then what are the timelines ?