Skip to content

fix(server): improve JSON-RPC HTTP compatibility for strict clients#12

Merged
CalvinAllen merged 1 commit into
mainfrom
fix/server/jsonrpc-strict-client-compat
Jul 8, 2026
Merged

fix(server): improve JSON-RPC HTTP compatibility for strict clients#12
CalvinAllen merged 1 commit into
mainfrom
fix/server/jsonrpc-strict-client-compat

Conversation

@CalvinAllen

Copy link
Copy Markdown
Contributor

Summary

Fixes JSON-RPC over HTTP compatibility issues that prevented strict MCP clients (e.g. JetBrains Rider) from working with the server.

Closes #11

Changes

  • Notifications — requests without an id are JSON-RPC notifications and must not receive a response body. The server now replies with 202 Accepted and an empty body instead of a spurious response/error object.
  • Error id preservation — error responses now always echo the request id (including 0), consistent with success responses.
  • GET /mcp — added so clients that probe transport capabilities before issuing a POST get a 200 with service metadata rather than a 404.

The POST handler was also refactored into a single switch that computes the result once and then chooses between a 202 ack (notifications) and a JSON-RPC response (requests), removing the duplicated response-shape logic.

Testing

  • Added src/server/mcpServer.test.ts covering GET /mcp, GET /health, id echoing on initialize/tools/list/tools/call, id preservation on error paths, and 202/empty-body behavior for notifications.
  • npm run build
  • npm run test ✅ (212 tests pass)

Handle JSON-RPC notifications (requests without an id) by responding
with 202 and an empty body instead of a spurious response object,
preserve the request id in error responses (including id 0), and add a
GET /mcp endpoint so clients that probe transport capabilities before
POSTing (e.g. JetBrains Rider) get a 200 with service metadata.
@CalvinAllen CalvinAllen merged commit f9da578 into main Jul 8, 2026
2 checks passed
@CalvinAllen CalvinAllen deleted the fix/server/jsonrpc-strict-client-compat branch July 8, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

MCP HTTP JSON-RPC compatibility issue with strict clients (Rider)

1 participant