Skip to content

Commit 7374202

Browse files
committed
Add migration note for code that watches fd 0 directly
No-Verification-Needed: docs-only change
1 parent 664b540 commit 7374202

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

docs/migration.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1855,6 +1855,20 @@ group (spawned with `start_new_session=True`); the `getpgid()` lookup and the
18551855
per-process terminate/kill fallback are gone. The win32 utilities logger is now
18561856
named `mcp.os.win32.utilities` (was `client.stdio.win32`).
18571857

1858+
### `stdio_server` keeps the protocol streams on private descriptors
1859+
1860+
While serving, the stdio transport moves the wire to private descriptors and points
1861+
fd 0 at the null device and fd 1 at stderr, restoring both on exit. Subprocesses and
1862+
handler code can no longer read protocol bytes or write into the stream (the
1863+
[#671](https://github.com/modelcontextprotocol/python-sdk/issues/671) fix). Ordinary
1864+
servers have nothing to do, and code that inspects or manipulates fd 0/1 directly
1865+
during a session now sees the diversions, not the wire.
1866+
1867+
One pattern needs migrating: a watchdog thread that `poll()`s fd 0 for `POLLHUP` to
1868+
detect a vanished client will no longer fire, because the null device never reports
1869+
it. Watch the parent process instead (for example, exit when `os.getppid()`
1870+
changes); that works on both v1 and v2 and does not depend on descriptor layout.
1871+
18581872
### WebSocket transport removed
18591873

18601874
The WebSocket transport has been removed: `mcp.client.websocket.websocket_client`, `mcp.server.websocket.websocket_server`, and the `ws` optional dependency extra (`mcp[ws]`) no longer exist. WebSocket was never part of the MCP specification. Use the streamable HTTP transport instead (`mcp.client.streamable_http.streamable_http_client` on the client, `streamable_http_app()` on the server), which supports bidirectional communication with server-to-client streaming over standard HTTP.

0 commit comments

Comments
 (0)