Skip to main content
Glama
sourangshupal

MCP-RAG Server

MCP-RAG: RAG を使用したモデルコンテキストプロトコル 🚀

GroundX と OpenAI を使用し、Modern Context Processing (MCP) で構築された強力かつ効率的な RAG (Retrieval-Augmented Generation) 実装。

🌟 特徴

  • 高度なRAG実装:高精度の文書検索のためにGroundXを活用

  • モデルコンテキストプロトコル: MCPとのシームレスな統合により、コンテキスト処理が強化されます。

  • 型安全: 堅牢な型チェックと検証のためにPydanticで構築されています

  • 柔軟な構成:環境変数を通じて設定を簡単にカスタマイズできます

  • ドキュメント取り込み: PDFドキュメントの取り込みと処理のサポート

  • インテリジェント検索:スコアリング機能を備えたセマンティック検索機能

Related MCP server: MCP-RAG Server

🛠️ 前提条件

  • Python 3.12以上

  • OpenAI APIキー

  • GroundX APIキー

  • MCP CLIツール

📦 インストール

  1. リポジトリをクローンします。

git clone <repository-url>
cd mcp-rag
  1. 仮想環境を作成してアクティブ化します。

uv sync
source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`

⚙️ 構成

  1. サンプル環境ファイルをコピーします。

cp .env.example .env
  1. .envで環境変数を設定します。

GROUNDX_API_KEY="your-groundx-api-key"
OPENAI_API_KEY="your-openai-api-key"
BUCKET_ID="your-bucket-id"

🚀 使用方法

サーバーの起動

次を使用して検査サーバーを実行します。

mcp dev server.py

ドキュメントの取り込み

新しいドキュメントを取り込むには:

from server import ingest_documents

result = ingest_documents("path/to/your/document.pdf")
print(result)

検索の実行

基本的な検索クエリ:

from server import process_search_query

response = process_search_query("your search query here")
print(f"Query: {response.query}")
print(f"Score: {response.score}")
print(f"Result: {response.result}")

カスタム構成の場合:

from server import process_search_query, SearchConfig

config = SearchConfig(
    completion_model="gpt-4",
    bucket_id="custom-bucket-id"
)
response = process_search_query("your query", config)

📚 依存関係

  • groundx (≥2.3.0): コアRAG機能

  • openai (≥1.75.0): OpenAI API 統合

  • mcp[cli] (≥1.6.0): 最新のコンテキスト処理ツール

  • ipykernel (≥6.29.5): Jupyterノートブックのサポート

🔒 セキュリティ

  • APIキーを含む.envファイルをコミットしないでください

  • すべての機密情報に環境変数を使用する

  • APIキーを定期的にローテーションする

  • 不正アクセスがないかAPIの使用状況を監視する

🤝 貢献する

  1. リポジトリをフォークする

  2. 機能ブランチを作成します( git checkout -b feature/amazing-feature

  3. 変更をコミットします ( git commit -m 'Add some amazing feature' )

  4. ブランチにプッシュする ( git push origin feature/amazing-feature )

  5. プルリクエストを開く

-
security - not tested
F
license - not found
-
quality - not tested

Resources

Looking for Admin?

Admins can modify the Dockerfile, update the server description, and track usage metrics. If you are the server author, to access the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sourangshupal/mcp-rag'

If you have feedback or need assistance with the MCP directory API, please join our Discord server