#532
fix(mcp): answer JSON-RPC batches for protocol 2025-03-26
Problem
portless mcp accepts protocol version 2025-03-26. That version requires servers to accept JSON-RPC batches. handleLine dropped any JSON array, so a client waiting on those request ids never got a response.
Changes
handleLine treats a JSON array as a batch:
[]returns one-32600Invalid Request object withidnull.- A non-object entry gets that same
-32600object inside the response array. - An object entry goes through
handleRequest. Notifications are omitted. - A notification-only batch returns null, so nothing is written.
- Any other batch returns one JSON array, in request order. A one-request batch stays a one-element array.
Single JSON-RPC objects are unchanged, and initialize still accepts 2025-03-26.
2025-06-18 removed batching. A batch response is written only when the client sent a batch, so clients that send one object per line see the same stdout as before.
Fixes #519
Unit tests cover each batch case, and a stdio test runs the three-line script from #519. pnpm type-check, pnpm lint, and the package test suite passed.
@diptomistry is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.