Examples: add MCP simple chatbot with SSE#529
Examples: add MCP simple chatbot with SSE#529Amaindex wants to merge 2 commits intomodelcontextprotocol:mainfrom
Conversation
Add a new example in examples/clients/simple-chatbot/mcp_simple_chatbot_sse, showing a chatbot using MCP with Server-Sent Events. Includes: - main.py: Handles server connection, tools, and LLM integration. - .env.example: Template for LLM_API_KEY configuration. - requirements.txt: Lists dependencies (python-dotenv, requests, mcp, uvicorn). - servers_config.json: Configures MCP server connections.
There was a problem hiding this comment.
Thank you for your contribution and interest in improving the MCP Python SDK examples. While your code quality is good, we're going to close this PR because it introduces unnecessary complexity through code duplication.
The existing chatbot example in examples/clients/simple-chatbot/mcp_simple_chatbot/ already demonstrates the core MCP chatbot functionality. The transport mechanism (SSE vs stdio) is a relatively minor implementation detail that doesn't warrant an entirely new example with 400+ lines of largely duplicated code.
Instead, we'd prefer to keep our examples focused and maintain a single chatbot example that can be easily modified to use different transport mechanisms. This reduces maintenance overhead and makes it easier for users to understand the core concepts.
If you'd like to contribute further, we'd welcome a PR that:
- Enhances the existing chatbot example to support multiple transport types (perhaps via a configuration parameter)
- Adds clear documentation on how to switch between transport methods
- Includes small code snippets demonstrating the specific differences
This approach would provide the same educational value without the maintenance burden of duplicate code.
Added mcp_simple_chatbot_sse example showing MCP chatbot with SSE.
Motivation and Context
Provides a sample for using MCP with SSE for AI chatbots, aiding developers with clear code examples.
How Has This Been Tested?
Tested locally with main.py, mock server, and manual inputs to verify connection, tool use, and LLM responses.
Breaking Changes
None. New example, no impact on existing code.
Types of changes
Checklist