Simple chatbot: unused Server.stdio_context attribute obscures transport ownership
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 86/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- developer-experience
Research direction
Read examples/clients/simple-chatbot/mcp_simple_chatbot/main.py, focusing on Server.__init__, Server.initialize, and Server.cleanup. Remove the two unused self.stdio_context assignments while leaving the existing exit-stack lifecycle unchanged; done when the attribute is no longer referenced and relevant example tests pass.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 24.5k
- Forks
- 4k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 33
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/python-sdk
-
bug v1 v2
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
modelcontextprotocol/python-sdk#3670 · 1 comment ·
Maintainers usually reply within 1 day
-
documentation v2
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
modelcontextprotocol/python-sdk#3662 ·
Maintainers usually reply within 1 day
-
Audio(data=b"") raises "Either path or data can be provided", while Image(data=b"") worksPossibly taken @KaiyiQuan claimed this 2 days ago. Openbug v1 v2
Difficulty 1/5 Under an hour Newbie friendliness 85/100
modelcontextprotocol/python-sdk#3656 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
modelcontextprotocol/python-sdk#3655 ·
Maintainers usually reply within 1 day
-
CORSMiddleware on /register and /token forwards any non-preflight OPTIONS request straight to the body-reading handlerMay be free again A pull request for this issue was closed without being merged. Openbug v1 v2
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/python-sdk#3652 · 3 comments ·
Maintainers usually reply within 1 day
All issues in modelcontextprotocol/python-sdk
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
awslabs/visual-asset-management-system#414 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
aicell-lab/bioengine#232 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
modelscope/evalscope#1836 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100