hybrid-rag-mcp-server

hybrid-rag-mcp-server

Enables natural language search over PDF documents using vector search, allowing MCP clients like Claude Desktop to query PDF content.

Category
Visit Server

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

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