fayna-rag-mcp
OfficialClick 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., "@fayna-rag-mcpWhat does our policy say about remote work?"
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.
{"type": "text"}# fayna-rag-mcp — local knowledge base with RAG and MCP
Developed by Fayna Digital Author: Volodymyr Shevchenko
Problem: the team collects documentation (policies, manuals, notes) in files and quickly loses natural-language access to it — searching by file name or Ctrl+F does not scale, and sending internal documents to a cloud LLM service is not always acceptable for privacy reasons.
Solution: a local RAG pipeline (FAISS + multilingual embeddings) based on a local LLM (Ollama) — and the same search/Q&A exposed as an MCP server, so any MCP client (Claude Desktop/Code, etc.) or an external automated workflow can use it via simple REST routes. No data leaves the machine it runs on.
Result: five MCP tools and four REST routes for semantic search, RAG Q&A with sources, document reading, and offline cataloging — ready to connect to Claude or n8n in minutes, with no cloud dependencies.
Features
Tool (MCP) | Purpose |
| read a full file from the database (with a path-traversal guard within |
| list all documents ( |
| FAISS semantic search → top-relevant chunks |
| RAG answer: FAISS-retrieve + Ollama LLM, with sources |
| read-only catalog of document tags (topic/type/language/audience) |
REST route | Body | What it does |
|
| FAISS-retrieve → |
|
| RAG answer → |
|
| exact substring search over |
|
| hybrid: Cyrillic↔Latin transliteration + token-match, semantic selection |
Related MCP server: Solarium
Stack
Python 3.10+ · FAISS (faiss-cpu) · sentence-transformers · tiktoken ·
Ollama · FastMCP · Tesseract/poppler/Whisper for multi-format ingest ·
Docker.
RAG Pipeline
docs/ → load (.txt/.md/.pdf/.docx) → chunk (tiktoken) → embed (mpnet) → FAISS → retrieve → Ollama → answer + sourcesChunking — by
tiktokentokens (cl100k_base), not characters. DefaultCHUNK_SIZE=700tokens,CHUNK_OVERLAP=100tokens.Embeddings:
paraphrase-multilingual-mpnet-base-v2— a multilingual model (UA/PL/EN/RU and others) so search works regardless of query language.LLM: any Ollama model, default
qwen2.5:7b.Index: FAISS
IndexFlatIP(cosine similarity),TOP_K=5.
Quick start
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.serverTests:
pip install -r tests/requirements-dev.txt
pytest -qDocker
docker compose up -dDefault values in docker-compose.yml/Dockerfile are designed for Ollama running on the host (via host.docker.internal); adjust OLLAMA_URL to your own network (bridge address on Linux, separate Ollama container, etc.).
Configuration (src/config.py, everything via env)
Env | Default | Description |
|
| knowledge base root |
|
| embedding model |
|
| LLM for RAG answers |
|
| Ollama endpoint |
|
| tokens ( |
|
| how many chunks retrieve returns |
|
|
|
|
| address when |
Connecting to an MCP client (e.g., Claude Code) — via its MCP server configuration, with the command python -m src.mcp.server (stdio) or the container URL (http).
Structure
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)Multi-format ingest (OCR of scans via Tesseract, description of drawings/diagrams via a vision model, audio/video transcription via Whisper) — a separate, dependency-heavier path, not needed for the basic text corpus above.
License
MIT — see LICENSE. © Fayna Digital.
This server cannot be deployed
Maintenance
Related MCP Connectors
Self-hosted AI-native knowledge workspace with hybrid search, GraphRAG, and MCP.
Personal knowledge base MCP server with semantic search, auto-categorization, metadata extraction
Make your knowledge agent-ready. One MCP endpoint, 5 connectors, 3 search modes.
The knowledge base your AI reads and writes, under your rules — over MCP, EU-hosted.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA 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 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.-
- FlicenseNot gradedqualityCmaintenanceEnables local document question-answering and retrieval via MCP, supporting multi-turn conversation, intent recognition, and tools for document search, Q&A, and summarization.5-