local-rag-mcp-server

local-rag-mcp-server

A fully offline local RAG server that utilizes ChromaDB and Ollama to index and query PDF, text, and Markdown documents. It allows users to manage local knowledge bases and perform semantic searches with AI-generated responses.

Category
Visit Server

README

local-rag-mcp-server

RAG処理・LLM推論をローカル完結させた MCP サーバーです。 ChromaDB + Ollama(nomic-embed-text / qwen3.5:9b)を使い、PDF・txt・md ファイルを登録して質問に回答します。

注意: Claude Desktop 経由で使用する場合、ユーザーの質問と RAG 検索結果が Anthropic API に送信されます。 機密情報を扱う場合は Open WebUI + Ollama による完全オフライン構成を推奨します。

構成

コンポーネント 役割
FastMCP MCP サーバーフレームワーク
ChromaDB ベクトル DB(ローカル永続化)
nomic-embed-text Embedding モデル(Ollama)
qwen3.5:9b LLM(Ollama、think=False)
PyMuPDF PDF テキスト抽出

前提条件

  • Python 3.10 以上
  • Ollama がローカルで起動していること
  • 以下のモデルが pull 済みであること
ollama pull nomic-embed-text
ollama pull qwen3.5:9b

セットアップ

# 1. リポジトリのルートに移動
cd C:\Users\pcuser\Documents\project\local-rag-mcp-server

# 2. .env ファイルを作成
cp .env.example .env

# 3. 仮想環境を有効化(作成済み)
.venv\Scripts\activate

# 4. サーバーを起動(動作確認)
python server.py

MCPツール

add_document(file_path: str)

ファイルを RAG インデックスに追加します。

対応形式: .pdf / .txt / .md

search_documents(query: str)

質問に対して RAG 検索を行い、qwen3.5:9b で回答を生成します。

list_documents()

登録済みドキュメントの一覧(ファイル名・チャンク数・パス)を返します。

ディレクトリ構成

local-rag-mcp-server/
├── server.py           # MCP サーバー本体
├── requirements.txt    # 依存パッケージ
├── .env.example        # 環境変数テンプレート
├── .env                # 環境変数(自分で作成)
├── .venv/              # 仮想環境
├── chroma_db/          # ChromaDB データ(自動生成)
├── docs/               # ドキュメント格納フォルダ
└── README.md

Claude Desktop への設定

claude_desktop_config.json に以下を追加してください。

場所: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "local-rag": {
      "command": "C:\\Users\\pcuser\\Documents\\project\\local-rag-mcp-server\\.venv\\Scripts\\python.exe",
      "args": [
        "C:\\Users\\pcuser\\Documents\\project\\local-rag-mcp-server\\server.py"
      ],
      "env": {
        "CHROMA_DB_PATH": "C:\\Users\\pcuser\\Documents\\project\\local-rag-mcp-server\\chroma_db",
        "EMBED_MODEL": "nomic-embed-text",
        "LLM_MODEL": "qwen3.5:9b",
        "OLLAMA_HOST": "http://localhost:11434"
      }
    }
  }
}

設定後、Claude Desktop を再起動すると local-rag サーバーが認識されます。

使用例

# ドキュメントを登録
add_document("C:/Users/pcuser/Documents/project/local-rag-mcp-server/docs/manual.pdf")

# 質問して回答を得る
search_documents("有給休暇の申請方法を教えてください")

# 登録済みドキュメントを確認
list_documents()

環境変数

変数名 デフォルト値 説明
CHROMA_DB_PATH ./chroma_db ChromaDB の保存先
EMBED_MODEL nomic-embed-text Embedding モデル名
LLM_MODEL qwen3.5:9b LLM モデル名
COLLECTION_NAME documents ChromaDB コレクション名
OLLAMA_HOST http://localhost:11434 Ollama エンドポイント

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured