powder-o/MCP-RAGbot
If you are the rightful owner of MCP-RAGbot and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Model Context Protocol (MCP) server is designed to facilitate seamless interaction between various components of a Retrieval-Augmented Generation (RAG) chatbot system, leveraging advanced document management and search capabilities.
RAG Chatbot with MCP Tools
A Retrieval-Augmented Generation (RAG) chatbot that uses MCP (Model Context Protocol) tools to interact with a ChromaDB vector store and Groq's Deepseek model.
Features
- Vector Store: ChromaDB for document storage and similarity search
- LLM: Deepseek model via Groq API
- MCP Tools: FastMCP-based tools for document management and search
- CLI Interface: Simple command-line chat interface
- Document Management: Add documents, files, and search the knowledge base
Setup
-
Install Dependencies:
pip install -r requirements.txt
-
Set up Environment:
cp .env.example .env # Edit .env and add your Groq API key
-
Get Groq API Key:
- Sign up at Groq
- Create an API key
- Add it to your
.env
file
Usage
Start the Chat Interface
python cli_chat.py
Available Commands
/help
- Show help message/add
- Add a document to the knowledge base/addfile
- Add a file to the knowledge base/search
- Search the knowledge base/info
- Show collection information/clear
- Clear conversation history/quit
or/exit
- Exit the chat
Natural Chat
You can also just ask questions naturally. The AI will automatically:
- Search the knowledge base for relevant information
- Use that context to provide informed responses
- Invoke MCP tools as needed
MCP Tools
The system includes these MCP tools:
- search_documents: Search for relevant documents
- add_document: Add new document content
- add_file: Add a file's content to the vector store
- get_collection_info: Get collection statistics
- delete_document: Remove documents from the store
Testing
Run the test script to verify everything works:
python test_rag.py
Architecture
vector_store.py
: ChromaDB integration and document managementmcp_server.py
: MCP server with RAG toolsgroq_client.py
: Groq API client for Deepseek modelmcp_client.py
: MCP client and agent logiccli_chat.py
: Command-line chat interfacetest_rag.py
: Basic functionality tests
graph TD
%% User Entry
USER[User] --> CLI[cli_chat.py]
%% Main Flow
CLI --> CLIENT[mcp_client.py]
CLIENT --> GROQ[groq_client.py]
CLIENT --> SERVER[mcp_server.py]
%% Core Components
SERVER --> VECTOR[vector_store.py]
GROQ --> API[Groq API]
VECTOR --> CHROMA[(ChromaDB)]
VECTOR --> EMBED[SentenceTransformer]
%% Main Functions
SERVER --> SEARCH[search_documents]
SERVER --> ADD[add_document]
SERVER --> ADDFILE[add_file]
%% Vector Operations
ADD --> CHUNK[Text Chunking]
CHUNK --> STORE[Store Embeddings]
SEARCH --> RETRIEVE[Retrieve Context]
%% Data Flow
STORE --> CHROMA
RETRIEVE --> CHROMA
RETRIEVE --> GROQ
GROQ --> CLI
%% Styling
classDef user fill:#e1f5fe
classDef app fill:#fff3e0
classDef external fill:#e8f5e8
classDef data fill:#f3e5f5
class USER user
class CLI,CLIENT,SERVER,VECTOR app
class API,CHROMA,EMBED external
class CHUNK,STORE,RETRIEVE data
The system automatically manages the RAG pipeline, searching for relevant context when needed and providing informed responses based on your knowledge base.