JSON-RPC · troubleshooting record
JSON-RPC -32700 Parse error
-32700The receiver could not parse the JSON-RPC message. At the MCP layer this usually indicates malformed JSON, non-protocol text mixed into a stdio stream, or a proxy that changes the request body.
Symptoms
- JSON-RPC error code -32700 in client logs.
- The server disconnects immediately after receiving a malformed frame.
- A hand-written request works differently from the client's request.
Confirmed causes
These causes have a documented basis. They may not be the cause of your specific failure.
The body is not valid JSON
The MCP specification uses JSON-RPC 2.0 and defines -32700 for invalid JSON.
Non-protocol output is written to the stdio stream
A stray log line or banner on stdout breaks JSON framing.
A proxy or gateway rewrites the body
Body transforms can invalidate JSON or alter required fields.
Possible causes
- The client sends a batched or otherwise unsupported payload.
- A truncation bug in a custom transport.
- An encoding mismatch (for example, binary data in a text stream).
What still needs verification
- A captured request body at the server boundary.
- Whether stdout contains non-JSON lines.
- Whether any proxy modifies Content-Encoding or body bytes.
Affected environments
Fixes
Validate the message boundary
- Capture the raw request or stdout frame and parse it with a JSON validator.
- Remove all logging from stdout for stdio servers; use stderr.
- Ensure the proxy preserves the JSON body byte-for-byte.
Use a conforming client or SDK
- Test the same call with the official MCP SDK or a known-good client.
- Compare the generated payload with the failing one.
- Reject malformed input at your own server with -32700 rather than crashing.
Verify the fix
- The raw request body parses as JSON.
- The server returns a valid JSON-RPC response rather than closing the stream.
- The client can retry the call and receive a normal result.
Paste the configuration into the Config Doctor. It runs in your browser, never uploads the file, and can show structural issues and safe fixes.
Why we believe this
- modelcontextprotocol.io/specification/2026-07-28/basic/index#error-codesOfficial documentation · checked Oct 23, 2026 · documented
The specification defines JSON-RPC error codes and MCP-specific error codes for the 2026-07-28 protocol version.