MCP RAG Server logo

MCP RAG Server

by karaage0703

MCP RAG Server is a Python server with RAG (Retrieval-Augmented Generation) functionality that complies with the Model Context Protocol (MCP). It indexes documents in multiple formats and retrieves relevant information using vector search.

View on GitHub

Last updated: N/A

What is MCP RAG Server?

MCP RAG Server is a Python-based server that provides RAG capabilities, adhering to the Model Context Protocol (MCP). It allows indexing of documents in various formats (Markdown, Text, PowerPoint, PDF) and retrieving relevant information based on natural language queries using vector search.

How to use MCP RAG Server?

To use the MCP RAG Server, first install the dependencies and set up PostgreSQL with the pgvector extension. Configure the environment variables in the .env file. Then, start the MCP server using uv run python -m src.main. Use the command-line tool (python -m src.cli) to index documents. Finally, interact with the server using JSON-RPC requests to the search and get_document_count methods.

Key features of MCP RAG Server

  • MCP server implementation with JSON-RPC over stdio

  • RAG functionality with multi-format document indexing

  • Uses multilingual-e5-large model for embeddings

  • Vector database using PostgreSQL with pgvector

  • Supports incremental indexing for efficient updates

  • Provides tools for vector search and document count

Use cases of MCP RAG Server

  • Question answering system using indexed documents

  • Information retrieval from a knowledge base

  • Integrating RAG capabilities into AI tools like Cline/Cursor

  • Building a search engine for local documents

  • Creating a chatbot with access to a document repository

FAQ from MCP RAG Server

What document formats are supported?

The server supports Markdown, Text, PowerPoint, and PDF files.

What embedding model is used?

The multilingual-e5-large model is used for generating embeddings.

What is the database used for vector storage?

PostgreSQL with the pgvector extension is used as the vector database.

How do I perform a backup and restore?

You can back up the PostgreSQL database using pg_dump and restore it using pg_restore. Optionally, you can also back up the processed documents and environment configuration.

How do I index new or changed files?

Use the incremental indexing feature with the -i or --incremental flag when running the index command.