← 返回公开榜单
mc

3choff/mcp-chatbot

A simple CLI chatbot that demonstrates the integration of the Model Context Protocol (MCP).

本周新增
1 星
近 3 周倍数
—
距上次推送
702 天
距上次发布
—
许可证
MIT

星标增长

每根柱子是这个周期记录下来的 star 增长:优先取逐个 stargazer 到达时间分桶的到达数,还没被 stargazer 扫描覆盖的仓库改用该周期的 star 净增;两个写者都没记录的周期画成虚线空档,而不是当成 0。柱高按各自窗口的峰值归一,两张图不共用坐标轴。指向任意一根柱子, tooltip 里是该周期的九项指标:当前值与周期内的净增。

指向或点击一根柱子,看当天的九项指标。

12/1712/301/111/242/62/193/33/16

2025 年 12 月 17 日 新增 0 个星标; 2025 年 12 月 18 日 新增 0 个星标; 2025 年 12 月 19 日 新增 0 个星标; 2025 年 12 月 21 日 新增 1 个星标; 2025 年 12 月 22 日 新增 0 个星标; 2025 年 12 月 23 日 新增 0 个星标; 2025 年 12 月 24 日 新增 0 个星标; 2025 年 12 月 25 日 新增 0 个星标; 2025 年 12 月 26 日 新增 0 个星标; 2025 年 12 月 27 日 新增 0 个星标; 2026 年 1 月 2 日 新增 0 个星标; 2026 年 1 月 3 日 新增 0 个星标; 2026 年 1 月 4 日 新增 0 个星标; 2026 年 1 月 5 日 新增 0 个星标; 2026 年 1 月 6 日 新增 0 个星标; 2026 年 1 月 8 日 新增 0 个星标; 2026 年 1 月 9 日 新增 0 个星标; 2026 年 1 月 10 日 新增 1 个星标; 2026 年 1 月 11 日 新增 0 个星标; 2026 年 1 月 12 日 新增 0 个星标; 2026 年 1 月 13 日 新增 0 个星标; 2026 年 1 月 14 日 新增 0 个星标; 2026 年 1 月 15 日 新增 0 个星标; 2026 年 1 月 16 日 新增 0 个星标; 2026 年 1 月 18 日 新增 0 个星标; 2026 年 1 月 21 日 新增 0 个星标; 2026 年 1 月 23 日 新增 0 个星标; 2026 年 1 月 25 日 新增 0 个星标; 2026 年 1 月 26 日 新增 0 个星标; 2026 年 1 月 27 日 新增 0 个星标; 2026 年 1 月 28 日 新增 0 个星标; 2026 年 1 月 29 日 新增 0 个星标; 2026 年 2 月 1 日 新增 1 个星标; 2026 年 2 月 2 日 新增 0 个星标; 2026 年 2 月 8 日 新增 0 个星标; 2026 年 2 月 9 日 新增 0 个星标; 2026 年 2 月 10 日 新增 0 个星标; 2026 年 2 月 11 日 新增 0 个星标; 2026 年 2 月 13 日 新增 0 个星标; 2026 年 2 月 14 日 新增 0 个星标; 2026 年 2 月 16 日 新增 1 个星标; 2026 年 2 月 17 日 新增 0 个星标; 2026 年 2 月 21 日 新增 0 个星标; 2026 年 2 月 23 日 新增 0 个星标; 2026 年 2 月 25 日 新增 0 个星标; 2026 年 2 月 27 日 新增 0 个星标; 2026 年 2 月 28 日 新增 0 个星标; 2026 年 3 月 1 日 新增 0 个星标; 2026 年 3 月 2 日 新增 0 个星标; 2026 年 3 月 3 日 新增 1 个星标; 2026 年 3 月 4 日 新增 0 个星标; 2026 年 3 月 5 日 新增 0 个星标; 2026 年 3 月 8 日 新增 0 个星标; 2026 年 3 月 10 日 新增 1 个星标; 2026 年 3 月 11 日 新增 1 个星标; 2026 年 3 月 16 日 新增 1 个星标

窗口内最高的一天是 2025 年 12 月 21 日,新增 1 个星标。

证据时间轴

这个项目还没有记录到异动、发布或许可证变化。

README
The document stored for this repository, with its Chinese translation when one has been produced

MCP Chatbot

This chatbot example demonstrates how to integrate the Model Context Protocol (MCP) into a simple CLI chatbot. The implementation showcases MCP's flexibility by supporting multiple tools through MCP servers and is compatible with any LLM provider that follows OpenAI API standards.

If you find this project helpful, don’t forget to ⭐ star the repository or buy me a ☕ coffee.

Key Features

  • LLM Provider Flexibility: Works with any LLM that follows OpenAI API standards (tested with Llama 3.2 90b on Groq and GPT-4o mini on GitHub Marketplace).
  • Dynamic Tool Integration: Tools are declared in the system prompt, ensuring maximum compatibility across different LLMs.
  • Server Configuration: Supports multiple MCP servers through a simple JSON configuration file like the Claude Desktop App.

Requirements

  • Python 3.10
  • python-dotenv
  • requests
  • mcp
  • uvicorn

Installation

  1. Clone the repository:

    git clone https://github.com/3choff/mcp-chatbot.git
    cd mcp-chatbot
    
  2. Install the dependencies:

    pip install -r requirements.txt
    
  3. Set up environment variables:

    Create a .env file in the root directory and add your API key:

    LLM_API_KEY=your_api_key_here
    
  4. Configure servers:

    The servers_config.json follows the same structure as Claude Desktop, allowing for easy integration of multiple servers. Here's an example:

    {
      "mcpServers": {
        "sqlite": {
          "command": "uvx",
          "args": ["mcp-server-sqlite", "--db-path", "./test.db"]
        },
        "puppeteer": {
          "command": "npx",
          "args": ["-y", "@modelcontextprotocol/server-puppeteer"]
        }
      }
    }
    

    Environment variables are supported as well. Pass them as you would with the Claude Desktop App.

    Example:

    {
      "mcpServers": {
        "server_name": {
          "command": "uvx",
          "args": ["mcp-server-name", "--additional-args"],
          "env": {
            "API_KEY": "your_api_key_here"
          }
        }
      }
    }
    

Usage

  1. Run the client:

    python main.py
    
  2. Interact with the assistant:

    The assistant will automatically detect available tools and can respond to queries based on the tools provided by the configured servers.

  3. Exit the session:

    Type quit or exit to end the session.

Architecture

  • Tool Discovery: Tools are automatically discovered from configured servers.
  • System Prompt: Tools are dynamically included in the system prompt, allowing the LLM to understand available capabilities.
  • Server Integration: Supports any MCP-compatible server, tested with various server implementations including Uvicorn and Node.js.

Class Structure

  • Configuration: Manages environment variables and server configurations
  • Server: Handles MCP server initialization, tool discovery, and execution
  • Tool: Represents individual tools with their properties and formatting
  • LLMClient: Manages communication with the LLM provider
  • ChatSession: Orchestrates the interaction between user, LLM, and tools

Logic Flow

flowchart TD
    A[Start] --> B[Load Configuration]
    B --> C[Initialize Servers]
    C --> D[Discover Tools]
    D --> E[Format Tools for LLM]
    E --> F[Wait for User Input]
    
    F --> G{User Input}
    G --> H[Send Input to LLM]
    H --> I{LLM Decision}
    I -->|Tool Call| J[Execute Tool]
    I -->|Direct Response| K[Return Response to User]
    
    J --> L[Return Tool Result]
    L --> M[Send Result to LLM]
    M --> N[LLM Interprets Result]
    N --> O[Present Final Response to User]
    
    K --> O
    O --> F
  1. Initialization:

    • Configuration loads environment variables and server settings
    • Servers are initialized with their respective tools
    • Tools are discovered and formatted for LLM understanding
  2. Runtime Flow:

    • User input is received
    • Input is sent to LLM with context of available tools
    • LLM response is parsed:
      • If it's a tool call → execute tool and return result
      • If it's a direct response → return to user
    • Tool results are sent back to LLM for interpretation
    • Final response is presented to user
  3. Tool Integration:

    • Tools are dynamically discovered from MCP servers
    • Tool descriptions are automatically included in system prompt
    • Tool execution is handled through standardized MCP protocol

Contributing

Feedback and contributions are welcome. If you encounter any issues or have suggestions for improvements, please create a new issue on the GitHub repository.

If you'd like to contribute to the development of the project, feel free to submit a pull request with your changes.

License

This project is licensed under the MIT License.

页面上的每个数字都来自记录下来的 stargazer 到达时间,没有评分公式,也没有 AI 判定。 任何结论都可以用 /api/v1/repos/{id}/stats 里的原始增量自己重算。