RAG Chat Assistant MCP Server
Allows the MCP server to use Ollama for LLM-based answer generation and text embeddings.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@RAG Chat Assistant MCP ServerWhat are the key points from the uploaded document on RAG?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
RAG Chat Assistant
A document Q&A Chat Assistant powered by Retrieval-Augmented Generation (RAG). Uses a hybrid retrieval system (semantic + keyword search) with an MCP (Model Context Protocol) server/client architecture, PII redaction, automated evaluation via RAGAS, and full observability tracing.
Architecture
Streamlit Chat UI (Client - .venv)
↕ MCP Protocol (Streamable HTTP on localhost:8000)
MCP Server (FastMCP - .mcpvenv)
├── Tools: filesystem, doc_loader, chunker, ingest, retriever
├── Agents: RAG Agent, Summarizer, PII Redactor, Evaluator
├── Storage: ChromaDB (vector) + BM25 (keyword) + Registry
└── External: Ollama (LLM + Embeddings), Opik (Observability)Related MCP server: Antigravity PDF MCP Server
Project Structure
L3June26_Assignment/
├── MCP_Stack/ # MCP Server (runs in .mcpvenv)
│ ├── agents/
│ │ ├── rag_agent.py # LangGraph RAG agent (retrieve → generate)
│ │ ├── summarizer_agent.py # Iterative document summarization with caching
│ │ ├── pii_redactor.py # Regex + optional LLM-based PII detection
│ │ └── evaluator_agent.py # RAGAS evaluation + ground-truth generator
│ ├── tools/
│ │ ├── doc_loader.py # Multi-format document loading (PDF/DOCX/TXT/CSV/XLSX/XML/images)
│ │ ├── chunker.py # Semantic chunking with metadata
│ │ ├── ingest.py # Ingestion pipeline + document registry
│ │ ├── retriever.py # Hybrid search (ChromaDB + BM25 + reranking)
│ │ └── filesystem.py # Sandboxed file browsing
│ ├── mcp_server.py # FastMCP server entry point
│ ├── config.py # Server configuration
│ ├── .env.example # Server secrets template
│ ├── requirements_mcp.txt # Server dependencies
│ ├── knowledge_source/ # Drop documents here for ingestion
│ ├── knowledge_base/ # ChromaDB + BM25 index + registry.json (auto-generated)
│ ├── Server_Logs/ # Per-session JSONL logs
│ └── cache/ # Summarizer cache (by content hash)
├── tests/ # All tests
│ ├── test_property_*.py # Property-based tests (Hypothesis)
│ ├── test_unit_*.py # Unit tests
│ └── test_integration_*.py # Integration tests
├── Client_Logs/ # Client JSONL logs
├── streamlit_app.py # Streamlit chat UI (runs in .venv)
├── config.py # Client configuration
├── .env.example # Client secrets template
├── requirements.txt # Client dependencies
├── test_tools.py # Manual test stub for tools/agents
└── README.mdPrerequisites
Dependency | Purpose |
Python 3.12 | Runtime (RAGAS has compatibility issues with 3.14) |
Package manager (replaces pip) | |
Local/cloud LLM serving | |
Tesseract OCR (optional) | Primary OCR for images; if unavailable, falls back to |
Setup
1. Pull Required Ollama Models
# Chat model (cloud-hosted, no local GPU needed)
ollama pull gpt-oss:120b-cloud
# Embedding model
ollama pull nomic-embed-text
# Vision model (OCR fallback — cloud-hosted, no local GPU needed)
ollama pull gemma4:31b-cloud2. Create Virtual Environments
MCP Server (.mcpvenv):
uv venv .mcpvenv --python 3.12
# Windows
.mcpvenv\Scripts\activate
# Linux/macOS
source .mcpvenv/bin/activate
uv pip install -r MCP_Stack/requirements_mcp.txtStreamlit Client (.venv):
uv venv .venv --python 3.12
# Windows
.venv\Scripts\activate
# Linux/macOS
source .venv/bin/activate
uv pip install -r requirements.txt3. Configure Environment Variables
# Copy templates
cp .env.example .env
cp MCP_Stack/.env.example MCP_Stack/.envEdit each .env file with your actual values:
Client .env:
OLLAMA_BASE_URL=http://localhost:11434
ORCHESTRATOR_MODEL=gpt-oss:120b-cloud
MCP_SERVER_URL=http://localhost:8000/mcp
ENABLE_OPIK_TRACING=false
OPIK_API_KEY=<your-key>
OPIK_WORKSPACE=<your-workspace>
OPIK_PROJECT_NAME=rag-chat-assistantServer MCP_Stack/.env:
OLLAMA_BASE_URL=http://localhost:11434
DEFAULT_MODEL=gpt-oss:120b-cloud
EMBEDDING_MODEL=nomic-embed-text
VISION_MODEL=gemma4:31b-cloud
CHUNK_SIZE=2000
CHUNK_OVERLAP=200
RETRIEVAL_TOP_K=5
SEMANTIC_WEIGHT=0.7
PII_USE_LLM=false
ENABLE_RAGAS_EVAL=false
MCP_SERVER_PORT=80004. Add Documents to Knowledge Source
Place your documents (PDF, DOCX, TXT, CSV, XLSX, XML, or images) into:
MCP_Stack/knowledge_source/These will be automatically ingested when the MCP server starts.
Running the Application
Step 1: Start the MCP Server
Open a terminal and activate the server environment:
# Windows
.mcpvenv\Scripts\activate
# Linux/macOS
source .mcpvenv/bin/activate
# Start the server
python -m MCP_Stack.mcp_serverOn startup, the server will:
Inject SSL certificates (truststore)
Load existing knowledge base from disk
Scan
knowledge_source/and ingest any new or modified documentsSkip unchanged documents (based on content hash)
Register all tools and agents
Serve MCP protocol on
http://localhost:8000/mcp
Note: Documents added to
knowledge_source/while the server is running will NOT be auto-detected. Restart the server to ingest new files.
Step 2: Start the Streamlit Client
Open a separate terminal and activate the client environment:
# Windows
.venv\Scripts\activate
# Linux/macOS
source .venv/bin/activate
# Start the UI
streamlit run streamlit_app.pyThe chat UI will open in your browser (typically at http://localhost:8501).
Usage
Asking Questions
Type your question in the chat input. The RAG agent will:
Search the knowledge base using hybrid retrieval (semantic + keyword)
Generate an answer with citations to source documents
Display RAGAS evaluation scores (if enabled)
Document Management
Through the chat interface you can:
Browse files — list and inspect documents in
knowledge_source/Ingest manually — force re-ingest of a specific file or all files
List documents — see all ingested documents with metadata
Delete documents — remove a document from the knowledge base
Summarize — get a concise summary of a long document
Ground-Truth Test Data Generation
Generate evaluation test data from your documents:
Provide a document name from
knowledge_source/The system generates question-answer pairs with context passages
Output is saved as JSON for use with RAGAS evaluation (faithfulness, answer relevancy, context precision, context recall)
Configuration Reference
Server Configuration (MCP_Stack/config.py)
Parameter | Default | Description |
|
| Ollama API endpoint |
|
| Chat model for answer generation |
|
| Embedding model for vector search |
|
| Cloud vision model (OCR fallback) |
|
| Max tokens for generated responses |
|
| LLM temperature |
|
| Characters per chunk (~500 tokens) |
|
| Overlap between consecutive chunks |
|
| Number of chunks to retrieve |
|
| Semantic vs keyword balance (0.7 = 70% semantic) |
|
| Enable LLM-based PII detection (slower, catches more) |
|
| Auto-evaluate responses with RAGAS |
|
| Server port |
Client Configuration (config.py)
Parameter | Default | Description |
|
| Ollama API endpoint |
|
| Model for client-side orchestration |
|
| MCP server endpoint |
|
| Enable Opik observability tracing |
Running Tests
# Activate the server environment (has all dependencies)
# Windows
.mcpvenv\Scripts\activate
# Linux/macOS
source .mcpvenv/bin/activate
# Run all tests
python -m pytest tests/ -v
# Run only property-based tests
python -m pytest tests/test_property_*.py -v
# Run only unit tests
python -m pytest tests/test_unit_*.py -v
# Run a specific test file
python -m pytest tests/test_unit_chunker.py -vKey Design Decisions
Decision | Choice | Rationale |
Protocol | MCP over Streamable HTTP | Standardized tool/agent interface; single endpoint |
Agent Framework | LangGraph | Stateful graph workflows with conditional routing |
Vector Store | ChromaDB (persistent) | Local file-based; no external service needed |
Keyword Search | rank-bm25 (BM25Okapi) | Lightweight in-process; complements semantic search |
Embedding | nomic-embed-text via Ollama | Dedicated embedding model; local inference |
OCR | Tesseract → gemma4:31b-cloud fallback | Tesseract is fast; cloud vision is available everywhere |
Observability | Opik (by Comet) | Native LangChain callback integration |
Evaluation | RAGAS | Standard RAG evaluation framework |
SSL | truststore | Corporate proxy support via Windows cert store |
Troubleshooting
Issue | Solution |
SSL errors behind corporate proxy | Ensure |
Ollama connection refused | Verify Ollama is running: |
Empty OCR results | Install Tesseract, or ensure |
MCP connection timeout | Check that the server is running on the configured port (default 8000) |
Documents not appearing after adding | Restart the MCP server — ingestion only happens at startup |
RAGAS scores not showing | Set |
Supported Document Formats
Format | Extensions | Method |
| pypdf + pdfplumber fallback | |
Word |
| python-docx |
Plain Text |
| Direct read with encoding detection |
CSV |
| pandas |
Excel |
| openpyxl via pandas |
XML |
| xml.etree + lxml fallback |
Images |
| Tesseract OCR → gemma4:31b-cloud fallback |
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceEnables RAG (Retrieval-Augmented Generation) capabilities with document processing, vector storage, and intelligent Q\&A using OpenAI embeddings and semantic search.Last updated
- Flicense-qualityDmaintenanceEnables intelligent ingestion and querying of PDF, Markdown, and text files using hybrid search that combines keyword matching and semantic embeddings with citations.Last updated2
- Alicense-qualityDmaintenanceA modular Retrieval-Augmented Generation (RAG) framework that provides hybrid search and knowledge retrieval capabilities via the Model Context Protocol. It enables users to integrate document-based knowledge into LLM workflows with support for dense/sparse retrieval, reranking, and observability.Last updated1MIT
- Alicense-qualityDmaintenanceEnables AI assistants to perform semantic, hybrid, and filtered search on indexed local documentation with RAG capabilities.Last updated2MIT
Related MCP Connectors
Search your knowledge bases from any AI assistant using hybrid RAG.
Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.
Long-term memory for AI assistants. Hybrid retrieval, query expansion, auto-topics.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AP46593/Enterprise_Knowledge_Assistant_v3.2'
If you have feedback or need assistance with the MCP directory API, please join our Discord server