fix(server): return stdio parse errors
Closed
HE
1mo ago+34962+34962+01234567890123456789012345678901234567890123456789-15-15-01234567890123456789
Summary
- make the stdio server return JSON-RPC error frames when incoming lines fail JSON-RPC parsing/validation
- recover a simple request id from the raw line when possible so id-bearing malformed requests do not stay pending
- keep later valid stdio messages flowing after an invalid line
Fixes #2751.
To verify
uv run pytest tests/server/test_stdio.py -quv run ruff check src/mcp/server/stdio.py tests/server/test_stdio.pyuv run pyright src/mcp/server/stdio.py tests/server/test_stdio.pygit diff --check