Skip to content

mcp: do not check metatada on notifications - #1215

Merged
guglielmo-san merged 3 commits into
mainfrom
guglielmoc/fix-meta-notification
Sep 1, 2026
Merged

guglielmo-san merged 3 commits into
mainfrom
guglielmoc/fix-meta-notification

Conversation

@guglielmo-san

@guglielmo-san guglielmo-san commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1212

@guglielmo-san
guglielmo-san enabled auto-merge (squash) September 1, 2026 13:28
@guglielmo-san
guglielmo-san merged commit 2fdabde into main Sep 1, 2026
9 checks passed
@guglielmo-san
guglielmo-san deleted the guglielmoc/fix-meta-notification branch September 1, 2026 13:30
guglielmo-san pushed a commit that referenced this pull request Nov 5, 2026
The 2026-07-28 spec requires Mcp-Method on all requests and leaves
header requirements for notification POSTs undefined. validateMcpHeaders
applied the presence check to notifications too, so a stateless server
answers 400 (-32020) to header-less notifications, which the TypeScript
SDK accepts with 202. Claude Code 2.1.316 to 2.1.318 sends these.

This skips only the presence check for notifications. A header that is
present must still match the body, the same exemption #1215 made for the
_meta check. The existing "missing Mcp-Method header" test case built a
request with no ID, so it was actually exercising a notification; it now
has an ID.

Tests: unit cases for header-less and mismatched notifications in
TestValidateMcpHeaders, and an HTTP-level 202 case in
TestStreamableMcpHeaderValidation. go test ./... passes.

Fixes #1503

Written with AI assistance (Claude Code); I reviewed every line and can
explain the change.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

notifications/cancelled omits the SEP-2575 _meta envelope; the server's rejection permanently fails a 2026-07-28 session

2 participants