Description
Is your enhancement request related to a problem? Please describe
The built-in MCP server currently only supports the legacy HTTP+SSE transport (two endpoints: GET /mcp/sse and POST /mcp/message), implemented via server.NewSSEServer in internal/router/mcp_router.go.
The MCP specification has deprecated the HTTP+SSE transport in favor of Streamable HTTP (single endpoint, POST for requests with optional SSE streaming, GET for server-initiated streams, session management via Mcp-Session-Id header). Newer MCP clients increasingly ship with Streamable HTTP as the default and some no longer support HTTP+SSE, which means those clients cannot connect to Apache Answer's MCP server at all.
Describe the solution you'd like
Add a Streamable HTTP endpoint alongside (or replacing) the SSE one, using mcp-go's built-in support (server.NewStreamableHTTPServer, already available in the pinned mcp-go v0.43.2):
streamableServer := server.NewStreamableHTTPServer(s)
r.Any("/mcp", gin.WrapH(streamableServer))Key considerations:
- Keep the existing SSE endpoints for backward compatibility with older clients during a transition period.
- Streamable HTTP is stateless-friendly and fits better with the existing
AuthAPIKeymiddleware, since the API key is sent as a header on every request just like with SSE today. - Optionally disable the GET server-initiated stream if it complicates the gin middleware chain (
server.WithDisableGETAndSSEOnlyPost()or similar options).
Describe alternatives you've considered
- Keeping SSE only: blocks modern clients and accumulates deprecation debt in the protocol.
- Implementing a custom transport: unnecessary, since mcp-go already provides a complete Streamable HTTP implementation.
Activity
shaktimaan00 commentedon Nov 21, 2026
Opened #1684 for this: the MCP server now also answers Streamable HTTP, next to the legacy SSE endpoints.
internal/router/mcp_router.go— after the existing SSE block,server.NewStreamableHTTPServer(s)mounted withr.Any("/mcp", gin.WrapH(streamableServer)). It reuses the same*server.MCPServer, so both transports expose one tool list, and it is registered on themcpAPIGroupthat already carriesAuthMcpEnable()andAuthAPIKey()— the API key comes in as a header on every request, exactly as with SSE. The SSE routes are untouched.internal/router/mcp_streamable_test.go— aninitialize+notifications/initialized+tools/listround-trip onPOST /answer/api/v1/mcp: 200, anMcp-Session-Idheader, and the six tools; plus a check thatPOST /mcp/messagestill answers with its ownMissing sessionIderror andGET /mcp/sseis still registered. The test file is separate frommcp_router_test.go(feat(mcp): expose semantic_search tool on the MCP server #1681) so the two PRs do not create the same file.No options: the
GETserver-initiated stream is left on (mcp-go's default) since nothing here sends server-initiated messages and the middleware treatsGETas a read-scope key already.server.WithDisableStreaming(true)is a one-line change if you would rather have it off.Gates in a
golang:1.25-bookwormcontainer onmain@ 9e6ca4a:gofmt -lclean,go vet,go build ./...,go test ./...(25 packages ok),golangci-lint run(0 issues). The new test returns404forinitializewithout the production change.make lintitself needs Docker inside the runner for the ASF-header script, so the new file's header was diffed againstmcp_router.goinstead.Note for ordering: #1681 and #1683 touch the same function, so the second one of the three to merge needs a rebase — the hunks do not overlap.
Happy to adjust anything; a review when you have a minute would be much appreciated.