RAG on Docker is a self-hosted RAG service bundle designed for NAS or Docker-based deployments.
It combines document indexing, MCP exposure, vector storage, scheduled health checks, and report delivery into one manageable stack.
- Current version:
0.2.1 - Chinese documentation: README_CN.md
- Changelog: CHANGELOG.md
- License: MIT
This project is intended for users who want to:
- mount a local knowledge base directory into Docker
- build and maintain a searchable RAG index automatically
- expose the RAG capability through MCP over Streamable HTTP
- monitor service health on a schedule
- receive health reports when checks run
The current implementation uses:
Qdrantas the vector database- a local MCP service for search and management tools
- an OpenAI-compatible model API for embedding and rerank access
- a separate scheduled checker for health reports
This repository combines the whole setup into one Docker Compose stack:
knowledge-mcp: the RAG service that builds indexes and exposes MCP over Streamable HTTPragcheck: the scheduled health-check and report serviceqdrant: the vector database used by the RAG service
At startup, the knowledge-mcp service brings the MCP endpoint up immediately, starts an initial background scan, and stores vectors in Qdrant as indexing progresses.
After that, it continues watching for file changes and updates the index automatically with incremental scans.
The service also exposes MCP tools over Streamable HTTP, so an MCP client can search the knowledge base, inspect indexed content, and trigger reindex or incremental ingest operations.
Alongside it, ragcheck runs periodic health checks against both the MCP endpoint and Qdrant, writes HTML reports, and sends those results to the configured mailbox.
knowledge-mcp: indexing, retrieval, MCP tool exposure, and file watchingqdrant: vector storage and collection managementragcheck: scheduled health checks, report generation, and report delivery
This project is configured around generic OpenAI-compatible API fields:
MODEL_API_KEYMODEL_API_BASEEMBED_MODELRERANK_MODEL
Fill those values in knowledge-mcp/.env.
If you later adapt the code for another compatible provider, the deployment structure here can still stay the same.
RAG on docker/
|- docker-compose.yml
|- .env.example
|- knowledge-mcp/
| |- .env
| |- .env.example
| |- Dockerfile
| `- app/
|- RAGcheck/
| |- .env
| |- .env.example
| |- Dockerfile
| `- app/
`- storage/
|- qdrant/
|- index_state/
`- reports/
- Edit
knowledge-mcp/.env - Edit
RAGcheck/.env - Create a root
.envfrom.env.exampleif you want to overrideKB_SOURCE_DIR
The root KB_SOURCE_DIR controls where your NAS or host knowledge files are mounted into the knowledge-mcp container.
This repository does not include real .env files. Before starting, create them from the example files:
cp .env.example .env
cp knowledge-mcp/.env.example knowledge-mcp/.env
cp RAGcheck/.env.example RAGcheck/.envIf your environment does not use cp, create the three .env files manually and copy the contents from the matching .env.example files.
The root .env is only used to define where your knowledge files live on the host machine.
KB_SOURCE_DIR=/absolute/path/to/your/rag-dataKB_SOURCE_DIR: absolute path of your RAG knowledge directory on the NAS or host- This directory will be mounted read-only into the container as
/data/mcpdata
This file is used by the RAG service for the embedding and rerank API.
MODEL_API_KEY=your_real_api_key
MODEL_API_BASE=https://api.openai.com/v1
EMBED_MODEL=text-embedding-3-large
RERANK_MODEL=rerank-1MODEL_API_KEY: your real model API keyMODEL_API_BASE: API base URL for your compatible providerEMBED_MODEL: embedding model name used for indexing and retrievalRERANK_MODEL: rerank model name used for result sorting
This file is used by the health-check and report service.
MCP_CHECK_URL=http://knowledge-mcp:6646
QDRANT_URL=http://qdrant:6333
SMTP_HOST=your_smtp_host
SMTP_PORT=your_smtp_port
SMTP_USER=your_smtp_username
SMTP_PASS=your_smtp_password_or_auth_code
MAIL_FROM=your_sender_email
MAIL_TO=your_receiver_email
CHECK_INTERVAL_DAYS=3
REPORT_RETENTION_DAYS=30MCP_CHECK_URL: MCP service address inside Docker Compose, usually keephttp://knowledge-mcp:6646QDRANT_URL: Qdrant service address inside Docker Compose, usually keephttp://qdrant:6333SMTP_HOST: SMTP server address from your email provider's official settings pageSMTP_PORT: SMTP port from your provider's official settings page; common values are465for SSL and587for STARTTLS, but do not assume these without checkingSMTP_USER: SMTP login username; some providers use the full email address, others use an account nameSMTP_PASS: mailbox password or SMTP authorization code, depending on your providerMAIL_FROM: sender email addressMAIL_TO: receiver email address for the health reportsCHECK_INTERVAL_DAYS: how many days between automatic checksREPORT_RETENTION_DAYS: how many days local HTML reports are kept
Important:
- Do not copy SMTP host, port, or username values from unrelated examples on the internet
- Use the exact SMTP host, port, encryption mode, and credential format required by your own provider
- If your provider requires an app password or SMTP authorization code, use that instead of your normal login password
Before uploading to GitHub or Gitee:
- keep
knowledge-mcp/.envdeleted - keep
RAGcheck/.envdeleted - only upload
.env.examplefiles - do not upload
storage/
docker compose up -d --build- MCP endpoint:
http://<your-host>:6646/mcp - Qdrant API:
http://<your-host>:6333
main: email delivery variant for public deploymentsragcheck-qqbot: QQ bot delivery branch prepared from the same health-check logic
- Do not upload
knowledge-mcp/.env - Do not upload
RAGcheck/.env - Do not upload the
storage/directory - Commit the two
.env.examplefiles instead