AA

alejandro-ao/simple-mcp-rag

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

6 stars 9 forks Качество 63 Тренд 14

Simple MCP Server for RAG

Обзор

A MCP server built with FastMCP 1 and ChromaDB 2 that provides MCP (Model Context Protocol) tools for ingesting documents into a local vector database and retrieving relevant information based on queries. - : Search for relevant documents using semantic similarity - : View all files currently stored in the database - : Reingest all files from the data directory (useful to reindex contents when new files are added) - : Get comprehensive system information including server status, database configuration, data directory status, and environment variables - : Generate structured prompts for analyzing documents on specific topics The server supports flexible configuration for both data and database directories through environment variables: 1. LLAMA_RAG_DATA_DIR environment variable (highest priority) 2. ./data in current working directory (workspace-relative) 3.

README

Показан фрагмент оригинального README. Открыть оригинал.

RAG MCP Server

A Retrieval Augmented Generation (RAG) MCP server built with FastMCP 1 and ChromaDB 2 that provides MCP (Model Context Protocol) tools for ingesting documents into a local vector database and retrieving relevant information based on queries.

Features

🔧 Tools

  • query_documents: Search for relevant documents using semantic similarity
  • list_ingested_files: View all files currently stored in the database
  • reingest_data_directory: Reingest all files from the data directory (useful to reindex contents when new files are added)
  • get_rag_status: Get comprehensive system information including server status, database configuration, data directory status, and environment variables

📊 Resources

  • None currently available

💬 Prompts

  • rag_analysis_prompt: Generate structured prompts for analyzing documents on specific topics

Quick Start

1. Installation

# Install dependencies
pip install -r requirements.txt

# Or install manually
pip install fastmcp chromadb sentence-transformers

2. Run the Server

# Start the MCP server
python rag_server.py

# Or use FastMCP CLI for development with inspector
fastmcp dev rag_server.py

3. Test the Server

# Run the test suite
python test_rag_server.py

Directory Configuration

The server supports flexible configuration for both data and database directories through environment variables:

Data Directory Configuration:

Priority Order:

  1. LLAMA_RAG_DATA_DIR environment variable (highest priority)
  2. ./data in current working directory (workspace-relative)
  3. Error: If neither is found, the server will log an error and skip auto-ingestion

Important: Unlike the database directory, the data directory requires explicit configuration. If no data directory is found, the server will:

  • Log a clear error message with setup instructions
  • Skip auto-ingestion (server will still start successfully)
  • Require manual configuration before documents can be ingested

Database Directory Configuration:

Priority Order:

  1. LLAMA_RAG_DB_DIR environment variable (highest priority)
  2. ~/.local/share/rag-server (XDG Base Directory standard)
  3. ./chroma relative to current working directory (fallback)

Usage Examples:

# Using environment variable (recommended)
export LLAMA_RAG_DATA_DIR=/path/to/your/documents
python rag_server.py

# Using current directory data folder
mkdir data
cp your_documents/* data/
python rag_server.py

# Error case - no configuration
# Server starts but logs: "No data directory found. Please either..."
python rag_server.py

# Use custom database directory only
Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "rag-server": { "command": "python", "args": ["/path/to/your/rag_server.py"], "cwd": "/path/to/your/mcp-rag" } } }