mcp-rag-server

MCP.Pizza Chef: karaage0703

mcp-rag-server is a Python-based MCP server implementing Retrieval-Augmented Generation (RAG) capabilities. It indexes multiple document formats including markdown, text, PowerPoint, and PDF using the multilingual-e5-large model for embedding generation. It supports vector search via PostgreSQL pgvector, enabling retrieval of relevant information based on natural language queries. Features include hierarchical source directory support, markdown conversion from presentations and PDFs, chunked context retrieval, full document access, and differential indexing for efficient updates. It operates over JSON-RPC and includes tools for vector search, document count, and index management.

Use This MCP server To

Index and search multilingual documents in markdown, text, PowerPoint, and PDF formats Retrieve relevant document sections using vector similarity search Maintain up-to-date indexes with differential indexing of changed files Access full document content for comprehensive context Integrate RAG capabilities into MCP-based AI workflows Manage vector search indexes via CLI tools Provide context-aware document retrieval for LLMs

README

MCP RAG Server

MCP RAG Serverは、Model Context Protocol (MCP)に準拠したRAG(Retrieval-Augmented Generation)機能を持つPythonサーバーです。マークダウン、テキスト、パワーポイント、PDFなど複数の形式のドキュメントをデータソースとして、multilingual-e5-largeモデルを使用してインデックス化し、ベクトル検索によって関連情報を取得する機能を提供します。

概要

このプロジェクトは、MCPサーバーの基本的な実装に加えて、RAG機能を提供します。複数形式のドキュメントをインデックス化し、自然言語クエリに基づいて関連情報を検索することができます。

機能

  • MCPサーバーの基本実装

    • JSON-RPC over stdioベースで動作
    • ツールの登録と実行のためのメカニズム
    • エラーハンドリングとロギング
  • RAG機能

    • 複数形式のドキュメント(マークダウン、テキスト、パワーポイント、PDF)の読み込みと解析
    • 階層構造を持つソースディレクトリに対応
    • markitdownライブラリを使用したパワーポイントやPDFからのマークダウン変換
    • multilingual-e5-largeモデルを使用したエンベディング生成
    • PostgreSQLのpgvectorを使用したベクトルデータベース
    • ベクトル検索による関連情報の取得
    • 前後のチャンク取得機能(コンテキストの連続性を確保)
    • ドキュメント全文取得機能(完全なコンテキストを提供)
    • 差分インデックス化機能(新規・変更ファイルのみを処理)
  • ツール

    • ベクトル検索ツール(MCP)
    • ドキュメント数取得ツール(MCP)
    • インデックス管理ツール(CLI)

前提条件

  • Python 3.10以上
  • PostgreSQL 14以上(pgvectorエクステンション付き)

インストール

依存関係のインストール

# uvがインストールされていない場合は先にインストール
# pip install uv

# 依存関係のインストール
uv sync

mcp-rag-server FAQ

How does mcp-rag-server handle multiple document formats?
It supports markdown, text, PowerPoint, and PDF by converting them into markdown and indexing their content for vector search.
What embedding model does mcp-rag-server use?
It uses the multilingual-e5-large model to generate embeddings for diverse languages and document types.
How is vector search implemented in mcp-rag-server?
Vector search is powered by PostgreSQL with the pgvector extension, enabling efficient similarity queries.
Can mcp-rag-server update indexes incrementally?
Yes, it supports differential indexing to process only new or changed files, improving efficiency.
What protocols does mcp-rag-server use for communication?
It operates over JSON-RPC using stdio for tool registration, execution, error handling, and logging.
What tools are included with mcp-rag-server?
It includes vector search tools, document count tools, and CLI-based index management tools.
What are the system requirements for mcp-rag-server?
Requires Python 3.10+ and PostgreSQL 14+ with the pgvector extension installed.
How does mcp-rag-server ensure context continuity in retrieval?
It supports retrieving adjacent chunks of documents to maintain continuous context for queries.