Skip to content

fix: exit cleanly when started without a stdio client - #67

Open
mjdavidson wants to merge 1 commit into
okta:mainfrom
mjdavidson:fix/stdio-startup-crash
Open

fix: exit cleanly when started without a stdio client#67
mjdavidson wants to merge 1 commit into
okta:mainfrom
mjdavidson:fix/stdio-startup-crash

Conversation

@mjdavidson

Copy link
Copy Markdown

The console entrypoint wrapped the synchronous server.main() in asyncio.run(). server.main() ends in the blocking mcp.run() and returns None, so asyncio.run(None) raised ValueError: a coroutine was expected, got None whenever the server was launched without a stdio client attached. Calls the already-synchronous main() directly.

Tests: tests/test_entrypoint.py.

The console entrypoint wrapped server.main() in asyncio.run(). server.main()
is synchronous and ends in the blocking mcp.run(), which returns None, so
asyncio.run(None) raised 'ValueError: a coroutine was expected, got None'.
A live stdio client masks this because mcp.run() blocks for the session, but
launching without a client (stdin at EOF) makes mcp.run() return immediately
and the entrypoint crashes.

Call the already-synchronous server.main() directly and drop the unused
asyncio import.
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.

1 participant