Uh oh!
There was an error while loading. Please reload this page.
feat: support logging to stderr in Jupyter Notebook environments (#156) - #1707
feat: support logging to stderr in Jupyter Notebook environments (#156)#1707dgenio wants to merge 3 commits into
Conversation
- Add _is_jupyter_notebook() to detect Jupyter/IPython environments - Add _print_stderr() to format stderr with HTML in Jupyter (red color) - Add async _stderr_reader() to capture and display stderr - Pipe stderr (subprocess.PIPE) instead of redirecting to file - Update Windows process creation to support piped stderr - Extract stdout/stdin/stderr readers as module-level functions This enables server stderr output to be visible in Jupyter notebooks, addressing issue modelcontextprotocol#156. Fixesmodelcontextprotocol#156
2239072 to
66c2ca9Compare- Test Jupyter environment detection (with/without IPython) - Test stderr printing in Jupyter and non-Jupyter environments - Test IPython display fallback when display fails - Test stderr capture and piping - Test stderr reader exception handling - Test empty line filtering and final buffer handling - Test process without stderr stream Achieves 100% code coverage for the new functionality.
66c2ca9 to
4e6bda4Comparedgenio
commented
Feb 28, 2026
Hi — I'm the author of this PR. After reviewing the current state of
Rather than trying to rebase this, I plan to close this PR and open a fresh one with a simpler, more focused approach — just piping stderr to an async reader and forwarding lines to I'll wait for maintainer feedback on issue #156 before proceeding. Happy to close this PR now if preferred. |
maxisbey
commented
Mar 24, 2026
Thanks for your PR! Closing this in favour of #2020 as it targets the current stdio module structure with passing CI, whereas this PR is stale against the restructured codebase (as you noted). |
Summary
Fixes#156 - Adds support for displaying stderr output in Jupyter Notebook environments.
Changes
IPython.get_ipython()FallbackProcessto wrap stderr in async-compatible streamsDesign Decisions
errlogparameter is kept but behavior adapts based on environmentTesting
Behavior
errlogstream (defaults tosys.stderr)This enables proper debugging of MCP servers in Jupyter notebook environments, addressing the issue where server crashes or command errors were invisible.