hybrid-rag-mcp-server
Enables natural language search over PDF documents using vector search, allowing MCP clients like Claude Desktop to query PDF content.
README
hybrid-rag-mcp-server
hybrid-rag-pdf-jp をラップした MCP(Model Context Protocol)サーバーです。 Claude Desktop などの MCP 対応クライアントから、PDF への自然言語検索をツールとして利用できます。
アーキテクチャ
Claude Desktop (MCP クライアント)
│ MCP (stdio)
▼
server.py(FastMCP)
│ import
▼
hybrid-rag-pdf-jp/rag.py
│ load_vectorstore()
▼
ChromaDB(ローカル永続化)
│ 類似チャンク検索 (k=4)
▼
nomic-embed-text(Ollama)
提供ツール
| ツール名 | 引数 | 説明 |
|---|---|---|
search_pdf |
query: str |
PDF 内をベクトル検索し、上位 4 チャンクを返す |
get_pdf_info |
なし | ChromaDB の登録チャンク数・ソースファイル情報を返す |
前提条件
- Python 3.11 以上
- Ollama が起動済みで
nomic-embed-textがインストール済み hybrid-rag-pdf-jpのchroma_db/が構築済み(python rag.pyを一度実行済み)- Anthropic API キーを取得済み
- Node.js v18以上(MCP Inspector使用時のみ必要) https://nodejs.org/en/download から Prebuilt Installer をインストール
ollama pull nomic-embed-text
セットアップ手順
1. リポジトリのクローン(または配置確認)
project/
├── hybrid-rag-pdf-jp/ ← 既存プロジェクト(chroma_db 構築済み)
└── hybrid-rag-mcp-server/ ← 本プロジェクト
2. 環境変数の設定
cp .env.example .env
# .env を編集して ANTHROPIC_API_KEY を設定
.env の内容:
ANTHROPIC_API_KEY=your_key_here
CHROMA_DB_PATH=../hybrid-rag-pdf-jp/chroma_db
RAG_PROJECT_PATH=../hybrid-rag-pdf-jp
3. 依存パッケージのインストール
pip install -e .
4. 動作確認
python server.py
MCP Inspector を使ったデバッグ:
mcp dev server.py
Claude Desktop への登録方法
claude_desktop_config.json に以下を追記します。
設定ファイルの場所:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"hybrid-rag-pdf-jp": {
"command": "python",
"args": [
"C:\\Users\\pcuser\\Documents\\project\\hybrid-rag-mcp-server\\server.py"
],
"env": {
"ANTHROPIC_API_KEY": "your_key_here",
"CHROMA_DB_PATH": "C:\\Users\\pcuser\\Documents\\project\\hybrid-rag-pdf-jp\\chroma_db",
"RAG_PROJECT_PATH": "C:\\Users\\pcuser\\Documents\\project\\hybrid-rag-pdf-jp"
}
}
}
}
設定後、Claude Desktop を再起動してください。
使い方
Claude Desktop でツールが有効になると、以下のような自然言語で PDF を検索できます。
「FXのリスク管理について教えて」
→ search_pdf("FXのリスク管理") が呼ばれ、PDF の関連箇所を返す
「登録されているPDFの情報を教えて」
→ get_pdf_info() が呼ばれ、チャンク数やファイル名を返す
ライセンス
MIT
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.