A Model Context Protocol (MCP) server for file-based Retrieval-Augmented Generation (RAG) search.
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.
- Text file-based RAG search
- MCP (Model Context Protocol) support
- Embedding-based document retrieval
- Real-time document processing
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
- Node.js 18.0.0 or higher
- npm or yarn package manager
npm install -g file-rag-mcp
- Clone the repository
git clone [repository-url]
cd file-rag-mcp
- Install dependencies
./install.sh
# or
npm install
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
RAG_ALLOWED_DIRECTORIES=/path/to/documents npx file-rag-mcp
RAG_ALLOWED_DIRECTORIES=/path/to/documents file-rag-mcp
# Set environment variable
export RAG_ALLOWED_DIRECTORIES=/path/to/documents
# Then start the server
npm start
{
"mcpServers": {
"file-rag-mcp": {
"command": "npx",
"args": [
"file-rag-mcp"
],
"env": {
"RAG_ALLOWED_DIRECTORIES": "/path/to/documents,/another/path"
}
}
}
}
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
- @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
Distributed under the MIT License. See LICENSE file for more information.
Lee Jong Yun
- RAG (Retrieval-Augmented Generation)
- MCP (Model Context Protocol)
- Search
- AI
- LLM (Large Language Model)
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
If you encounter any issues or have suggestions, please create an issue in the repository.