fayna-rag-mcp
Officialfayna-rag-mcp — RAGとMCPによるローカル知識ベース
開発:Fayna Digital 著者:Volodymyr Shevchenko
問題: チームはドキュメント(ポリシー、マニュアル、メモ)をファイルとして蓄積しているが、自然言語でのアクセスがすぐにできなくなる——ファイル名検索やCtrl+Fではスケールせず、内部ドキュメントをクラウドのLLMサービスに送信することはプライバシーの観点から必ずしも許容できない。
解決策: ローカルLLM(Ollama)をベースとしたローカルRAGパイプライン(FAISS + 多言語埋め込み)——そして同じ検索/QA機能を MCPサーバー として公開し、任意のMCPクライアント(Claude Desktop/Codeなど)や外部の自動化ワークフローがシンプルなRESTルート経由で利用できるようにする。実行中のマシンからデータが外部に出ることはない。
結果: セマンティック検索、ソース付きRAG QA、ドキュメント読み取り、オフラインカタログ化のための5つのMCPツールと4つのRESTルート——クラウド依存なしで、数分でClaudeやn8nに接続できる。
機能
ツール(MCP) | 用途 |
| データベースからのファイル全体の読み取り( |
| 全ドキュメントの一覧( |
| FAISSによるセマンティック検索 → 関連性の高いチャンク |
| RAG回答:FAISS取得 + Ollama LLM、ソース付き |
| ドキュメントタグの読み取り専用カタログ(トピック/タイプ/言語/対象者) |
RESTルート | Body | 処理内容 |
|
| FAISS取得 → |
|
| RAG回答 → |
|
| コーパス内の |
|
| ハイブリッド:キリル↔ラテン文字の翻字 + トークンマッチ、セマンティクスによる選定 |
Related MCP server: OpenLMlib
技術スタック
Python 3.10+ ・ FAISS(faiss-cpu) ・ sentence-transformers ・ tiktoken ・
Ollama ・ FastMCP ・ マルチフォーマット取り込み用のTesseract/poppler/Whisper ・
Docker。
RAGパイプライン
docs/ → load (.txt/.md/.pdf/.docx) → chunk (tiktoken) → embed (mpnet) → FAISS → retrieve → Ollama → answer + sourcesチャンク分割 — 文字数ではなく
tiktoken(cl100k_base)のトークン数で分割。 デフォルトはCHUNK_SIZE=700トークン、CHUNK_OVERLAP=100トークン。埋め込み:
paraphrase-multilingual-mpnet-base-v2— 多言語モデル (UA/PL/EN/RUなど)。クエリの言語に関係なく検索が機能するようにする。LLM: 任意のOllamaモデル、デフォルトは
qwen2.5:7b。インデックス: FAISS
IndexFlatIP(コサイン類似度)、TOP_K=5。
クイックスタート
pip install -r src/requirements.txt
# Przykład: demo-korpus na kilka dokumentów (sample-docs/)
export DOCUMENTS_DIR=./sample-docs
python -m src.main build-index # → src/index/index.faiss + chunks.pkl
# Interaktywne Q&A (CLI)
python -m src.main
# Serwer MCP (transport z env MCP_TRANSPORT: stdio|http)
python -m src.mcp.serverテスト:
pip install -r tests/requirements-dev.txt
pytest -qDocker
docker compose up -ddocker-compose.yml/Dockerfile のデフォルト値は、ホスト上で動作するOllama(host.docker.internal 経由)を想定して設計されています。OLLAMA_URL はご自身のネットワークに合わせて調整してください(Linuxのブリッジアドレス、別のOllamaコンテナなど)。
設定(src/config.py、すべてenv経由)
Env | デフォルト | 説明 |
|
| 知識ベースのルート |
|
| 埋め込みモデル |
|
| RAG回答用のLLM |
|
| Ollamaのエンドポイント |
|
| トークン数( |
|
| 取得が返すチャンク数 |
|
|
|
|
|
|
MCPクライアント(例:Claude Code)への接続 — MCPサーバー設定を通じて、python -m src.mcp.server(stdio)またはコンテナのURL(http)を使用。
構成
src/
├── config.py # wszystkie env-zmienne + domyślne
├── main.py # CLI: build-index | interaktywne Q&A
├── assistant.py # CompanyKBAssistant (LLM decyduje czy wołać MCP-toolki)
├── catalog.py # offline-klasyfikacja dokumentów przez Ollama → JSON+HTML
├── ingest.py # multi-formatowy ingest: OCR skanów, vision-opis diagramów, Whisper-transkrypcja
├── rag/
│ ├── ingest.py # load_document (.txt/.md/.pdf/.docx)
│ ├── chunk.py # chunk_text (tiktoken cl100k_base, overlap)
│ ├── embed.py # embed_chunks (sentence-transformers)
│ ├── build_index.py # build_index → FAISS + pickle
│ └── query.py # retrieve / build_prompt / ask
└── mcp/
├── server.py # FastMCP: 5 MCP-toolków + 4 trasy REST
└── client.py # MCPClient (JSON-RPC przez subprocess)マルチフォーマット取り込み(TesseractによるスキャンOCR、ビジョンモデルによる図面/図表の説明、Whisperによる音声/動画の文字起こし)— 依存関係が重い別のパスであり、上記の基本テキストコーパスには不要です。
ライセンス
MIT — LICENSE を参照。© Fayna Digital。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceA headless local knowledge library and RAG substrate that enables LLM clients to search, retrieve chunks, and list documentation packs through read-only MCP tools.MIT
- AlicenseNot gradedqualityAmaintenanceProvides AI assistants with a local knowledge base and research library, enabling semantic and full-text retrieval, memory persistence, and multi-agent collaboration via 58 MCP tools.2MIT
- AlicenseNot gradedqualityDmaintenanceA knowledge base MCP server backed by Qdrant vector database with local embeddings for semantic search and document management.51ISC
- FlicenseNot gradedqualityCmaintenanceEnables users to build and query a private knowledge base by uploading documents, which are embedded and stored locally, then accessible via MCP for semantic search and retrieval.
Related MCP Connectors
Your memory, everywhere AI goes. Build knowledge once, access it via MCP anywhere.
Shared, governed long-term memory for AI agents across tools and sessions via MCP and REST.
Private-by-default, local-first memory/context/task orchestrator for MCP apps and agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/fayna-digital/fayna-rag-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server