-
Notifications
You must be signed in to change notification settings - Fork 732
Closed
Description
Description:
I’m integrating mcp-go’s SSEServer into my project and need to combine it with other HTTP endpoints (e.g., Kubernetes health checks) in a single server. For clarity, I want to mount the SSEServer under a custom prefix (e.g., /mcp) while leaving my health endpoints at the root (like /live and /ready).
The SSEServer’s ServeHTTP method is designed to handle requests exactly at /sse and /message. When I attempt to register it using http.HandleFunc with a prefix I still encounter 404 errors when accessing /mcp/sse or /mcp/message.
Steps to Reproduce:
- Initialize an instance of the SSEServer via the mcp-go API.
- Register the handler using a code snippet similar to:
http.HandleFunc("/ready", readinessHandler)
// assuming s is an already existing MCPServer
sse := server.NewSSEServer(s, "")
http.HandleFunc("/mcp/", sse.ServerHTTP)
log.Fatal(http.listAndServe(":80", nil))
- Access
/mcp/sse
,/mcp/message
or/sse
,/message
and observe a 404 response.
Expected Behavior:
- A request at least to
/sse
should be correctly handled.
Environment:
- Go version: 1.23.5 (using an Alpine-based Docker image)
- mcp-go version: v0.11.2
Additional Context:
- I have verified that endpoints like /live and /ready work as expected.
- The issue appears to be specific to the prefix handling for SSEServer’s endpoints.
- I’m open to suggestions on the correct approach for mounting the SSEServer under a custom path or if this might be a limitation/bug.
Any guidance or recommended changes would be greatly appreciated. Thank you!
Metadata
Metadata
Assignees
Labels
No labels