A self-hosted document RAG (Retrieval Augmented Generation) system with an MCP (Model Context Protocol) server, designed for deployment on Unraid.
Cloud-based LLMs (Claude, GPT, etc.) connect via the MCP server to search your local documents using semantic similarity - your documents never leave your server.
┌─────────────────┐
│ Web UI (:8902) │
│ React + Nginx │
└───────┬──────────┘
│
┌───────────────┼───────────────┐
│ │
┌────────┴────────┐ ┌─────────┴────────┐
│ Backend (:8900) │ │ MCP Server(:8901)│
│ FastAPI + RAG │◄───────────│ SSE + HTTP │
│ ChromaDB │ │ API Key Auth │
└────────┬────────┘ └──────────────────┘
│
┌────────┴────────┐
│ SMB Shares (LAN)│
│ 192.168.1.x │
└─────────────────┘
Three Docker services:
| Service | Internal Port | External Port | Purpose |
|---|---|---|---|
| Backend | 8000 | 8900 | FastAPI + ChromaDB RAG engine |
| MCP Server | 8001 | 8901 | MCP protocol for cloud LLMs |
| Frontend | 80 | 8902 | React management UI |
SSH into your server or use the Unraid terminal:
cd /mnt/user/appdata # or wherever you keep app data
git clone <this-repo> rag-mcp-server
cd rag-mcp-server
# Copy and edit environment config
cp .env.example .env
# Deploy
chmod +x deploy.sh
./deploy.shNavigate to http://192.168.1.52:8902 in your browser.
Go to API Keys in the sidebar and create a key. Copy it immediately - it's shown only once.
Use the Documents page to upload files, or use the SMB Browser to ingest documents from LAN shares.
Add to your MCP config:
{
"mcpServers": {
"rag-documents": {
"url": "http://192.168.1.52:8901/sse",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}For clients that support it, use http://192.168.1.52:8901/mcp as the endpoint.
| Category | Extensions |
|---|---|
| Text | .txt, .md, .csv, .log, .ini, .conf, .cfg |
| Code | .py, .js, .ts, .go, .java, .c, .cpp, .rs, .zig, .sh, .sql |
| Documents | .pdf, .docx, .xlsx |
| Data | .json, .yaml, .yml, .xml, .html, .css, .toml |
| Tool | Description |
|---|---|
search_documents |
Semantic search across indexed documents |
list_collections |
List all document collections |
list_documents |
List documents in a collection |
get_server_status |
Server status and stats |
POST /api/documents/upload- Upload and index a documentPOST /api/documents/query- Semantic searchGET /api/documents/list?collection=default- List documentsDELETE /api/documents/{filename}- Remove a documentPOST /api/documents/reindex- Re-index a collectionPOST /api/smb/browse- Browse SMB sharePOST /api/smb/ingest- Ingest from SMB shareGET /api/admin/status- Server status
GET /sse- SSE transport endpointPOST /messages?session_id=X- SSE message endpointPOST /mcp- Streamable HTTP endpointGET /mcp/info- Server capabilities (public)
All persistent data is stored in ./data/:
documents/- Uploaded document fileschromadb/- Vector databaseconfig/- Server configuration and API key hashes
# Start
docker compose up -d
# Stop
./stop.sh
# View logs
docker compose logs -f
# Rebuild after changes
docker compose build && docker compose up -d