Skip to content

Commit 3e321f6

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

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
@@ -1863,6 +1863,20 @@ group (spawned with `start_new_session=True`); the `getpgid()` lookup and the
18631863
per-process terminate/kill fallback are gone. The win32 utilities logger is now
18641864
named `mcp.os.win32.utilities` (was `client.stdio.win32`).
18651865

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

18681882
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)