Get the FREE Ultimate OpenClaw Setup Guide →

agentic-rag-chatbot

Agentic RAG Chatbot using Model Context Protocol (MCP) to answer queries from PDFs, Word, and PPT files.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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)
  1. Clone the repository git clone https://github.com/chakrikaguttameedi/agentic-rag-chatbot cd agentic-rag-chatbot

  2. (Optional) Create a virtual environment python -m venv venv

    On Windows

    venv\Scripts\activate

    On macOS/Linux

    source venv/bin/activate

  3. Install dependencies pip install -r requirements.txt

  4. 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

  5. Run the application (coordinator entry point) python main.py

  6. 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

Sponsor this space

Reach thousands of developers