Docs RAG MCP server

Enables AI to query and analyze local documents and Git repositories through a RAG system built with TypeScript, LlamaIndex, and Gemini embeddings.
Back to servers
Provider
kazuph
Release date
Mar 09, 2025
Language
TypeScript
Stats
4 stars

This MCP server enables retrieval-augmented generation (RAG) for documents stored locally, allowing you to query your documents using LLMs with context from locally stored repositories and text files.

Installation

Prerequisites

  • Node.js and npm installed
  • A Google Gemini API key (obtainable from Google AI Studio)

Setting Up Document Storage

By default, the server uses ~/docs for document storage, but you can configure a different location:

export DOCS_PATH=/path/to/your/docs

Configure API Keys

Set your Gemini API key as an environment variable:

export GEMINI_API_KEY=your-api-key-here

Installation with Claude Desktop

Add the server configuration to your Claude Desktop config file:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "docs-rag": {
      "command": "npx",
      "args": ["-y", "@kazuph/mcp-docs-rag"],
      "env": {
        "DOCS_PATH": "/Users/username/docs",
        "GEMINI_API_KEY": "your-api-key-here"
      }
    }
  }
}

Make sure to replace /Users/username/docs with your actual documents directory path and add your Gemini API key.

Usage

Once installed, you can interact with the server through Claude to manage and query your documents.

Adding Documents

Add a Git Repository

Basic usage:

Add a new document from GitHub: https://github.com/username/repository

With custom document name:

Add GitHub repository https://github.com/username/repository-name and name it 'framework'

With sparse checkout (specific directories only):

Add only the 'src/components' directory from https://github.com/username/repository

Combining custom name and sparse checkout:

Add the 'examples/demo' directory from https://github.com/username/large-repo and name it 'demo-app'

Add a Text File

Add this text file: https://example.com/document.txt

Querying Documents

Ask questions about your documents:

What does the documentation say about X in the Y repository?

The server will use RAG to retrieve relevant information from your documents and generate accurate responses with appropriate context.

Listing Available Documents

To see what documents are available:

What documents do you have access to?

Document Structure

The documents directory can contain:

  • Git repositories (cloned directories)
  • Plain text files (with .txt extension)

Each document is indexed separately using llama-index.ts with Google's Gemini embeddings for efficient retrieval.

Available Tools

The server provides several tools:

  • list_documents: Lists all available documents in the directory
  • rag_query: Queries documents using RAG with document_id and query parameters
  • add_git_repository: Clones a Git repository to the docs directory
  • add_text_file: Downloads a text file to the docs directory

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later