Skip to content

Conversation

@siddhantbajaj
Copy link
Contributor

@siddhantbajaj siddhantbajaj commented Aug 8, 2025

Brief summary: Return 202 Accepted (no body) for POSTed JSON-RPC notifications over Streamable HTTP, specifically notifications/initialized, to align with the MCP spec. Added a focused handler and unit test.

Motivation and Context

  • The MCP Streamable HTTP spec requires servers to return 202 Accepted with no body for JSON-RPC notifications/responses. Previously, notifications/initialized returned 200.
  • This change brings behavior into compliance and prevents client-side mismatches.
  • Spec reference: Model Context Protocol Transports – Backwards Compatibility.
Screenshot 2025-08-08 at 3 21 13 AM

How Has This Been Tested?

  • Added a unit test in test/mcp/server/transports/streamable_http_transport_test.rb:
  • Verifies POST to notifications/initialized returns HTTP 202 with empty headers and empty body.
  • Existing transport tests cover non-notification flows.

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@koic
Copy link
Member

koic commented Aug 11, 2025

@siddhantbajaj Thanks! Can you squash commits into one?

@siddhantbajaj siddhantbajaj force-pushed the handle-notification-initialized-method branch from 2381508 to 4a65f62 Compare August 11, 2025 14:40
@siddhantbajaj siddhantbajaj requested a review from koic August 11, 2025 14:41
@koic koic merged commit d1c6a46 into modelcontextprotocol:main Aug 12, 2025
5 checks passed
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.

2 participants