Skip to content

Conversation

@linacs
Copy link

@linacs linacs commented Aug 22, 2025

This PR fixes an issue where the MCP client would fail to parse large or fragmented JSON responses from the server. Previously, the code assumed that each chunk received from stdout contained a complete JSON message, which is not guaranteed by Node.js streams. As a result, long responses could be split and cause parsing errors or incomplete logs.

Changes:

Added a buffer to accumulate data from stdout until a full message (ending with \n) is received.
Only complete messages are parsed and processed, preventing errors with large or split responses.
Why:
This change ensures robust handling of server responses, especially when dealing with large payloads, and prevents log truncation or JSON parsing errors.

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.

1 participant