-
Notifications
You must be signed in to change notification settings - Fork 1.3k
server.servlet.context-path not properly factoring into SSE MCP server path #2512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Same problem |
same problem, how to solve it if have to add server.servelt.context-path ? |
I think there should be an issue of org.springframework.ai.mcp.server.autoconfigure.McpWebMvcServerAutoConfiguration(the same as McpWebFluxServerAutoConfiguration)
|
@HollisChen1 you mention:
But setting:
on spring-ai 1.0.0-M7, I get on |
I will answer myself: those beans are initialized with default configuration (base url and sseEndpoint (the /sse ) ) a small change to add the 2 others parameter should fix the issue Line 75 in 687dea5
Line 80 in 687dea5
|
looking for this issue, I found a related one: #2841 |
Please do a quick search on GitHub issues first, there might be already a duplicate issue for the one you are about to create.
If the bug is trivial, just go ahead and create the issue. Otherwise, please take a few moments and fill in the following sections:
Bug description
When using the MCP Server Starter, one of the supported protocols is SSE. If you are setting a custom context path using the property
server.servlet.context-path
, the relevant paths for MCP will change, but the path given when you look at the/sse
endpoint will not. Therefore MCP clients will break. This was tested with Cursor MCP.Environment
JVM: OpenJDK Runtime Environment Temurin-21.0.5+11 (build 21.0.5+11-LTS)
Spring AI version: "1.0.0-M6" (Used BOM)
Application was written in Kotlin but that shouldn't be relevant here.
Steps to reproduce
server.servlet.context-path
, say to "/v1"If you look at the output of the /sse endpoint, the reason is that the path provided by the endpoint is incorrect. It will match what you set in
spring.ai.mcp.server.sse-message-endpoint
but it will not include the context path.Expected behavior
In my opinion, this would be fixed if the endpoint that is returned in the call to the
/sse
endpoint also prepended the context path.Minimal Complete Reproducible example
Please provide a failing test or a minimal complete verifiable example that reproduces the issue.
Bug reports that are reproducible will take priority in resolution over reports that are not reproducible.
The text was updated successfully, but these errors were encountered: