Easy MCP RAG

Easy MCP RAG

An MCP server for RAG using Qdrant that automatically indexes documents from directories and generates search tools for each collection.

Category
Visit Server

README

Easy MCP RAG ๐Ÿš€

A high-performance Model Context Protocol (MCP) server for RAG using Qdrant. Built for UV/UVX with CPU/GPU support and HTTP transport.

โœจ Features

  • ๐Ÿ” Automatic Document Indexing - Scan directories and index all documents
  • ๐Ÿ“ Smart Organization - Each subdirectory becomes its own searchable dataset
  • ๐Ÿ› ๏ธ Dynamic MCP Tools - Auto-generated tools for each collection
  • ๐Ÿ“„ Multi-Format Support - PDF, DOCX, CSV, XLSX, TXT, Markdown, and more
  • โšก GPU Acceleration - Optional CUDA/MPS support for faster embeddings
  • ๐ŸŒ HTTP Transport - Run as HTTP server or stdio
  • ๐Ÿ“ฆ UV/UVX Ready - Install and run with a single command
  • ๐Ÿ“Š Verbose Logging - Detailed query tracking and monitoring

๐Ÿš€ Quick Start

Install with UVX (Recommended)

Run directly from GitHub without installation:

uvx --from git+https://github.com/yourusername/easy_mcp_rag.git easy_mcp_rag --data-dir ./documents

Install with UV

# Install from GitHub
uv pip install git+https://github.com/yourusername/easy_mcp_rag.git

# Or clone and install locally
git clone https://github.com/yourusername/easy_mcp_rag.git
cd easy_mcp_rag
uv pip install -e .

๐Ÿ“‹ Prerequisites

  1. Start Qdrant (using Docker):
docker run -p 6333:6333 qdrant/qdrant
  1. Prepare your documents:
documents/
โ”œโ”€โ”€ legal_docs/
โ”‚   โ”œโ”€โ”€ contract.pdf
โ”‚   โ””โ”€โ”€ terms.docx
โ”œโ”€โ”€ research/
โ”‚   โ”œโ”€โ”€ paper1.pdf
โ”‚   โ””โ”€โ”€ notes.txt
โ””โ”€โ”€ data/
    โ””โ”€โ”€ analysis.csv

๐Ÿ’ป Usage

Basic Usage (stdio)

# With UVX
uvx --from git+https://github.com/yourusername/easy_mcp_rag.git easy_mcp_rag --data-dir ./documents

# With UV
uv run easy_mcp_rag --data-dir ./documents

# After installation
easy_mcp_rag --data-dir ./documents

HTTP Mode

easy_mcp_rag --data-dir ./documents --transport http --http-port 8000

GPU Acceleration

# Auto-detect GPU
easy_mcp_rag --data-dir ./documents --device auto

# Force CUDA (NVIDIA GPU)
easy_mcp_rag --data-dir ./documents --device cuda

# Force MPS (Apple Silicon)
easy_mcp_rag --data-dir ./documents --device mps

# Force CPU
easy_mcp_rag --data-dir ./documents --device cpu

Advanced Configuration

easy_mcp_rag \
  --data-dir ./documents \
  --qdrant-host localhost \
  --qdrant-port 6333 \
  --device cuda \
  --embedding-model all-mpnet-base-v2 \
  --chunk-size 1024 \
  --chunk-overlap 100 \
  --top-k 10 \
  --batch-size 64 \
  --verbose \
  --force-reindex

๐Ÿ”ง Configuration Options

Flag Description Default
--data-dir Directory with document subdirectories Required
--qdrant-host Qdrant server host localhost
--qdrant-port Qdrant server port 6333
--device Device: auto, cpu, cuda, mps auto
--transport Transport type: stdio, http stdio
--http-host HTTP server host 0.0.0.0
--http-port HTTP server port 8000
--embedding-model Sentence transformer model all-MiniLM-L6-v2
--chunk-size Text chunk size (chars) 512
--chunk-overlap Chunk overlap (chars) 50
--top-k Results per search 5
--batch-size Embedding batch size 32
--verbose Enable verbose logging False
--log-level Log level INFO
--force-reindex Force reindex all docs False

๐ŸŽฏ MCP Client Configuration

Claude Desktop / Cline / Other MCP Clients

Add to your MCP client config:

{
  "mcpServers": {
    "rag-server": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/yourusername/easy_mcp_rag.git",
        "easy_mcp_rag",
        "--data-dir",
        "/path/to/your/documents",
        "--device",
        "auto",
        "--verbose"
      ]
    }
  }
}

With HTTP Transport

{
  "mcpServers": {
    "rag-server": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/yourusername/easy_mcp_rag.git",
        "easy_mcp_rag",
        "--data-dir",
        "/path/to/your/documents",
        "--transport",
        "http",
        "--http-port",
        "8000"
      ]
    }
  }
}

๐Ÿ› ๏ธ How It Works

  1. Scan - Discovers all subdirectories in your data directory
  2. Load - Extracts text from all supported file types
  3. Chunk - Splits documents into overlapping chunks
  4. Embed - Generates vector embeddings (CPU or GPU)
  5. Index - Stores in Qdrant (one collection per subdirectory)
  6. Serve - Creates MCP tools for each collection

Example

documents/
โ”œโ”€โ”€ legal_docs/      โ†’ Creates "legal_docs_search" tool
โ”œโ”€โ”€ research/        โ†’ Creates "research_search" tool
โ””โ”€โ”€ data/            โ†’ Creates "data_search" tool

๐Ÿ“„ Supported File Types

Category Extensions
Text .txt, .md, .py, .js, .json, .xml, .html, .css
PDF .pdf
Word .docx, .doc
Spreadsheet .csv, .xlsx, .xls

๐ŸŽจ Embedding Models

Choose based on your needs:

Model Dimensions Speed Quality Use Case
all-MiniLM-L6-v2 384 โšกโšกโšก Good Default, fast
all-MiniLM-L12-v2 384 โšกโšก Better Balanced
all-mpnet-base-v2 768 โšก Best Quality

๐Ÿ› Troubleshooting

Qdrant Connection Failed

# Check if Qdrant is running
curl http://localhost:6333

# Start Qdrant
docker run -p 6333:6333 qdrant/qdrant

GPU Not Detected

# Check PyTorch GPU support
python -c "import torch; print(torch.cuda.is_available())"

# Install with GPU support
uv pip install -e ".[gpu]"

Out of Memory

# Use smaller model
--embedding-model all-MiniLM-L6-v2

# Reduce batch size
--batch-size 16

# Use CPU
--device cpu

๐Ÿ“Š Logging

Enable verbose logging to see detailed information:

easy_mcp_rag --data-dir ./documents --verbose

Output includes:

  • โœ… Tool access events
  • ๐Ÿ” Query details
  • ๐Ÿ“ˆ Result counts
  • ๐ŸŽฏ Relevance scores
  • ๐Ÿ“ Source files

Example:

2024-01-20 10:30:15 - easy_mcp_rag.server - INFO - Tool accessed: legal_docs_search
2024-01-20 10:30:15 - easy_mcp_rag.server - INFO - Query: contract terms
2024-01-20 10:30:15 - easy_mcp_rag.server - INFO - Results returned: 5
2024-01-20 10:30:15 - easy_mcp_rag.server - DEBUG - Result 1: score=0.8542

๐Ÿ” Security Notes

  • HTTP mode exposes the server on the network
  • Use --http-host 127.0.0.1 for local-only access
  • Consider authentication for production deployments

๐Ÿ“ Development

# Clone repository
git clone https://github.com/yourusername/easy_mcp_rag.git
cd easy_mcp_rag

# Install with dev dependencies
uv pip install -e ".[dev]"

# Run tests
pytest

# Format code
black src/

# Lint
ruff src/

๐Ÿค Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

๐Ÿ“œ License

MIT License - see LICENSE file

๐Ÿ™ Credits

Built with:

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured