Skip to content

MCP Streamable HTTP: return 202/no-body for notification-only POSTs#22597

Open
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-netdata-mcp-handshake-issue
Open

MCP Streamable HTTP: return 202/no-body for notification-only POSTs#22597
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-netdata-mcp-handshake-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 1, 2026

Codex Streamable HTTP MCP startup failed after initialize because Netdata returned 200 with an SSE complete event for notifications/initialized. Per MCP Streamable HTTP transport semantics, notification-only POSTs should return 202 Accepted with no body.

  • Handshake semantics fix (SSE adapter)

    • Updated src/web/mcp/adapters/mcp-sse.c (mcp_sse_serialize_response) to detect requests that produce no JSON-RPC responses (responses_used == 0) and return:
      • HTTP 202 Accepted
      • empty body
      • no SSE complete envelope
  • Behavior preserved for response-bearing requests

    • Requests that produce one or more JSON-RPC responses keep existing SSE behavior:
      • HTTP 200 OK
      • text/event-stream
      • message event(s) + trailing complete event
if (!responses_used) {
    buffer_flush(w->response.data);
    mcp_http_disable_compression(w);
    buffer_flush(w->response.header);
    w->response.code = HTTP_RESP_ACCEPTED;
    freez(responses);
    return w->response.code;
}

Copilot AI changed the title [WIP] Fix Netdata MCP v2.10.3 Codex Streamable HTTP handshake failure MCP Streamable HTTP: return 202/no-body for notification-only POSTs Jun 1, 2026
Copilot finished work on behalf of ilyam8 June 1, 2026 08:07
Copilot AI requested a review from ilyam8 June 1, 2026 08:07
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 1, 2026

@ilyam8 ilyam8 marked this pull request as ready for review June 1, 2026 08:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Netdata MCP v2.10.3 fails Codex Streamable HTTP handshake after initialize

2 participants