Skip to content

Examples: add MCP simple chatbot with SSE #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

Amaindex
Copy link

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

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.
@mcp-shadow mcp-shadow bot closed this May 13, 2025
Copy link

@mcp-shadow mcp-shadow bot left a comment

Choose a reason for hiding this comment

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

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:

  1. Enhances the existing chatbot example to support multiple transport types (perhaps via a configuration parameter)
  2. Adds clear documentation on how to switch between transport methods
  3. Includes small code snippets demonstrating the specific differences

This approach would provide the same educational value without the maintenance burden of duplicate code.

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