Skip to content

fix: forward stdio server stderr through errlog#2915

Open
jordansilly77-stack wants to merge 1 commit into
modelcontextprotocol:mainfrom
jordansilly77-stack:codex/fix-jupyter-stdio-stderr
Open

fix: forward stdio server stderr through errlog#2915
jordansilly77-stack wants to merge 1 commit into
modelcontextprotocol:mainfrom
jordansilly77-stack:codex/fix-jupyter-stdio-stderr

Conversation

@jordansilly77-stack

Copy link
Copy Markdown

Summary

  • pipe stdio server stderr on POSIX instead of handing the current sys.stderr object directly to the subprocess
  • forward stderr chunks through the existing errlog stream
  • close the stderr pipe during shutdown and add a regression test for errlog forwarding

Fixes #156.

Testing

  • python3 -m py_compile src/mcp/client/stdio.py tests/client/test_stdio.py
  • uv run ruff check src/mcp/client/stdio.py tests/client/test_stdio.py
  • uv run ruff format src/mcp/client/stdio.py tests/client/test_stdio.py --check

I could not complete the local pytest run on this Mac because the repository virtualenv hits local plugin/import issues, including macOS blocking black's compiled extension and slow logfire/pydantic plugin imports. The focused code and formatting checks above pass; CI should provide the full pytest signal.

AI disclosure

AI assistance was used to research the issue context, draft the patch, and run local checks. The final changes were reviewed before submission.

@jordansilly77-stack jordansilly77-stack force-pushed the codex/fix-jupyter-stdio-stderr branch 5 times, most recently from 8b9f833 to 8dda36f Compare June 20, 2026 05:25
@jordansilly77-stack jordansilly77-stack force-pushed the codex/fix-jupyter-stdio-stderr branch from 8dda36f to 9f1daba Compare June 20, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support logging to stderr in Jupyter Notebook Environments.

1 participant