Skip to content

Fix stdio server newline translation on Windows - #2757

Closed
yyzquwu wants to merge 1 commit into
modelcontextprotocol:mainfrom
yyzquwu:codex/windows-stdio-lf
Closed

yyzquwu wants to merge 1 commit into
modelcontextprotocol:mainfrom
yyzquwu:codex/windows-stdio-lf

Conversation

@yyzquwu

@yyzquwu yyzquwu commented Jun 1, 2026 •

Copy link
Copy Markdown

Summary

  • Disable Windows CRLF translation in stdio_server() by setting newline="" on the default stdio wrappers.
  • Add a regression test for the default stdout path so JSON-RPC frames stay LF-only.

Fixes #2433.

Verification

Windows 11, Python 3.13.13:

tests/server/test_stdio.py::test_stdio_server PASSED
tests/server/test_stdio.py::test_stdio_server_uses_lf_newlines_with_default_stdout PASSED
tests/server/test_stdio.py::test_stdio_server_invalid_utf8 PASSED
3 passed

b'{"jsonrpc":"2.0","id":3,"method":"ping"}\n'

Branch coverage for tests/server/test_stdio.py: 100.00%.

Codex review passed before commit.

@yyzquwu
yyzquwu force-pushed the codex/windows-stdio-lf branch from b8992b8 to 86176c5 Compare June 1, 2026 21:32
@Kludex

Kludex commented Jun 25, 2026

Copy link
Copy Markdown
Member

You've opened a duplicated pull request, please search opened PRs before creating new ones. Duplicated from #2552.

@Kludex Kludex closed this Jun 25, 2026
@modelcontextprotocol modelcontextprotocol locked as resolved and limited conversation to collaborators Jun 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows: TextIOWrapper in stdio_server() emits CRLF instead of LF, corrupting newline-delimited JSON messages

2 participants