
3choff/mcp-chatbot
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
3choff/mcp-chatbot은 [[T0]에서 가져온 MCP 서버 후보입니다.
개요
3choff/mcp-chatbot은 [[T0]에서 가져온 MCP 서버 후보입니다.
개요(AI 번역)
이 챗봇 예시는 모델 컨텍스트 프로토콜(MCP)을 간단한 CLI 챗봇에 통합하는 방법을 보여줍니다. 이 구현은 MCP 서버를 통해 여러 도구를 지원하며 OpenAI API 표준을 따르는 모든 LLM 제공자와 호환되는 MCP의 유연성을 보여줍니다.
이 프로젝트가 도움이 된다면, 저장소에 별표를 ⭐ 달거나 저에게 ☕ 커피를 사주는 것을 잊지 마세요.
주요 특징
- LLM 제공자 유연성: OpenAI API 표준을 따르는 모든 LLM과 호환됩니다(Groq의 Llama 3.2 90b와 GitHub Marketplace의 GPT-4o mini로 테스트됨).
- 동적 도구 통합: 도구는 시스템 프롬프트에서 선언되어 서로 다른 LLM 간 최대 호환성을 보장합니다.
- 서버 구성: Claude 데스크톱 앱과 같은 간단한 JSON 구성 파일을 통해 여러 MCP 서버를 지원합니다.
요구 사항
- 파이썬 3.10
python-dotenvrequestsmcpuvicorn
설치
-
저장소 복제:
-
의존성 설치:
-
환경 변수 설정 하기:
루트 디렉터리에 .env 파일을 만들고 API 키를 추가하세요:
- 서버 구성 완료:
'servers_config.
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
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-dotenvrequestsmcpuvicorn
Installation
-
Clone the repository:
git clone https://github.com/3choff/mcp-chatbot.git cd mcp-chatbot -
Install the dependencies:
pip install -r requirements.txt -
Set up environment variables:
Create a
.envfile in the root directory and add your API key:LLM_API_KEY=your_api_key_here -
Configure servers:
The
servers_config.jsonfollows 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
-
Run the client:
python main.py -
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.
-
Exit the session:
Type
quitorexitto 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
설치
uvx mcp-server-sqlite --db-path ./test.db설정
{
"mcpServers": {
"sqlite": {
"command": "uvx",
"args": ["mcp-server-sqlite", "--db-path", "./test.db"]
},
"puppeteer": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
}
}
}