mcp_chatbot

作者 keli-wen已验证

A chatbot implementation compatible with MCP (terminal / streamlit supported)

252
Stars
53
Forks
Python
语言
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/keli-wen/mcp_chatbot

快速入门

使用 mcp_chatbot 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

MCPChatbot Example

MCP Chatbot

This project demonstrates how to integrate the Model Context Protocol (MCP) with customized LLM (e.g. Qwen), creating a powerful chatbot that can interact with various tools through MCP servers. The implementation showcases the flexibility of MCP by enabling LLMs to use external tools seamlessly.

[!TIP] For Chinese version, please refer to README_ZH.md.

Overview

Chatbot Streamlit Example

Workflow Tracer Example

  • 🚩 Update (2025-04-11):
    • Added chatbot streamlit example.
  • 🚩 Update (2025-04-10):
    • More complex LLM response parsing, supporting multiple MCP tool calls and multiple chat iterations.
    • Added single prompt examples with both regular and streaming modes.
    • Added interactive terminal chatbot examples.

This project includes:

  • Simple/Complex CLI chatbot interface
  • Integration with some builtin MCP Server like (Markdown processing tools)
  • Support for customized LLM (e.g. Qwen) and Ollama
  • Example scripts for single prompt processing in both regular and streaming modes
  • Interactive terminal chatbot with regular and streaming response modes

Requirements

  • Python 3.10+
  • Dependencies (automatically installed via requirements):
    • python-dotenv
    • mcp[cli]
    • openai
    • colorama

Installation

  1. Clone the repository:

    git clone git@github.com:keli-wen/mcp_chatbot.git
    cd mcp_chatbot
    
  2. Set up a virtual environment (recommended):

    cd folder
    
    # Install uv if you don't have it already
    pip install uv
    
    # Create a virtual environment and install dependencies
    uv venv .venv --python=3.10
    
    # Activate the virtual environment
    # For macOS/Linux
    source .venv/bin/activate
    # For Windows
    .venv\Scripts\activate
    
    # Deactivate the virtual environment
    deactivate
    
  3. Install dependencies:

    pip install -r requirements.txt
    # or use uv for faster installation
    uv pip install -r requirements.txt
    
  4. Configure your environment:

    • Copy the .env.example file to .env:

      cp .env.example .env
      
    • Edit the .env file to add your Qwen API key (just for demo, you can use any LLM API key, remember to set the base_url and api_key in the .env file) and set the paths:

      LLM_MODEL_NAME=your_llm_model_name_here
      LLM_BASE_URL=your_llm_base_url_here
      LLM_API_KEY=your_llm_api_key_here
      OLLAMA_MODEL_NAME=your_ollama_model_name_here
      OLLAMA_BASE_URL=your_ollama_base_url_here
      MARKDOWN_FOLDER_PATH=/path/to/your/markdown/folder
      RESULT_FOLDER_PATH=/path/to/your/result/folder
      

Important Configuration Notes ⚠️

Before running the application, you need to modify the following:

  1. MCP Server Configuration: Edit mcp_servers/servers_config.json to match your local setup:

    {
        "mcpServers": {
            "markdown_processor": {
                "command": "/path/to/your/uv",
                "args": [
                    "--directory",
                    "/path/to/your/project/mcp_servers",
                    "run",
                    "markdown_processor.py"
                ]
            }
        }
    }
    

    Replace /path/to/your/uv with the actual path to your uv executable. You can use which uv to get the path. Replace /path/to/your/project/mcp_servers with the absolute path to the mcp_servers directory in your project. (For Windows users, you can take a look at the example in the Troubleshooting section)

  2. Environment Variables: Make sure to set proper paths in your .env file:

    MARKDOWN_FOLDER_PATH="/path/to/your/markdown/folder"
    RESULT_FOLDER_PATH="/path/to/your/result/folder"
    

    The application will validate these paths and throw an error if they contain placeholder values.

You can run the following command to check your configuration:

bash scripts/check.sh

Usage

Unit Test

You can run the following command to run the unit test:

bash scripts/unittest.sh

Examples

Single Prompt Examples

The project includes two single prompt examples:

  1. Regular Mode: Process a single prompt and display the complete response

    python example/single_prompt/single_prompt.py
    
  2. Streaming Mode: Process a single prompt with real-time streaming output

    python example/single_prompt/single_prompt_stream.py
    

Both examples accept an optional --llm parameter to specify which LLM provider to use:

python example/single_prompt/single_prompt.py --llm=ollama

[!NOTE] For more details, see the Single Prompt Example README.

Terminal Chatbot Examples

The project includes two interactive terminal chatbot examples:

  1. Regular Mode: Interactive terminal chat with complete responses

    python example/chatbot_terminal/chatbot_terminal.py
    
  2. Streaming Mode: Interactive terminal chat with streaming responses

    python example/chatbot_terminal/chatbot_terminal_stream.py
    

Both examples accept an optional --llm parameter to specify which LLM provider to use:

python example/chatbot_terminal/chatbot_terminal.py --llm=ollama

[!NOTE] For more details, see the Terminal Chatbot Example README.

Streamlit Web Chatbot Example

The project includes an interactive web-based chatbot example using Streamlit:

streamlit run example/chatbot_streamlit/app.py

This example features:

  • Interactive chat interface.
  • Real-time streaming responses.
  • Detailed MCP tool workflow visualization.
  • Configurable LLM settings (OpenAI/Ollama) and MCP tool display via the sidebar.

MCP Chatbot Streamlit Demo

[!NOTE] For more details, see the Streamlit Chatbot Example README.

Project Structure

  • mcp_chatbot/: Core library code
    • chat/: Chat session management
    • config/: Configuration handling
    • llm/: LLM client implementation
    • mcp/: MCP client and tool integration
    • utils/: Utility functions (e.g. WorkflowTrace and StreamPrinter)
  • mcp_servers/: Custom MCP servers implementation
    • markdown_processor.py: Server for processing Markdown files
    • servers_config.json: Configuration for MCP servers
  • data-example/: Example Markdown files for testing
  • example/: Example scripts for different use cases
    • single_prompt/: Single prompt processing examples (regular and streaming)
    • chatbot_terminal/: Interactive terminal chatbot examples (regular and streaming)
    • chatbot_streamlit/: Interactive web chatbot example using Streamlit

Extending the Project

You can extend this project by:

  1. Adding new MCP servers in the mcp_servers/ directory
  2. Updating the servers_config.json to include your new servers
  3. Implementing new functionalities in the existing servers
  4. Creating new examples based on the provided templates

Troubleshooting

For Windows users, you can take the following servers_config.json as an example:

{
    "mcpServers": {
        "markdown_processor": {
            "command": "C:\\Users\\13430\\.local\\bin\\uv.exe",
            "args": [
                "--directory",
                "C:\\Users\\13430\\mcp_chatbot\\mcp_servers",
                "run", 
                "markdown_processor.py"
            ]
        }
    }
}
  • Path Issues: Ensure all paths in the configuration files are absolute paths appropriate for your system
  • MCP Server Errors: Make sure the tools are properly installed and configured
  • API Key Errors: Verify your API key is correctly set in the .env file

常见问题

What is mcp_chatbot?

mcp_chatbot is an open-source mcp servers skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by keli-wen. A chatbot implementation compatible with MCP (terminal / streamlit supported). It has 252 GitHub stars.

Is mcp_chatbot safe to use?

Yes. mcp_chatbot passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install mcp_chatbot?

Clone the repository with "git clone https://github.com/keli-wen/mcp_chatbot" and add it to your Claude Code skills directory (see the Installation section above).

What programming language is mcp_chatbot written in?

mcp_chatbot is primarily written in Python. It is open-source under keli-wen on GitHub, so you can review or fork the full source.

Are there alternatives to mcp_chatbot?

Yes. SkillsLLM lists many other MCP Servers skills you can browse and compare side by side. Open the MCP Servers category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh mcp_chatbot against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

Scrapling

by D4Vinci

🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl!

75,9137,581Python
MCP 服务器
查看详情

TrendRadar

by sansan0

⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。

61,65224,883Python
MCP 服务器
查看详情

context7

by upstash

Context7 Platform -- Up-to-date code documentation for LLMs and AI code editors

61,0602,938TypeScript
MCP 服务器
查看详情

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

39,9393,219C
MCP 服务器
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情