fix(mcp): add GET endpoint for SSE stream connections#28224
fix(mcp): add GET endpoint for SSE stream connections#28224octo-patch wants to merge 1 commit inton8n-io:masterfrom
Conversation
Some MCP clients (e.g. Gemini CLI) send GET requests to the MCP endpoint to establish SSE streams for server-initiated messages, per the MCP Streamable HTTP transport specification. Without a registered GET route, these requests returned 404 Not Found. Add GET /mcp-server/http endpoint that delegates to StreamableHTTPServerTransport.handleRequest(), which handles the GET to SSE stream lifecycle internally, matching the MCP spec. Fixes n8n-io#28137
|
octo-patch seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Hey @octo-patch, Thank you for your contribution. We appreciate the time and effort you’ve taken to submit this pull request. Before we can proceed, please ensure the following: Regarding new nodes: If your node integrates with an AI service that you own or represent, please email nodes@n8n.io and we will be happy to discuss the best approach. About review timelines: Thank you again for contributing to n8n. |
Summary
Some MCP clients (e.g. Gemini CLI) use
GET /mcp-server/httpto establish SSE streams for server-initiated messages, per the MCP Streamable HTTP transport specification. Without a registered GET route, these requests returned404 Not Found.This PR adds a
GET /mcp-server/httpendpoint that delegates toStreamableHTTPServerTransport.handleRequest(), following the same stateless pattern used by the existing POST handler (creates a new transport+server per request withsessionIdGenerator: undefinedfor isolation).Observed before fix:
POST /mcp-server/http→ works correctlyGET /mcp-server/http→404 Not Found(breaks Gemini CLI SSE handshake)After fix:
GETandPOSTrequests are handled correctlyRelated Linear tickets, Github issues, and Community forum posts
Fixes #28137
Review / Merge checklist
Backport to Beta,Backport to Stable, orBackport to v1(if the PR is an urgent fix that needs to be backported)