Skip to content

fix(mcp): support stdio transport on Windows - #7596

Merged
deeleeramone merged 1 commit into
OpenBB-finance:developfrom
Sanjays2402:hotfix/mcp-stdio-windows
Jul 20, 2026
Merged

fix(mcp): support stdio transport on Windows#7596
deeleeramone merged 1 commit into
OpenBB-finance:developfrom
Sanjays2402:hotfix/mcp-stdio-windows

Conversation

@Sanjays2402

Copy link
Copy Markdown
Contributor

Description

How has this been tested?

  • python -m pytest tests -q — 174 passed, 4 skipped.
  • Regression test simulates an event loop without signal-handler support and verifies the stdio server still starts.
  • ruff check passes on both changed files.

Checklist

  • I have performed a self-review of my own code.
  • I have commented the Windows-specific behavior.
  • I have adhered to the GitFlow naming convention (hotfix/mcp-stdio-windows).
  • I am following the contributing guidelines.
  • Tests cover the bug fix.

Windows asyncio event loops do not implement add_signal_handler, causing the stdio server to exit before serving requests. Treat signal registration as optional and cover the unsupported-loop path with a regression test.
@CLAassistant

CLAassistant commented Jul 18, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@DogInfantry

Copy link
Copy Markdown

Tested this on Windows 11 (build 26200). Confirmed the root cause: on a ProactorEventLoop, loop.add_signal_handler(signal.SIGINT, ...) raises NotImplementedError with an empty str(), so stdio dies before the handshake. With this branch's try/except NotImplementedError the server proceeds and serves over stdio. The full mcp_server test suite passes here (176 passed, 2 skipped), including the new test_stdio_main_runs_when_signal_handlers_are_unsupported. LGTM on the crash fix.

One note: this covers the crash, but not the second problem #7595 raises. main()'s handler logs logger.error("Server error: %s", e), and since str(NotImplementedError()) is empty the user sees a blank Server error: with no type and no traceback. I opened a small complementary PR (#7600) that switches it to logger.exception and includes the exception type, so future fatal errors are diagnosable. Happy to fold it into this PR instead if you would prefer a single change.

@deeleeramone deeleeramone added bug Bugs and bug fixes platform OpenBB Platform extensions Extension-related v4 PRs for v4 labels Jul 20, 2026

@deeleeramone deeleeramone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@deeleeramone
deeleeramone added this pull request to the merge queue Jul 20, 2026
Merged via the queue into OpenBB-finance:develop with commit 3e071fc Jul 20, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Bugs and bug fixes extensions Extension-related platform OpenBB Platform v4 PRs for v4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MCP server stdio transport crashes silently on Windows (add_signal_handler raises NotImplementedError)

4 participants