rag-mcp
Click on "Deploy 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-mcpSearch for how to ingest PDFs and view citations"
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 System
Local Retrieval-Augmented Generation system for PDF documentation. Provides offline document ingestion with hybrid vector search and an MCP server for LLM agents to query indexed documentation.
Architecture
Offline / manual
PDFs and docs -> Ingestion CLI -> Local Qdrant (Docker)
|
During questions |
LLM agent -> MCP retrieval tools -----+
-> grounded answer with citationsTwo executables share a common codebase:
rag- Ingestion CLI for parsing, chunking, embedding, and storing PDFsrag-mcp- Read-only MCP stdio server exposing search and retrieval tools
Related MCP server: RAG MCP Server
Prerequisites
Python 3.11+
uv package manager
Docker (for Qdrant)
Setup
1. Start Qdrant
cd rag-system
docker compose up -dQdrant will be available at http://localhost:6333.
2. Install Python dependencies
uv syncThis creates a virtual environment and installs all dependencies including local embedding models.
3. Copy environment configuration
cp .env.example .envEdit .env if you need to change Qdrant URL, collection name, or model settings.
Ingesting Documents
Place PDF files in the documents/ directory (or reference them by path).
# Ingest a single file
uv run rag ingest ./documents/manual.pdf
# Ingest with a custom document ID
uv run rag ingest ./documents/manual.pdf --id product-manual
# Force re-ingestion (replaces existing version)
uv run rag ingest ./documents/manual.pdf --force
# Ingest all PDFs in a directory
uv run rag ingest-directory ./documents
# List indexed documents
uv run rag list
# Inspect a document's metadata and sample chunks
uv run rag inspect product-manual
# Delete a document
uv run rag delete product-manualEmbedding models (BAAI/bge-small-en-v1.5 for dense, Qdrant/bm25 for sparse) are downloaded on first use and cached locally.
MCP Server Configuration
Add the RAG MCP server to your agent's MCP configuration:
opencode (opencode.json or ~/.config/opencode/opencode.json)
{
"mcp": {
"servers": {
"rag-documentation": {
"type": "local",
"command": ["uv", "run", "--directory", "/absolute/path/to/rag-system", "rag-mcp"],
"enabled": true
}
}
}
}Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"rag-documentation": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/rag-system", "rag-mcp"]
}
}
}MCP Tools
The server exposes four read-only tools:
Tool | Description |
| Hybrid semantic + keyword search with page citations |
| Retrieve surrounding chunks for more context |
| List all indexed documents |
| Get metadata for a specific document |
Configuration
All settings are read from environment variables (or .env file):
Variable | Default | Description |
|
| Qdrant REST API URL |
|
| Qdrant collection name |
|
| Dense embedding model |
|
| Sparse/BM25 embedding model |
|
| Target tokens per chunk |
|
| Token overlap between chunks |
|
| Default results per search |
|
| Maximum results per search |
Development
# Run tests (unit tests run without Qdrant)
uv run pytest tests/unit
# Run all tests (requires Qdrant running)
docker compose up -d
uv run pytest
# Lint
uv run ruff check src tests
# Type check
uv run mypy srcHow Retrieval Works
Hybrid search: Dense vector search (semantic similarity) and sparse BM25 search (keyword matching) run in parallel against Qdrant.
Reciprocal Rank Fusion (RRF): Qdrant fuses dense and sparse results using RRF.
Citations: Every result includes the document title, section path, and page range.
Context expansion: The
get_document_contexttool retrieves neighboring chunks when a search result needs more surrounding text.
All processing is local. No document content is sent to external services.
This server cannot be deployed
Maintenance
Related MCP Connectors
- docs2mcpOAuthcom.docs2mcp
Query your own PDFs and documents from any MCP client. Every answer cites the page it came from.
Turn a GitHub repo or docs site into agent-ready context: pack it or search it, over MCP.
Agentic search over your Dewey document collections from any MCP-compatible client.
Read-only MCP tools for AI agent discovery, structured resources, and NIULAI information.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides tools for ingesting documents into a local vector database and retrieving relevant information via semantic search, enabling retrieval-augmented generation for MCP clients.7-
- FlicenseNot gradedqualityDmaintenanceIndexes PDF documents into Qdrant and exposes semantic search as MCP tools, enabling RAG-based interactions with your documents.-
- FlicenseNot gradedqualityCmaintenanceProvides read-only, citation-backed semantic search and retrieval-augmented generation over enterprise documents via standardized MCP tools, with local embeddings for privacy.-
- AlicenseAqualityAmaintenanceProvides read-only MCP tools for searching and asking over private documents via a local RAG service (reed), returning ranked passages with citations while keeping data on the machine.4Apache 2.0