Skip to main content
Glama
chikhio123

Qdrant RAG MCP Server

by chikhio123
README.md
# Qdrant RAG Tool

Minimal RAG ingestion and search tool for `.md` and `.txt` files.

## Layout

- `data/`: put documents here
- `ingest.py`: chunk documents, embed them, and upsert into Qdrant
- `search.py`: embed a query and search Qdrant
- `.env`: runtime configuration and secrets

## Usage

```bash
cd /opt/qdrant/rag
source .venv/bin/activate
python ingest.py
python search.py "Qdrant 是什么"
```

The ingester uses a stable point ID based on `source + chunk_index`.
Before ingesting a file, it deletes existing chunks for the same `source`,
so rerunning ingestion for the same file does not create duplicates.
Use `python ingest.py --prune` to delete sources from Qdrant after removing
their files from `data/`.

Current defaults:

- Embedding endpoint: `https://ai.gitee.com/v1`
- Embedding model: `Qwen3-Embedding-8B`
- Embedding dimensions: `4096`
- Rerank model: `Qwen3-Reranker-8B`
- Ask model: `deepseek-v4-flash-free` through OpenCode Zen
- Qdrant collection: `docs_qwen3_embedding_8b`

## MCP

The MCP server exposes RAG tools:

- `rag_health`
- `rag_search`
- `rag_ask`
- `rag_source_stats`
- `rag_get_chunk`
- `rag_get_source`
- `rag_update_source`
- `rag_delete_source`

It listens on `127.0.0.1:8765` by default, with the MCP endpoint at `/mcp`.