RAG MCP Server
Exposes a Retrieval-Augmented Generation pipeline as MCP tools, allowing users to index documents and query them through any MCP-compatible client like Claude or IDEs.
README
RAG MCP Server
A FastMCP server that exposes a Retrieval-Augmented Generation (RAG) pipeline as MCP tools — so any MCP-compatible client (Claude, IDEs, agent frameworks) can index documents and answer questions over them through a standard protocol.
Stack
- MCP framework: FastMCP
- RAG orchestration: LlamaIndex
- Vector store: Qdrant
- Embeddings + LLM: NVIDIA NIM (
nv-embedqa-e5-v5,llama-3.1-8b-instruct)
How it works
Document ──▶ chunk (SentenceSplitter) ──▶ embed (NVIDIA) ──▶ upsert ──▶ Qdrant
│
User question ──▶ embed ──▶ similarity search ─────────────────────────────┘
│
▼
top-k chunks ──▶ LLM synthesis ──▶ answer
The server keeps an in-memory reference to the last-built index so repeated queries don't require re-embedding, while still supporting a fresh load from Qdrant if the process restarts.
Tools
| Tool | Description |
|---|---|
index_document(file_path) |
Loads a document, chunks it, embeds it, and upserts it into Qdrant. |
query_documents(question) |
Retrieves the most relevant chunks and synthesizes an answer via the LLM. |
Setup
-
Clone the repo and install dependencies:
git clone https://github.com/arbaz-builds/rag-mcp-server.git cd rag-mcp-server pip install -r requirements.txt -
Copy
.env.exampleto.envand fill in your credentials:cp .env.example .env -
Run the server:
python main.py
The server starts over HTTP transport on 0.0.0.0:$PORT (default 8000) — ready to deploy on Render, Railway, or any container platform.
Example usage (via an MCP client)
> index_document("./handbook.pdf")
Indexed './handbook.pdf' successfully (42 chunks).
> query_documents("What is the refund policy?")
Refunds are processed within 5–7 business days for requests made within 30 days of purchase.
Environment Variables
| Variable | Required | Description |
|---|---|---|
NVIDIA_API_KEY |
Yes | API key for NVIDIA embeddings + LLM |
QDRANT_URL |
Yes | Qdrant cluster URL |
QDRANT_API_KEY |
Yes | Qdrant API key |
QDRANT_COLLECTION_NAME |
Yes | Collection name in Qdrant — must match an existing collection, no default is applied |
PORT |
No (default: 8000) |
HTTP server port |
Deployment
Deployed with HTTP transport (host=0.0.0.0), making it compatible out of the box with Render, Railway, and other container-based hosts that inject a PORT environment variable.
License
MIT
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.