-
Notifications
You must be signed in to change notification settings - Fork 168
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
Support for separate registration and published endpoint paths in WebMvcSseServerTransportProvider #79
Comments
I second this one! I was trying to host using Grizzly on /ai/sse and /ai/mcp/message endpoints and it wouldn't work because of this. I have it working on root /sse and /mcp/message but that's not ideal. I'd guess I'd only ask if it's worth the endpoint checks in the doGet and doPost handlers? Grizzle gives me control over the routing so why check it again here? Maybe what it's doing now is the best convention but worth asking. // Example |
@minguncle, this should affect the How do you resolve this? By setting the Also, I believe this is the same issue but for WebFlux: #102 I kind of like the |
@aronsemle I guess you're experiencing this issue but using the core |
…erver transport Enhance HttpServletSseServerTransportProvider to support deployment under non-root context paths by: - Adding baseUrl field and DEFAULT_BASE_URL constant - Creating new constructor that accepts a baseUrl parameter - Extending Builder with baseUrl configuration method - Prepending baseUrl to message endpoint in SSE events - Add HttpServletSseServerCustomContextPathTests to verify custom context path functionality - Extract common Tomcat server setup code to TomcatTestUtil for test reuse Related to #79 Signed-off-by: Christian Tzolov <[email protected]>
@tzolov yes! That would be great if it was also applied to the HttpServletSseServerTransportProvider. |
Please do a quick search on GitHub issues first, the feature you are about to request might have already been requested.
Expected Behavior
WebMvcSseServerTransportProvider should support separate configuration for registration paths and published paths. This would allow proper operation in environments with context paths or global URL prefixes. Example usage:
// Registration path: /message (for server routing)
// Published path: /api/v1/message (what clients see/use)
var transportProvider = new WebMvcSseServerTransportProvider(
objectMapper,
"/message", // Server registration path
"/api/v1/message", // Path sent to clients
"/sse"
);
With this enhancement, the server would register handlers at the bare paths, but communicate the full paths to clients through the SSE connection.
Current Behavior
When using WebMvcSseServerTransportProvider in environments with servlet context paths or other global URL prefixes (like Spring Boot's spring.mvc.servlet.path), there's a mismatch between:
Currently, WebMvcSseServerTransportProvider uses the same path for both registration and client communication, which doesn't work correctly in environments with context paths.
Context
I'm deploying an MCP server in a Spring Boot application with a servlet context path configured via spring.mvc.servlet.path. When registering message endpoints with Spring's RouterFunction, I need to use paths without the context prefix, but when communicating these endpoints to clients, I need to include the full path with context prefix. I've considered workarounds like:
A simple solution would be to enhance WebMvcSseServerTransportProvider to support separate configuration for registration and published paths, which would resolve this issue cleanly.
The text was updated successfully, but these errors were encountered: