While studying context management in the simple chatbot example, I noticed that Server.stdio_context suggests the transport context is stored on the instance, but it is never used.
In examples/clients/simple-chatbot/mcp_simple_chatbot/main.py, searching for stdio_context finds only:
# Server.__init__
self.stdio_context: Any | None = None
# Server.cleanup
self.stdio_context = None
Server.initialize() instead enters stdio_client(server_params) through self.exit_stack.enter_async_context(...), and cleanup() calls self.exit_stack.aclose(). The stack already owns the transport cleanup; the attribute is never read or assigned a context manager.
This is a minor example-code clarity issue, not an observed runtime failure. The unused attribute made it unclear whether initialization was missing an assignment. Suggested fix: remove the two self.stdio_context assignments, leaving the existing exit-stack lifecycle unchanged.
Reporting this first per the contribution guide. AI assistance: this report was prepared with OpenAI Codex after discussing the example and inspecting the source.
While studying context management in the simple chatbot example, I noticed that
Server.stdio_contextsuggests the transport context is stored on the instance, but it is never used.In
examples/clients/simple-chatbot/mcp_simple_chatbot/main.py, searching forstdio_contextfinds only:Server.initialize()instead entersstdio_client(server_params)throughself.exit_stack.enter_async_context(...), andcleanup()callsself.exit_stack.aclose(). The stack already owns the transport cleanup; the attribute is never read or assigned a context manager.This is a minor example-code clarity issue, not an observed runtime failure. The unused attribute made it unclear whether initialization was missing an assignment. Suggested fix: remove the two
self.stdio_contextassignments, leaving the existing exit-stack lifecycle unchanged.Reporting this first per the contribution guide. AI assistance: this report was prepared with OpenAI Codex after discussing the example and inspecting the source.