Commit adda199
fix: stdio_server emits LF only on Windows stdout
Add newline='' to TextIOWrapper for stdout to prevent \n → \r\n
translation on Windows, which corrupts newline-delimited JSON messages.
The MCP protocol uses \n as the line delimiter. Emitting \r\n is a
protocol-level impurity that breaks clients parsing JSON lines.
stdin is intentionally left with the default newline=None so that
universal-newline behaviour normalises \r\n → \n on read.
Fixes #2433
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 734746a commit adda199
2 files changed
Lines changed: 24 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
0 commit comments