agentic-rag-chatbot
Agentic RAG Chatbot using Model Context Protocol (MCP) to answer queries from PDFs, Word, and PPT files.
claude mcp add --transport stdio chakrikaguttameedi-agentic-rag-chatbot python main.py \ --env GEMINI_API_KEY="your_gemini_api_key_here"
How to use
This MCP-powered Agentic RAG Chatbot orchestrates a multi-agent pipeline to answer questions over multi-format documents. The system comprises four specialized agents: IngestionAgent (parses PDFs, PPTX, DOCX, CSV, TXT/MD), RetrievalAgent (builds and queries a FAISS vector store with semantic embeddings), LLMResponseAgent (generates final responses using Google Gemini 2.0), and CoordinatorAgent (coordinates the end-to-end flow and MCP message routing). Inter-agent communication follows the MCP protocol with traceable messages, enabling end-to-end observability across the pipeline. To operate the server, run the main coordinator entry point which initializes all agents and starts the UI for user interaction. Users can upload documents via the Streamlit interface, then ask questions; the system retrieves relevant chunks, passes them through the LLM, and returns answers with source attribution and ongoing processing status.
Capabilities include: multi-format document ingestion and chunking, semantic retrieval with FAISS, contextual response generation via Gemini, and an interactive chat UI that preserves history and displays which documents contributed to each answer. The MCP flow ensures traceability from user query to final answer, with context responses flowing between RetrievalAgent and LLMResponseAgent before delivering a complete response to the user.
How to install
Prerequisites:
- Python 3.8+
- Access to Google Gemini API (Gemini API Key)
-
Clone the repository git clone https://github.com/chakrikaguttameedi/agentic-rag-chatbot cd agentic-rag-chatbot
-
(Optional) Create a virtual environment python -m venv venv
On Windows
venv\Scripts\activate
On macOS/Linux
source venv/bin/activate
-
Install dependencies pip install -r requirements.txt
-
Configure environment variables Create a .env file in the project root (or export in your shell) and add: GEMINI_API_KEY=your_gemini_api_key_here
-
Run the application (coordinator entry point) python main.py
-
Open the UI The Streamlit UI is accessible at http://localhost:8501
Notes:
- The main.py entry initializes the MCP-based coordinator and all agents. The Streamlit UI (ui/streamlit_app.py) provides the upload, chat, and source-attribution features.
- If you prefer a manual run flow, ensure GEMINI_API_KEY is set and the environment is activated before starting python main.py.
Additional notes
Tips and common issues:
- Ensure your GEMINI_API_KEY is valid and has sufficient permissions for the Gemini 2.0 Flash endpoint used by LLMResponseAgent.
- The MCP protocol relies on trace_id for observability; if you encounter missing trace information, verify that the coordinator and agents are properly instantiated and that message routing is functioning.
- For large documents, adjust chunking parameters in document_parser.py (e.g., chunk_size and overlap) to balance context length and retrieval efficiency.
- If FAISS index rebuilds are slow, consider batch processing uploads or caching indices during development.
- Streamlit updates can affect the UI; pinning to the specified requirements version in requirements.txt helps maintain compatibility.
Related MCP Servers
mysql_mcp_server
A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases
mcp-client-cli
A simple CLI to run LLM prompt and implement MCP client.
lc2mcp
Convert LangChain tools to FastMCP tools
mcp-playground
A Streamlit-based chat app for LLMs with plug-and-play tool support via Model Context Protocol (MCP), powered by LangChain, LangGraph, and Docker.
mcp-chatbot
MCP Chatbot powered by Anthropic Claude. Delivering on‐demand literature search and summarisation for academics and engineers
skill-to
Convert AI Skills (Claude Skills format) to MCP server resources - Part of BioContextAI