fix(server): return stdio parse errors#2766
Conversation
f6b844e to
c0ce601
Compare
|
Updated the coverage for the parse-error path after the first CI run showed the full test suite passing but coverage dropping below 100%. Local checks on the updated branch:
I also attempted the full coverage command locally on Windows/Python 3.13, but it fails in existing integration transport tests before coverage reporting ( |
c0ce601 to
f76a0b3
Compare
|
Follow-up pushed in f76a0b3 after the remote coverage failure on stdio.py line 51. I added the missing malformed-JSON numeric-id regression case so the fallback Local validation:
|
f76a0b3 to
b63f5f8
Compare
|
Follow-up pushed in b63f5f8 after the Python 3.14 lowest-direct job exposed an unrelated stderr exact-match fragility in the stdio interaction test. The test still verifies that the subprocess clean-exit marker is passed through stderr, but now checks the marker as a suffix so dependency warnings emitted by the child interpreter do not fail the test before the server's own line. Local validation:
|
StantonMatt
left a comment
There was a problem hiding this comment.
Checked head b63f5f8 with the stdio paths this changes.
Local validation passed:
uv run --frozen pytest tests/server/test_stdio.py tests/interaction/transports/test_stdio.py -q-> 7 passeduv run --frozen ruff check src/mcp/server/stdio.py tests/server/test_stdio.py tests/interaction/transports/test_stdio.pyuv run --frozen pyright src/mcp/server/stdio.py tests/server/test_stdio.py tests/interaction/transports/test_stdio.py
I also ran a small stdin/stdout probe with a malformed id-bearing line followed by a valid ping: the malformed line produced a JSON-RPC parse error with id "bad-1", and the later valid request still arrived on the read stream. That covers the main regression boundary from #2751 for me.
Summary
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