
keli-wen/mcp_chatbot
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
keli-wen/mcp_chatbot — это кандидат-сервер MCP, импортированный из https://github.com/keli-wen/mcp_chatbot.
Обзор
keli-wen/mcp_chatbot — это кандидат-сервер MCP, импортированный из https://github.com/keli-wen/mcp_chatbot.
Обзор (машинный перевод)
Этот проект демонстрирует, как интегрировать протокол Model Context Protocol (MCP) с кастомизированным LLM (например, Qwen), создавая мощный чат-бот, способный взаимодействовать с различными инструментами через MCP-серверы. Реализация демонстрирует гибкость MCP, позволяя LLM бесшовно использовать внешние инструменты.
[! СОВЕТ] Для китайской версии, пожалуйста, см. README_ZH.md.
Обзор
Пример Chatbot Streamlit
Пример трассера рабочих процессов
- 🚩 Обновление (2025-04-11):
- Добавлен пример с упрощением чат-бота.
- 🚩 Обновление (2025-04-10):
- Более сложный парсинг ответов LLM, поддерживающий несколько вызовов инструментов MCP и несколько итераций чата.
- Добавлены примеры одиночных подсказок как в обычном, так и в стриминговом режимах.
- Добавлены примеры интерактивных терминальных чат-ботов.
В этот проект входят:
- Простой/сложный интерфейс чат-бота CLI
- Интеграция с некоторыми встроенными MCP-серверами, такими как (инструменты обработки Markdown)
- Поддержка кастомизированных LLM (например, Qwen) и Ollama
- Примеры скриптов для обработки отдельных запросов как в обычном, так и в потоковом режимах
- Интерактивный терминальный чат-бот с обычным и стриминговым режимами отклика
Требования
- Python 3.10+
- Зависимости (автоматически устанавливаются через требования):
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
README
Показан фрагмент оригинального README. Открыть оригинал.
MCPChatbot Example
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
-
Clone the repository:
git clone [email protected]:keli-wen/mcp_chatbot.git cd mcp_chatbot -
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 -
Install dependencies:
pip install -r requirements.txt # or use uv for faster installation uv pip install -r requirements.txt -
Configure your environment:
-
Copy the
.env.examplefile to.env:cp .env.example .env -
Edit the
.envfile 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:
- MCP Server Configuration:
Установка
This server does not publish a one-line install command.
Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →Конфигурация
{
"mcpServers": {
"markdown_processor": {
"command": "/path/to/your/uv",
"args": [
"--directory",
"/path/to/your/project/mcp_servers",
"run",
"markdown_processor.py"
]
}
}
}