local-rag-mcp-server
Integrates with a local Ollama instance to leverage embedding models and LLMs for offline document processing and retrieval-augmented generation (RAG).
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@local-rag-mcp-server登録したドキュメントから、有給休暇の申請ルールについて教えて"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 テキスト抽出 |
Related MCP server: KB-MCP Server
前提条件
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.pyMCPツール
add_document(file_path: str)
ファイルを RAG インデックスに追加します。
対応形式: .pdf / .txt / .mdsearch_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.mdClaude 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()環境変数
変数名 | デフォルト値 | 説明 |
|
| ChromaDB の保存先 |
|
| Embedding モデル名 |
|
| LLM モデル名 |
|
| ChromaDB コレクション名 |
|
| Ollama エンドポイント |
This server cannot be deployed
Maintenance
Related MCP Connectors
Ingest, manage, and retrieve documents for RAG-powered AI applications
Your private knowledge base: upload documents (.md, .txt, .docx, PDF, images), the platform indexes
Medical RAG: semantic search for clinical guidelines, drug interactions, diagnoses & EHR data.
Medical RAG: semantic search for clinical guidelines, drug interactions, diagnoses & EHR data.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceRAG-powered document search server that enables semantic search across large collections of legal and business documents (PDF, Word, Excel, PowerPoint) using local embeddings with no API costs.4MIT
- FlicenseAqualityNot gradedmaintenanceA local-first knowledge base server that enables AI clients to store, retrieve, and manage documents using semantic search. Provides privacy-focused, offline-capable memory for AI assistants with tools for ingesting, querying, updating, and deleting knowledge.712 npm-
- AlicenseNot gradedqualityDmaintenanceA local RAG server that enables document indexing and sentence window retrieval across multiple file formats like PDF, MD, and DOCX. It supports both local Hugging Face models and OpenAI embeddings for efficient context-aware querying through the Model Context Protocol.GPL 3.0
- AlicenseNot gradedqualityCmaintenanceA local Retrieval-Augmented Generation system that enables AI agents to query and retrieve information from document collections using ChromaDB vector search and Ollama LLMs through a FastAPI interface.126MIT