fix(mcp): return HTTP 202 for JSON-RPC notifications — strict-client compatibility
Problem
The /mcp Streamable HTTP endpoint was returning -32601 Method not found in response to JSON-RPC notifications (messages without an id field), specifically notifications/initialized. This violated two specs:
- JSON-RPC 2.0 §4.1: servers MUST NOT reply to notifications
- MCP Streamable HTTP spec: notifications must receive
HTTP 202 Acceptedwith an empty body
Claude Code and other tolerant clients silently ignored the invalid response. Strict clients — notably Codex, which uses the rmcp Rust library — treated it as a handshake failure and refused to connect to the MCP server entirely.
Fix (PR #733)
Short-circuit to Response(status_code=202) at the top of mcp_endpoint in src/mcp_memory_service/web/api/mcp.py whenever request.id is None. Added regression tests covering the 202/empty-body path and the initialize happy path.
Impact
- Codex and any other MCP client that enforces JSON-RPC 2.0 notification semantics now complete the MCP handshake correctly
- No behavior change for Claude Code, Claude Desktop, or other tolerant clients
Files changed
src/mcp_memory_service/web/api/mcp.py— notification short-circuittests/web/api/test_jsonrpc_endpoint.py— regression tests (new file)