file-rag-mcp

1.0.42 • Public • Published

File RAG MCP Server

A Model Context Protocol (MCP) server for file-based Retrieval-Augmented Generation (RAG) search.

Introduction

This project implements a RAG-based server for document and information retrieval. It integrates with AI models using the Model Context Protocol, providing efficient document search and information extraction capabilities.

Key Features

  • Text file-based RAG search
  • MCP (Model Context Protocol) support
  • Embedding-based document retrieval
  • Real-time document processing

Supported File Types

The server supports the following text-based file formats:

  • .txt (Text files)
  • .md (Markdown)
  • .json (JSON)
  • .js (JavaScript)
  • .ts (TypeScript)
  • .html (HTML)
  • .css (CSS)
  • .csv (CSV)
  • .xml (XML)
  • .yaml/.yml (YAML)
  • Other plain text files

System Requirements

  • Node.js 18.0.0 or higher
  • npm or yarn package manager

Installation

Global Installation (Recommended)

npm install -g file-rag-mcp

Local Installation

  1. Clone the repository
git clone [repository-url]
cd file-rag-mcp
  1. Install dependencies
./install.sh
# or
npm install

Usage

Environment Variables

The server requires the following environment variable:

  • RAG_ALLOWED_DIRECTORIES: Comma-separated list of directories to allow access to
    # Example
    export RAG_ALLOWED_DIRECTORIES=/path/to/dir1,/path/to/dir2

Using npx (No Installation Required)

RAG_ALLOWED_DIRECTORIES=/path/to/documents npx file-rag-mcp

After Global Installation

RAG_ALLOWED_DIRECTORIES=/path/to/documents file-rag-mcp

Local Development

# Set environment variable
export RAG_ALLOWED_DIRECTORIES=/path/to/documents

# Then start the server
npm start

MCP Configuration Example

{
  "mcpServers": {
    "file-rag-mcp": {
      "command": "npx",
      "args": [
        "file-rag-mcp"
      ],
      "env": {
        "RAG_ALLOWED_DIRECTORIES": "/path/to/documents,/another/path"
      }
    }
  }
}

Project Structure

file-rag-mcp/
├── file-rag-mcp.js     # Main server application
├── embedding-module.js  # Embedding processing module
├── install.sh          # Installation script
└── package.json        # Project configuration and dependencies

Dependencies

  • @modelcontextprotocol/sdk: ^1.8.0 - SDK for MCP integration
  • zod: ^3.24.2 - Schema validation
  • zod-to-json-schema: ^3.24.5 - Convert Zod schemas to JSON schemas

License

Distributed under the MIT License. See LICENSE file for more information.

Author

Lee Jong Yun

Keywords

  • RAG (Retrieval-Augmented Generation)
  • MCP (Model Context Protocol)
  • Search
  • AI
  • LLM (Large Language Model)

Contributing

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Support

If you encounter any issues or have suggestions, please create an issue in the repository.

Readme

Keywords

Package Sidebar

Install

npm i file-rag-mcp

Weekly Downloads

28

Version

1.0.42

License

MIT

Unpacked Size

28.3 kB

Total Files

4

Last publish

Collaborators

  • jylee08