Skip to content

fix: reply -32700 on stdio parse errors instead of closing#833

Open
DaleSeo wants to merge 1 commit intomainfrom
fix/issue-825-stdio-parse-error
Open

fix: reply -32700 on stdio parse errors instead of closing#833
DaleSeo wants to merge 1 commit intomainfrom
fix/issue-825-stdio-parse-error

Conversation

@DaleSeo
Copy link
Copy Markdown
Member

@DaleSeo DaleSeo commented May 5, 2026

Fixes #825

Motivation and Context

The RMCP stdio transport used to close the stream silently when it encountered a malformed line. This made it hard for clients to tell the difference between a parse failure and a normal end-of-file initiated by the peer. Just one bad byte could bring down the entire session.

Now, the stdio transport responds with a JSON-RPC -32700 Parse error when it receives a malformed line, instead of closing the stream silently. It also removes a leading UTF-8 BOM, so messages from Windows tools that have a BOM prefix can be parsed correctly.

How Has This Been Tested?

Added new tests

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@DaleSeo DaleSeo self-assigned this May 5, 2026
@github-actions github-actions Bot added T-core Core library changes T-transport Transport layer changes labels May 5, 2026
@DaleSeo DaleSeo force-pushed the fix/issue-825-stdio-parse-error branch from 0d39c02 to 69b254b Compare May 5, 2026 14:55
@DaleSeo DaleSeo force-pushed the fix/issue-825-stdio-parse-error branch from 69b254b to 93873ad Compare May 5, 2026 15:06
@DaleSeo DaleSeo marked this pull request as ready for review May 5, 2026 15:10
@DaleSeo DaleSeo requested a review from a team as a code owner May 5, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stdio transport: parse errors close stream instead of returning -32700 Parse Error

1 participant