MCP RAG Server

by sylphlab

373 downloads Not rated yet MIT license
GitHub

About

# MCP RAG Server <!-- Badges --> [![NPM Version](https://img.shields.io/npm/v/@sylphlab/mcp-rag-server.svg)](https://www.npmjs.com/package/@sylphlab/mcp-rag-server) [![License](https://img.shields.io/npm/l/@sylphlab/mcp-rag-server.svg)](LICENSE) [![CI…

Details

License
MIT license

Explore

- Automatic Indexing: Scans the project directory on startup (configurable) and indexes supported files.
- Supported File Types: .txt, .md, code files (via generic splitting), .json, .jsonl, .csv. (Code file chunking is basic).
- Hierarchical Chunking: Intelligently chunks Markdown files, separating text and code blocks.
- Vector Storage: Uses ChromaDB for persistent vector storage.
- Local Embeddings: Leverages Ollama for local embedding generation (default: nomic-embed-text).
- MCP Tools: Exposes RAG functions as standard MCP tools:
- indexDocuments: Manually index a file or directory.
- queryDocuments: Retrieve relevant document chunks for a query.
- removeDocument: Remove a specific document's chunks by source path.
- removeAllDocuments: Clear the entire index for the current project.
- listDocuments: List indexed document source paths.
- Dockerized: Includes a docker-compose.yml for easy setup of the server, ChromaDB, and Ollama.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP RAG Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

(Provide a minimal runnable example here, assuming Docker setup is complete)


This method runs the server and its dependencies (ChromaDB, Ollama) in isolated containers.

1. Prerequisites:

- Install Docker Desktop or Docker Engine.
- Ensure port 8000 (ChromaDB) and 11434 (Ollama) are free on your host machine, or adjust ports in docker-compose.yml.

2. Clone the Repository:

    git clone https://github.com/sylphlab/rag-server-mcp.git
    cd mcp-rag-server
    

3. Start Services:

    docker-compose up -d --build
    

- This builds the server image, downloads ChromaDB and Ollama images, and starts the services.
- The first run might take time to download images and build.

4. Pull Embedding Model (First Run):
The default embedding model (nomic-embed-text) needs to be pulled into the Ollama container _after_ it starts.

    docker exec ollama ollama pull nomic-embed-text
    

- Wait a few moments after docker-compose up before running this. You only need to do this once as the model will be persisted in a Docker volume.

5. Integration with MCP Client:
Configure your MCP client (e.g., in VS Code settings or another MCP server) to connect to this server. Since it's running via Docker Compose, you typically don't run it via npx directly in the client config. Instead, the client needs to know how to communicate with the running server (which isn't directly exposed by default in this setup, usually communication happens via other means like direct API calls if the server exposed an HTTP interface, or via shared volumes/databases if applicable).

Note: The current setup primarily facilitates RAG via Genkit flows _within_ this project or potentially other services within the same Docker network. Direct MCP client integration from an external host requires exposing the server's MCP port from the Docker container.

Configure the server via environment variables, typically set within the docker-compose.yml file for the rag-server service:

- CHROMA_URL: URL of the ChromaDB service. (Default in compose: http://chromadb:8000)
- OLLAMA_HOST: URL of the Ollama service. (Default in compose: http://ollama:11434)
- INDEX_PROJECT_ON_STARTUP: Set to true (default) or false to enable/disable automatic indexing on server start.
- INDEXING_EXCLUDE_PATTERNS: Comma-separated list of glob patterns to exclude from indexing (e.g., /node_modules/,/.git/). Defaults are defined in autoIndexer.ts.
- GENKIT_ENV: Set to production or development (influences logging, etc.).
- LOG_LEVEL: Set log level (e.g., debug, info, warn, error).

_(See docker-compose.yml and src/config/genkit.ts for more details)_

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp rag server": {
            "rag-server-mcp-sylphlab": {
                "command": "docker",
                "args": [
                    "exec",
                    "ollama",
                    "ollama",
                    "pull",
                    "nomic-embed-text"
                ]
            }
        }
    }
}

McpServers

{
    "rag-server-mcp-sylphlab": {
        "command": "docker",
        "args": [
            "exec",
            "ollama",
            "ollama",
            "pull",
            "nomic-embed-text"
        ]
    }
}

<!-- Badges -->

NPM Version
License
CI Status

<!-- Coverage Status --> <!-- TODO: Add coverage badge once setup -->

mcp-rag-server is a Model Context Protocol (MCP) server that enables Retrieval Augmented Generation (RAG) capabilities for connected LLMs. It indexes documents from your project and provides relevant context to enhance LLM responses.

Built with Google Genkit, ChromaDB, and Ollama.

Quick Start

(Provide a minimal runnable example here, assuming Docker setup is complete)

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.