Skip to content

fix: MCP HTTP transport protocol hardening - #299

Merged
jkyberneees merged 2 commits into
mainfrom
fix/mcp-http-protocol
Oct 4, 2026
Merged

jkyberneees merged 2 commits into
mainfrom
fix/mcp-http-protocol

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Sends notifications/initialized after initialize (best-effort) for spec-compliant remote servers. Verifies JSON-RPC response ids on both plain-JSON and SSE paths — notification, out-of-order, or spoofed-error frames now error instead of silently returning empty or attacker-chosen text. SSE parsing is spec-compliant: multi-line data joined per event, CRLF handled, notification and unrelated interleaved frames skipped, matching-id frame selected. Adversarially reviewed; regression tests included.

Send notifications/initialized after initialize (best-effort) so strict spec-compliant remote servers accept tools/list. Verify the JSON-RPC response id matches the request — notification or out-of-order frames now error instead of silently returning an empty result. SSE parsing is now spec-compliant: data: lines of one event are joined with newlines, CRLF handled, notification frames skipped, the matching-id frame selected.
Verify response id before honoring error objects on the plain-JSON path; matchSSEFrame scans past unrelated interleaved responses; dead sseData wrapper removed; tests echo request ids.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
odek 93a3a8b Commit Preview URL

Branch Preview URL
Oct 04 2026, 03:04 PM

@jkyberneees
jkyberneees merged commit efacb5b into main Oct 4, 2026
10 checks passed
@jkyberneees
jkyberneees deleted the fix/mcp-http-protocol branch October 4, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant