← Back to Projects
Web App

KnowledgeBot

A RAG-powered team knowledge management app — upload PDFs, ask questions in natural language, and get cited answers via a Streamlit UI backed by ChromaDB and an LLM.

PythonFastAPIChromaDBStreamlitRAGOllama

Overview

KnowledgeBot is a document Q&A system built on the MCP Server framework. Teams upload PDF documents through a Streamlit UI; the app chunks and embeds them into ChromaDB using sentence-transformers. Natural language queries are answered by retrieving the top-k relevant chunks and passing them to an LLM — online (OpenAI, Anthropic) or fully offline (Ollama llama3/mistral/phi3) — with source citations returned alongside the answer.

Key Features

  • PDF ingestion pipeline: extract text → chunk (512 tokens, 50 overlap) → embed → store in ChromaDB
  • Dual-mode LLM: online (OpenAI GPT-4, Anthropic Claude) or offline (Ollama) switchable via .env
  • FastAPI web gateway bridging HTTP requests to the MCP stdio protocol via an adapter layer
  • Streamlit UI with upload, query, and document library pages
  • Theme/domain scoping — queries can be restricted to a specific document collection
  • Docker Compose deployment with optional Ollama sidecar for fully local operation

Technical Decisions

ChromaDB was chosen over a managed vector database to keep Phase 1 entirely local — no cloud dependency, no API key, and trivially runnable on a laptop alongside Ollama. The FastAPI gateway converts HTTP requests into MCP RequestMessage objects before forwarding to the MCP Server subprocess, keeping the RAG tools decoupled from the transport layer and reusable in non-HTTP contexts. Sentence-transformers all-MiniLM-L6-v2 was selected as the default embedding model for its balance of speed and retrieval quality on CPU.