You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9a002cb
Browse filesBrowse the repository at this point in the historyBrowse files
Relay stdio stderr into errlog when it is not a real file
Jupyter's stderr reports a descriptor that points at the launch terminal, and
streams such as io.StringIO have none, so handing errlog to the child either
hid startup crashes or failed the spawn. Inherit a real file; otherwise pipe
stderr and copy it into errlog.write(), including the lines written while the
server exits.
Co-authored-by: Evan Liu <evanliuuu@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/client/transports.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,7 +114,7 @@ Describe the process with `StdioServerParameters` and hand it to `Client`:
114
114
115
115
Entering the block spawns the process. Leaving it shuts the subprocess down: close stdin, wait, kill if it lingers. You never clean it up yourself.
116
116
117
-
The child's stderr goes to yours. To send it somewhere else, build the transport yourself with `stdio_client` (from `mcp`) and pass that instead: `Client(stdio_client(server, errlog=log_file))`.
117
+
The child's stderr goes to yours; in a Jupyter notebook, that is the cell's output. To send it somewhere else, build the transport yourself with `stdio_client` (from `mcp`) and pass that instead: `Client(stdio_client(server, errlog=log_file))`. A file is handed to the child as its stderr. Any other text stream, such as an `io.StringIO`, gets the child's output through its `write()` while the client is connected.
118
118
119
119
!!! warning
120
120
The child does **not** inherit your environment. It gets a minimal allow-list (`HOME`, `LOGNAME`,
0 commit comments