THE RAG MCP

THE RAG MCP

An enterprise-ready MCP server that exposes a RAG tool for retrieving relevant context and metadata from a Qdrant vector database using natural language queries.

Category
Visit Server

README

THE RAG MCP

An enterprise-ready Model Context Protocol (MCP) server that exposes a Retrieval-Augmented Generation (RAG) tool. This server enables MCP-compatible clients (such as Claude Desktop or custom agents) to retrieve relevant context and source metadata from a Qdrant vector database using natural language queries.


🏗️ System Architecture & Features

This server runs as a standalone MCP host exposing a single tool: rag_tool.

graph TD
    A[MCP Client / Claude Desktop] -->|Call rag_tool| B[Lazy-Init Qdrant Retriever]
    B -->|Semantic Similarity Search| C[(Qdrant Vector Database)]
    C -->|Return Context Chunks| B
    B -->|Respond Context + Metadata| A
  • Lazy Initialization: Postpones connections to the Qdrant database and the embedding provider until the first request is received. This allows the server to boot instantly and survive transient network or database outages during startup.
  • Standardized Integration: Conforms to the MCP standard via FastMCP, allowing instant integration into LLM platforms like Claude Desktop.
  • Robust Exception Containment: Captures configuration errors and connectivity issues, returning clean error responses to the caller instead of crashing the server.

⚙️ Environment Configuration

The server reads configuration options from the environment or a local .env file:

Environment Variable Type Default Description
QDRANT_URL URL Required Absolute connection endpoint for the Qdrant database cluster.
QDRANT_API_KEY String Required Authentication token for your Qdrant instance.
QDRANT_COLLECTION_NAME String "RAG" Target database collection for vectors.
EMBEDDING_MODEL_NAME String Required Model identifier for generating query embeddings.
BASE_URL_FOR_EMBEDDING_MODEL URL Required Endpoint base URL for the OpenAI-compatible embedding API.
OPENAI_API_KEY String Optional API key for the embedding model provider.

🚀 Getting Started

Prerequisites

Ensure you have uv installed (a fast Python package installer and resolver).

Running the Server

You can launch the server using uv to automatically handle dependencies:

# Start the MCP server over HTTP transport
uv run main.py

🔌 Connecting to Claude Desktop

To register this server in Claude Desktop, append its configuration to your claude_desktop_config.json:

Under Windows

{
  "mcpServers": {
    "the-rag-mcp": {
      "command": "uv",
      "args": ["run", "--path", "C:/Users/sj282/SJ/the_rag_mcp", "main.py"],
      "env": {
        "QDRANT_URL": "https://...",
        "QDRANT_API_KEY": "...",
        "QDRANT_COLLECTION_NAME": "RAG",
        "EMBEDDING_MODEL_NAME": "Qwen/Qwen3-Embedding-4B",
        "BASE_URL_FOR_EMBEDDING_MODEL": "https://api.siliconflow.com/v1",
        "OPENAI_API_KEY": "..."
      }
    }
  }
}

Under Linux/macOS

{
  "mcpServers": {
    "the-rag-mcp": {
      "command": "uv",
      "args": ["run", "--path", "/mnt/c/Users/sj282/SJ/the_rag_mcp", "main.py"],
      "env": {
        "QDRANT_URL": "https://...",
        "QDRANT_API_KEY": "...",
        "QDRANT_COLLECTION_NAME": "RAG",
        "EMBEDDING_MODEL_NAME": "Qwen/Qwen3-Embedding-4B",
        "BASE_URL_FOR_EMBEDDING_MODEL": "https://api.siliconflow.com/v1",
        "OPENAI_API_KEY": "..."
      }
    }
  }
}

🧠 Smart Retrieval Behavior

Once connected, the host LLM client will call the rag_tool tool when it determines that search context from the document library is required to fulfill a prompt.

Query Best Practices

  • Do: Ask detailed, context-rich questions (e.g. "What are the primary differences between fine-tuning and retrieval-augmented generation?").
  • Avoid: Simple keyword searches (e.g. "fine-tuning"), as semantic search models perform significantly better on complete thoughts and natural language queries.

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