home / mcp / mcp rag server

MCP RAG Server

Provides live RAG capabilities by connecting to a vector store and exposing MCP endpoints for automatic context retrieval.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "0xrdan-mcp-rag-server": {
      "command": "node",
      "args": [
        "/path/to/mcp-rag-server/dist/server.js"
      ],
      "env": {
        "CHROMA_URL": "http://localhost:8000",
        "OPENAI_API_KEY": "YOUR_OPENAI_API_KEY",
        "CHROMA_COLLECTION": "my_knowledge_base"
      }
    }
  }
}

You can run an MCP RAG Server that exposes a ready-to-use retrieval-augmented generation (RAG) workflow to Claude Code and any MCP client. It connects your vector store, handles embedding, hybrid search, and document indexing, so you fetch live knowledge from your own data sources without manual context pasting.

How to use

Use the MCP RAG Server as a standard MCP endpoint that plugs into your client. Once running, your MCP client can index documents, run hybrid searches, and query your knowledge base to retrieve relevant context automatically. Typical workflows include indexing internal documents, querying for architectural details, and retrieving up-to-date information from your vector store to augment prompts.

How to install

# Prerequisites
- Install Node.js (recommended LTS)
- Ensure you have access to a ChromaDB instance or run the provided Docker image

# Start ChromaDB (example)
docker run -p 8000:8000 chromadb/chroma

# Set embedding API key (OpenAI used for embeddings)
export OPENAI_API_KEY="sk-..."
```

```
# Clone the project
git clone https://github.com/0xrdan/mcp-rag-server.git
cd mcp-rag-server

# Install dependencies
npm install

# Build the server for distribution
npm run build

Configuration and usage notes

Configure Claude Code or another MCP client to connect to the local server. The example below shows how to point the client to run the server locally with the required environment variables and a local path to the built server file.

{
  "mcpServers": {
    "rag": {
      "command": "node",
      "args": ["/path/to/mcp-rag-server/dist/server.js"],
      "env": {
        "OPENAI_API_KEY": "sk-...",
        "CHROMA_URL": "http://localhost:8000",
        "CHROMA_COLLECTION": "my_knowledge_base"
      }
    }
  }
}

Available tools

rag_query

Query the knowledge base with hybrid search and return formatted context suitable for prompts.

rag_search

Perform a raw similarity search returning chunks with scores.

index_document

Add a single document to the knowledge base.

index_documents_batch

Index multiple documents in a batch.

delete_by_source

Delete all documents from a given source.

get_stats

Retrieve collection statistics like total chunks and documents.

clear_collection

Permanently clear all data in the collection (requires confirmation).

MCP RAG Server - 0xrdan/mcp-rag-server