knowledge-rag 4.8.4__tar.gz → 4.9.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- knowledge_rag-4.9.0/PKG-INFO +787 -0
- knowledge_rag-4.9.0/README.md +739 -0
- knowledge_rag-4.9.0/bench/dashboard/README.md +80 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/config.example.yaml +18 -2
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/__init__.py +1 -1
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/config.py +52 -47
- knowledge_rag-4.9.0/mcp_server/health.py +124 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/ingestion.py +281 -12
- knowledge_rag-4.9.0/mcp_server/logging_config.py +186 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/server.py +218 -38
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/npm/README.md +1 -1
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/pyproject.toml +1 -1
- knowledge_rag-4.9.0/skills/README.md +201 -0
- knowledge_rag-4.8.4/PKG-INFO +0 -1955
- knowledge_rag-4.8.4/README.md +0 -1907
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/.gitignore +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/LICENSE +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/fts5_index.py +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/guarded.py +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/instance_lock.py +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/metrics.py +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/preflight.py +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/query_router.py +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/ratelimit.py +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/mcp_server/security.py +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/presets/cybersecurity.yaml +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/presets/developer.yaml +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/presets/general.yaml +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/presets/multilingual.yaml +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/presets/research.yaml +0 -0
- {knowledge_rag-4.8.4 → knowledge_rag-4.9.0}/requirements.txt +0 -0
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: knowledge-rag
|
|
3
|
+
Version: 4.9.0
|
|
4
|
+
Summary: Local RAG System for Claude Code — Hybrid search + Cross-encoder Reranking + 13 MCP Tools + 20 Format Parsers. Zero external servers.
|
|
5
|
+
Project-URL: Homepage, https://github.com/lyonzin/knowledge-rag
|
|
6
|
+
Project-URL: Repository, https://github.com/lyonzin/knowledge-rag
|
|
7
|
+
Project-URL: Issues, https://github.com/lyonzin/knowledge-rag/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/lyonzin/knowledge-rag/releases
|
|
9
|
+
Author-email: "Lyon." <lyonzin@users.noreply.github.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: bm25,chromadb,claude-code,embeddings,fastembed,hybrid-search,knowledge-base,local-ai,mcp,rag,reranking,retrieval-augmented-generation,semantic-search
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: beautifulsoup4>=4.12.0
|
|
24
|
+
Requires-Dist: chromadb>=1.4.0
|
|
25
|
+
Requires-Dist: fastembed[reranking]>=0.4.0
|
|
26
|
+
Requires-Dist: mcp<3.0.0,>=2.0.0
|
|
27
|
+
Requires-Dist: numpy>=1.24.0
|
|
28
|
+
Requires-Dist: openpyxl>=3.1.0
|
|
29
|
+
Requires-Dist: pymupdf>=1.23.0
|
|
30
|
+
Requires-Dist: python-docx>=1.0.0
|
|
31
|
+
Requires-Dist: python-pptx>=1.0.0
|
|
32
|
+
Requires-Dist: pyyaml>=6.0
|
|
33
|
+
Requires-Dist: requests>=2.33.0
|
|
34
|
+
Requires-Dist: watchdog>=4.0.0
|
|
35
|
+
Provides-Extra: gpu
|
|
36
|
+
Requires-Dist: nvidia-cublas-cu12; extra == 'gpu'
|
|
37
|
+
Requires-Dist: nvidia-cuda-runtime-cu12; extra == 'gpu'
|
|
38
|
+
Requires-Dist: nvidia-cudnn-cu12; extra == 'gpu'
|
|
39
|
+
Requires-Dist: nvidia-cufft-cu12; extra == 'gpu'
|
|
40
|
+
Requires-Dist: nvidia-curand-cu12; extra == 'gpu'
|
|
41
|
+
Requires-Dist: nvidia-cusolver-cu12; extra == 'gpu'
|
|
42
|
+
Requires-Dist: nvidia-cusparse-cu12; extra == 'gpu'
|
|
43
|
+
Requires-Dist: nvidia-nvjitlink-cu12; extra == 'gpu'
|
|
44
|
+
Requires-Dist: onnxruntime-gpu>=1.14.0; extra == 'gpu'
|
|
45
|
+
Provides-Extra: server
|
|
46
|
+
Requires-Dist: uvicorn>=0.20.0; extra == 'server'
|
|
47
|
+
Description-Content-Type: text/markdown
|
|
48
|
+
|
|
49
|
+
<!--
|
|
50
|
+
knowledge-rag — Local RAG server for Claude Code, Cursor, Windsurf and other MCP clients.
|
|
51
|
+
SEO keywords: local rag, mcp server, self-hosted rag, hybrid search, cross-encoder reranking, claude code rag, cursor rag, python rag, chromadb rag, fastembed rag, air-gapped rag, gdpr rag, retrieval augmented generation, model context protocol server, zero cloud rag.
|
|
52
|
+
|
|
53
|
+
Structured data (schema.org SoftwareApplication) — indexed by search engines, invisible on GitHub render:
|
|
54
|
+
{
|
|
55
|
+
"@context": "https://schema.org",
|
|
56
|
+
"@type": "SoftwareApplication",
|
|
57
|
+
"name": "knowledge-rag",
|
|
58
|
+
"applicationCategory": "DeveloperApplication",
|
|
59
|
+
"operatingSystem": "Windows, Linux, macOS",
|
|
60
|
+
"description": "Local-first RAG server for AI agents. Hybrid search, MCP-native, zero cloud, enterprise-grade plumbing (bearer auth, Prometheus metrics, rate limiting, health probes, structured JSON logging, zero-downtime reindex).",
|
|
61
|
+
"offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" },
|
|
62
|
+
"license": "https://opensource.org/licenses/MIT",
|
|
63
|
+
"downloadUrl": "https://pypi.org/project/knowledge-rag/",
|
|
64
|
+
"codeRepository": "https://github.com/lyonzin/knowledge-rag",
|
|
65
|
+
"programmingLanguage": "Python",
|
|
66
|
+
"runtimePlatform": "Python 3.11+"
|
|
67
|
+
}
|
|
68
|
+
-->
|
|
69
|
+
|
|
70
|
+
<p align="center">
|
|
71
|
+
<img
|
|
72
|
+
src="./assets/knowledge-rag-banner.png"
|
|
73
|
+
alt="knowledge-rag — Local Hybrid RAG for MCP"
|
|
74
|
+
width="100%"
|
|
75
|
+
/>
|
|
76
|
+
</p>
|
|
77
|
+
|
|
78
|
+
# knowledge-rag
|
|
79
|
+
|
|
80
|
+
<div align="center">
|
|
81
|
+
|
|
82
|
+
[](https://pypi.org/project/knowledge-rag/)
|
|
83
|
+
[](https://www.npmjs.com/package/knowledge-rag)
|
|
84
|
+
[](https://pepy.tech/projects/knowledge-rag)
|
|
85
|
+

|
|
86
|
+

|
|
87
|
+

|
|
88
|
+

|
|
89
|
+
[](https://github.com/lyonzin/knowledge-rag/actions/workflows/ci.yml)
|
|
90
|
+
[](https://github.com/lyonzin/knowledge-rag/actions/workflows/security.yml)
|
|
91
|
+
[](https://github.com/lyonzin/knowledge-rag/actions/workflows/quality-gate.yml)
|
|
92
|
+
[](https://glama.ai/mcp/servers/lyonzin/knowledge-rag)
|
|
93
|
+
[](https://bestpractices.coreinfrastructure.org/projects/13864)
|
|
94
|
+
|
|
95
|
+
### The MCP-first local RAG server for Claude Code, Cursor, and every AI agent.
|
|
96
|
+
|
|
97
|
+
**Hybrid search · Cross-encoder reranking · 35 file formats · 100% local · Zero cloud · Enterprise-grade plumbing built-in.**
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install knowledge-rag → restart Claude Code → search_knowledge("your query")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
[Quick Start](#quick-start-3-minutes-from-zero-to-your-first-query) ·
|
|
104
|
+
[Why knowledge-rag](#why-knowledge-rag) ·
|
|
105
|
+
[Compare](#how-knowledge-rag-compares-to-other-rag-frameworks) ·
|
|
106
|
+
[Enterprise Features](#enterprise-features-built-in-zero-configuration) ·
|
|
107
|
+
[Docs](#documentation)
|
|
108
|
+
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## ⭐ Star History
|
|
114
|
+
|
|
115
|
+
<div align="center">
|
|
116
|
+
|
|
117
|
+
<a href="https://www.star-history.com/?repos=lyonzin%2Fknowledge-rag&type=date&legend=top-left">
|
|
118
|
+
<img alt="knowledge-rag star history chart — GitHub star growth over time" src="./docs/star-history.svg" width="720" />
|
|
119
|
+
</a>
|
|
120
|
+
|
|
121
|
+
<sub>Chart updated daily by <a href="./.github/workflows/update-star-history.yml">GitHub Action</a></sub>
|
|
122
|
+
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 🎯 Why knowledge-rag
|
|
128
|
+
|
|
129
|
+
Most RAG frameworks fall into one of three traps: (1) they require you to ship your data to a cloud API, (2) they hand you 300 building blocks and 0 opinionated defaults, or (3) they bundle RAG as a 5% feature of a much bigger platform you didn't ask for.
|
|
130
|
+
|
|
131
|
+
**knowledge-rag does one thing well:** it is the MCP-native local RAG server that Claude Code, Cursor, Windsurf, VS Code, Cline, Gemini CLI and Zed can search out of the box — with enterprise plumbing (bearer auth, Prometheus metrics, rate limiting, health probes, structured JSON logging, zero-downtime reindex) that no other RAG-focused OSS ships built-in.
|
|
132
|
+
|
|
133
|
+
<table>
|
|
134
|
+
<tr>
|
|
135
|
+
<td width="50%" valign="top">
|
|
136
|
+
|
|
137
|
+
### 🔒 100% local, 0% cloud
|
|
138
|
+
Your files never leave the machine. No vendor lock-in, no data-residency headache, no forced cloud dependency. **LGPD / GDPR / HIPAA compliant by architecture** — because there is nothing to comply about when nothing leaves.
|
|
139
|
+
|
|
140
|
+
</td>
|
|
141
|
+
<td width="50%" valign="top">
|
|
142
|
+
|
|
143
|
+
### 🚀 Zero-friction setup
|
|
144
|
+
`pip install knowledge-rag` → restart your MCP client → done. **No Docker mandatory. No Ollama required. No separate embedding server.** Everything runs in-process via FastEmbed ONNX. **Works offline** after the first model download.
|
|
145
|
+
|
|
146
|
+
</td>
|
|
147
|
+
</tr>
|
|
148
|
+
<tr>
|
|
149
|
+
<td width="50%" valign="top">
|
|
150
|
+
|
|
151
|
+
### 🛡️ Production-grade OSS
|
|
152
|
+
7-pillar quality gate on every PR (**35+ automated checks**), 9-cell OS×Python CI matrix (Linux + Windows + macOS × 3.11/3.12/3.13), nightly chaos + 50K-iteration soak + mutation testing. **700+ tests. 0 known regressions.**
|
|
153
|
+
|
|
154
|
+
</td>
|
|
155
|
+
<td width="50%" valign="top">
|
|
156
|
+
|
|
157
|
+
### 💰 Zero ongoing cost
|
|
158
|
+
No token bills. No SaaS tier. No paid features hidden behind a wall. **MIT license, forever.** Runs on the laptop you already have — GPU optional, CPU works fine with FastEmbed ONNX.
|
|
159
|
+
|
|
160
|
+
</td>
|
|
161
|
+
</tr>
|
|
162
|
+
</table>
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 📊 How knowledge-rag compares to other RAG frameworks
|
|
167
|
+
|
|
168
|
+
We audited **16 popular RAG frameworks and platforms** (LlamaIndex, LangChain, ChromaDB, Weaviate, Qdrant, RAGFlow, LightRAG, DSPy, GraphRAG, Haystack, RAG-Anything, kotaemon, txtai, llmware, Dify, open-webui, FastGPT) so you can pick honestly.
|
|
169
|
+
|
|
170
|
+
**Legend:** ✅ built-in · 🟡 plugin / paid tier / partial · ❌ not available · ⚠️ license or default concern
|
|
171
|
+
|
|
172
|
+
| Dimension | 🎯 **knowledge-rag** | LlamaIndex | LangChain | Haystack | RAGFlow | txtai | open-webui | Dify | Qdrant |
|
|
173
|
+
|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|:---:|
|
|
174
|
+
| **100% local, zero cloud** | ✅ | 🟡 | ✅ | 🟡 | 🟡 | ✅ | ✅ | 🟡 | 🟡 |
|
|
175
|
+
| **MCP native (Claude/Cursor)** | ✅ 13 tools | 🟡 pkg | 🟡 adapter | 🟡 wrapper | 🟡 add-on | ✅ | ✅ consumer | ✅ | ❌ |
|
|
176
|
+
| **Hybrid BM25 + semantic** | ✅ 128× faster | 🟡 | 🟡 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
177
|
+
| **Cross-encoder rerank** | ✅ builtin | ❌ | 🟡 | ✅ | ✅ fused | ❌ | ✅ | 🟡 | 🟡 |
|
|
178
|
+
| **Bearer auth builtin** | ✅ | ❌ | ❌ | ❌ core | ❌ | 🟡 | ✅ RBAC | ✅ OAuth2 | ✅ |
|
|
179
|
+
| **Prometheus `/metrics`** | ✅ | ❌ | ❌ | ❌ core | ❌ | ❌ | ✅ OTel | ❌ | ✅ |
|
|
180
|
+
| **Rate limiting** | ✅ sliding-window | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ |
|
|
181
|
+
| **Health probes** (`/health`) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | 🟡 | 🟡 | ✅ |
|
|
182
|
+
| **Structured JSON logging** | ✅ opt-in | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ OTel | 🟡 | ✅ |
|
|
183
|
+
| **Zero-downtime reindex** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ |
|
|
184
|
+
| **Async background reindex** | ✅ + polling | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | 🟡 |
|
|
185
|
+
| **GPU CUDA optional** | ✅ 12 auto | ❌ | 🟡 | ✅ | ✅ | ✅ | ✅ | 🟡 | 🟡 |
|
|
186
|
+
| **File formats builtin** | ✅ **20** | 0 (LlamaParse=$) | 50+ plugins | ✅ **36+** | 8+ | ? | ? | ~10 | ❌ |
|
|
187
|
+
| **Setup < 5 min POC** | ✅ pip 1-liner | ✅ | ✅ | ✅ | ❌ 16GB RAM | ✅ | ✅ docker | ✅ docker | ✅ |
|
|
188
|
+
| **Nightly chaos + soak + mutation** | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ | ❌ |
|
|
189
|
+
| **License** | ✅ MIT | MIT | MIT | Apache-2.0 | Apache-2.0 | Apache-2.0 | ⚠️ preserving | ⚠️ restrictive | Apache-2.0 |
|
|
190
|
+
|
|
191
|
+
> **The 5 dimensions where knowledge-rag is unique:** health probes + JSON logging + Prometheus + rate limit + bearer auth **simultaneously built-in on an OSS RAG-focused MCP server**. Zero-downtime reindex + async background reindex + nightly chaos/soak/mutation are documented on nobody else's README.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## 🚀 Quick Start (3 minutes, from zero to your first query)
|
|
196
|
+
|
|
197
|
+
Pick your integration path — knowledge-rag ships the same server through every channel.
|
|
198
|
+
|
|
199
|
+
### Path 1 — Claude Code, Cursor, Windsurf, Cline, VS Code, Gemini CLI, Zed (MCP)
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
pip install knowledge-rag
|
|
203
|
+
knowledge-rag init # scaffolds config.yaml + documents/
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Drop your PDFs, markdown, code files into `documents/`. Restart your MCP client. Ask it:
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
search_knowledge("your query")
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
That's it. First query loads the ONNX embedding model (~200MB, one-off download). Subsequent queries are cached and hit sub-second latency.
|
|
213
|
+
|
|
214
|
+
### Path 2 — HTTP / SSE server (multi-user, air-gapped, load-balanced)
|
|
215
|
+
|
|
216
|
+
```yaml
|
|
217
|
+
# config.yaml
|
|
218
|
+
server:
|
|
219
|
+
transport: "sse" # or "streamable-http"
|
|
220
|
+
host: "0.0.0.0"
|
|
221
|
+
port: 8179
|
|
222
|
+
auth:
|
|
223
|
+
bearer_token: "your-secret-token"
|
|
224
|
+
rate_limit:
|
|
225
|
+
enabled: true
|
|
226
|
+
requests_per_minute: 60
|
|
227
|
+
metrics:
|
|
228
|
+
enabled: true
|
|
229
|
+
port: 9179
|
|
230
|
+
logging:
|
|
231
|
+
format: "json" # ELK / Loki / Datadog / CloudWatch ready
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
knowledge-rag --transport sse
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
- Health probe: `curl http://your-host:8179/health` → 200 + JSON payload
|
|
239
|
+
- Prometheus scrape: `http://your-host:9179/metrics`
|
|
240
|
+
- MCP dispatcher: authenticated via `Authorization: Bearer your-secret-token`
|
|
241
|
+
|
|
242
|
+
### Path 3 — Docker (models pre-downloaded, air-gapped ready)
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
docker pull ghcr.io/lyonzin/knowledge-rag:latest
|
|
246
|
+
docker run -v $(pwd)/documents:/app/documents -p 8179:8179 ghcr.io/lyonzin/knowledge-rag:latest
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Full installation guide with all 5 methods, 8 MCP client configurations, and GPU setup:** [docs/INSTALLATION.md →](docs/INSTALLATION.md)
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## 🤖 Ready-to-use skills for AI agents
|
|
254
|
+
|
|
255
|
+
Installing knowledge-rag gives your agent 13 MCP tools. It does not tell the agent **when** to use them. That is what the [`skills/`](skills/) folder solves — drop-in behavioural skills for Claude Code, Cursor, Windsurf, Cline, Zed, VS Code Copilot that turn "AI with access to RAG" into "AI that actually uses RAG first".
|
|
256
|
+
|
|
257
|
+
**10 skills, MIT licensed, organized by kind:**
|
|
258
|
+
|
|
259
|
+
| # | Skill | What it does |
|
|
260
|
+
|---|---|---|
|
|
261
|
+
| 1 | [`rag-check-first`](skills/foundation/rag-check-first/SKILL.md) | Search the corpus **before** answering any technical claim |
|
|
262
|
+
| 2 | [`rag-cite-sources`](skills/foundation/rag-cite-sources/SKILL.md) | Every claim ships with `path:line` citations |
|
|
263
|
+
| 3 | [`rag-onboard-context`](skills/foundation/rag-onboard-context/SKILL.md) | First interaction of a session probes what is indexed |
|
|
264
|
+
| 4 | [`rag-deep-dive`](skills/workflow/rag-deep-dive/SKILL.md) | 3-step drill: `search` → `fetch` → `find similar` |
|
|
265
|
+
| 5 | [`rag-web-fallback`](skills/workflow/rag-web-fallback/SKILL.md) | Only hit the web when local RAG comes back empty |
|
|
266
|
+
| 6 | [`rag-troubleshoot`](skills/workflow/rag-troubleshoot/SKILL.md) | Bug / error → RAG first for prior fixes |
|
|
267
|
+
| 7 | [`rag-code-review`](skills/workflow/rag-code-review/SKILL.md) | Review consults ADRs / patterns before commenting |
|
|
268
|
+
| 8 | [`rag-index-decisions`](skills/maintenance/rag-index-decisions/SKILL.md) | After a decision, index it back — close the feedback loop |
|
|
269
|
+
| 9 | [`rag-security-first`](skills/domain/rag-security-first/SKILL.md) | Security tasks: MITRE / CVE / runbook first |
|
|
270
|
+
| 10 | [`rag-evaluate-quality`](skills/maintenance/rag-evaluate-quality/SKILL.md) | Weekly checkup — MRR@5 · Recall@5 · Precision@5 |
|
|
271
|
+
|
|
272
|
+
**Install — pick the shortest path for your machine:**
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Option 1 — Via skills.sh (needs Node — one command, zero clone)
|
|
276
|
+
npx skills add lyonzin/knowledge-rag
|
|
277
|
+
|
|
278
|
+
# Option 2 — Via our install.sh (no Node needed; works on Linux/macOS/WSL/Git Bash)
|
|
279
|
+
curl -fsSL https://raw.githubusercontent.com/lyonzin/knowledge-rag/master/skills/install.sh | bash
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Both restart-Claude-Code and you are done. Option 2 supports `--project`, `--only rag-check-first,rag-cite-sources`, `--dry-run`, `--help`.
|
|
283
|
+
|
|
284
|
+
For Cursor, Windsurf, Cline and full manual instructions → [skills/README.md](skills/README.md) · Full catalog with skill chains → [skills/CATALOG.md](skills/CATALOG.md)
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## 🛠️ The 13 MCP tools your agent gets
|
|
289
|
+
|
|
290
|
+
Once installed, your AI agent gets these 13 tools automatically:
|
|
291
|
+
|
|
292
|
+
| Tool | Purpose |
|
|
293
|
+
|---|---|
|
|
294
|
+
| `search_knowledge` | Hybrid semantic + BM25 with cross-encoder rerank |
|
|
295
|
+
| `get_document` | Retrieve full content of one document |
|
|
296
|
+
| `search_similar` | Find documents similar to a reference |
|
|
297
|
+
| `evaluate_retrieval` | Measure MRR@5 · Recall@5 · Precision@5 |
|
|
298
|
+
| `add_document` | Index a new document via MCP |
|
|
299
|
+
| `update_document` | Re-index a changed document |
|
|
300
|
+
| `remove_document` | Drop a document + all its chunks |
|
|
301
|
+
| `add_from_url` | Fetch, sanitize, and index a URL |
|
|
302
|
+
| `list_documents` | Enumerate indexed documents |
|
|
303
|
+
| `list_categories` | Auto-tagged by folder path |
|
|
304
|
+
| `get_index_stats` | Corpus size, cache hit rate, embedding dim |
|
|
305
|
+
| `reindex_documents` | Smart incremental OR nuclear rebuild |
|
|
306
|
+
| `get_reindex_status` | Live progress polling (async reindex) |
|
|
307
|
+
|
|
308
|
+
**Full API reference with parameter details, return schemas, examples:** [docs/API.md →](docs/API.md)
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## 🏢 Enterprise Features (built-in, zero configuration)
|
|
313
|
+
|
|
314
|
+
Every RAG framework claims "production-ready." Here is what knowledge-rag ships **in the OSS core, verified by regression tests, that competitors either paywall, plugin-ify, or simply don't have.**
|
|
315
|
+
|
|
316
|
+
<table>
|
|
317
|
+
<tr>
|
|
318
|
+
<td valign="top" width="50%">
|
|
319
|
+
|
|
320
|
+
### Security
|
|
321
|
+
|
|
322
|
+
- **Bearer token auth** on SSE / HTTP transports — constant-time comparison (`hmac.compare_digest`), RFC 6750 challenge, 401 fenced with `WWW-Authenticate` header
|
|
323
|
+
- **Path traversal + symlink escape defenses** — `validate_path_within` guarding 6 CRUD tools (CWE-22, CWE-59)
|
|
324
|
+
- **Prompt injection 3-layer defense** — sentinel neutralization + provenance fence + `external_source` flag (OWASP LLM01:2025)
|
|
325
|
+
- **OpenSSF Best Practices badge** verified · **CodeQL** weekly scan · **Bandit + Semgrep + Gitleaks + pip-audit** on every PR
|
|
326
|
+
- **PyPI Trusted Publishing** via OIDC (zero long-lived tokens in CI)
|
|
327
|
+
|
|
328
|
+
</td>
|
|
329
|
+
<td valign="top" width="50%">
|
|
330
|
+
|
|
331
|
+
### Observability
|
|
332
|
+
|
|
333
|
+
- **Prometheus `/metrics` endpoint** — custom histogram buckets tuned for RAG (p95 ≤ 10ms fast-path targets), 7 canonical metrics via `@instrument` decorator on all 13 tools
|
|
334
|
+
- **Rate limiting** — thread-safe sliding-window counter, per-client RPM + burst, zero overhead when disabled
|
|
335
|
+
- **Health probes** — `GET /health` and `/healthz` returning `{status, version, uptime_seconds, cache}` in front of the auth middleware (probes always succeed)
|
|
336
|
+
- **Structured JSON logging** — opt-in via `server.logging.format: "json"`, one JSON object per record ready for ELK / Loki / Datadog / CloudWatch
|
|
337
|
+
- **Public benchmark dashboard** on GitHub Pages
|
|
338
|
+
|
|
339
|
+
</td>
|
|
340
|
+
</tr>
|
|
341
|
+
<tr>
|
|
342
|
+
<td valign="top" width="50%">
|
|
343
|
+
|
|
344
|
+
### Scale & performance
|
|
345
|
+
|
|
346
|
+
- **SSE / streamable-http transport** — 1 server serves N MCP clients, ChromaDB WAL mode enabled automatically, shared embedding model + query cache
|
|
347
|
+
- **BM25 inverted-index** — **128× faster** than linear scan (custom implementation, replaces `rank-bm25`)
|
|
348
|
+
- **FTS5 SQLite fast-path** (opt-in, ADR-002/003/006/008) — <10ms cold, <2ms hot on lexical queries
|
|
349
|
+
- **Cross-encoder reranking** — Xenova/ms-marco-MiniLM-L-6-v2, +1.88pp Recall@10 (p<0.001)
|
|
350
|
+
- **GPU CUDA 12** with auto DLL discovery + graceful CPU fallback
|
|
351
|
+
- **Query cache** — LRU + 5-min TTL, cuts p95 latency ~40%
|
|
352
|
+
- **Zero-downtime reindex** — staging populate + validation + atomic swap + durable metadata rollback
|
|
353
|
+
- **Async background reindex** with `get_reindex_status()` polling
|
|
354
|
+
|
|
355
|
+
</td>
|
|
356
|
+
<td valign="top" width="50%">
|
|
357
|
+
|
|
358
|
+
### Reliability
|
|
359
|
+
|
|
360
|
+
- **Nightly chaos injection** — HuggingFace Hub offline · ONNX zero-byte replay · watchdog crash recovery (3 scenarios in `tests/chaos/`)
|
|
361
|
+
- **50 000-iteration soak test** — proves no memory leak after 1h of continuous queries (`KNOWLEDGE_RAG_SOAK_ITERATIONS=50000`)
|
|
362
|
+
- **Mutation testing** (mutmut) on `instance_lock` + `preflight` — catches tests that are too weak
|
|
363
|
+
- **Determinism check** — full test suite × 3, catches flakes
|
|
364
|
+
- **Backwards-compat frozen** — 13 MCP tool parameter names guarded by `tests/test_backwards_compat.py` + legacy YAML fixtures (v3.6.0 / v3.7.0) still parse
|
|
365
|
+
- **API surface AST diff** — `check_api_surface.py` blocks any breaking change at PR time
|
|
366
|
+
- **9-cell CI matrix** — Linux + Windows + macOS × 3.11 + 3.12 + 3.13
|
|
367
|
+
|
|
368
|
+
</td>
|
|
369
|
+
</tr>
|
|
370
|
+
</table>
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## 💼 Use Cases (real corpora, real teams)
|
|
375
|
+
|
|
376
|
+
### Security Teams — Red / Blue / CTF
|
|
377
|
+
|
|
378
|
+
**Preset:** [`cybersecurity.yaml`](presets/cybersecurity.yaml) · 8 categories · 200+ routing keywords · 69 query expansions
|
|
379
|
+
|
|
380
|
+
Ingest MITRE ATT&CK, threat reports, exploit writeups, incident reports. Search from Claude Code with `search_knowledge("privilege escalation windows")` and get instant recall across your entire corpus. Air-gapped — nothing leaves the laptop.
|
|
381
|
+
|
|
382
|
+
### Development Teams — Design Docs, Runbooks, Code
|
|
383
|
+
|
|
384
|
+
**Preset:** [`developer.yaml`](presets/developer.yaml) · 9 categories · 150+ routing keywords · 50+ expansions
|
|
385
|
+
|
|
386
|
+
Replace Confluence hunting. Ingest architecture docs, ADRs, runbooks, code, API specs. Devs ask their AI agent "how do we authenticate the payment service" and get the exact ADR + implementation file citation.
|
|
387
|
+
|
|
388
|
+
### Research Labs — Papers, Notebooks, Datasets
|
|
389
|
+
|
|
390
|
+
**Preset:** [`research.yaml`](presets/research.yaml) · 9 categories · 100+ routing keywords · 40+ expansions
|
|
391
|
+
|
|
392
|
+
Index arXiv papers, lab notebooks, dataset documentation. Semantic search finds papers by intent, not just keywords — cross-encoder reranking surfaces the actually-relevant one instead of five that share a term.
|
|
393
|
+
|
|
394
|
+
### Enterprise Knowledge Base — Air-gapped, Auditable
|
|
395
|
+
|
|
396
|
+
**Preset:** [`general.yaml`](presets/general.yaml) · blank slate, pure semantic search
|
|
397
|
+
|
|
398
|
+
Deploy via SSE on a single VM. 40+ users authenticated via bearer token, rate-limited, Prometheus-monitored, `/health` probes wired to your load balancer, JSON logs shipped to Datadog. No cloud calls. Meets LGPD, GDPR, HIPAA data-locality requirements by design.
|
|
399
|
+
|
|
400
|
+
**Verified at scale:** production reproduction on a **5 889-doc / 75 016-chunk corpus** with concurrent queries during a nuclear rebuild — zero downtime, zero errors (see [CHANGELOG v4.8.3](CHANGELOG.md#v483-2026-08-10--critical-hotfix-nuclear-rebuild--smart-reindex-hardening)).
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
## 🏗️ Architecture at a glance
|
|
405
|
+
|
|
406
|
+
End-to-end view of how MCP clients, the retrieval pipeline, storage, and enterprise plumbing connect. Every arrow is a real code path — nothing pictured here is aspirational.
|
|
407
|
+
|
|
408
|
+
```mermaid
|
|
409
|
+
flowchart TB
|
|
410
|
+
subgraph CLIENTS["MCP Clients (any of these)"]
|
|
411
|
+
C1[Claude Code]
|
|
412
|
+
C2[Claude Desktop]
|
|
413
|
+
C3[Cursor]
|
|
414
|
+
C4[Windsurf]
|
|
415
|
+
C5[VS Code · Cline · Gemini CLI · Zed]
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
subgraph TRANSPORT["Transport Layer"]
|
|
419
|
+
T1[stdio<br/>1 process per client]
|
|
420
|
+
T2[SSE / streamable-http<br/>1 server serves N clients]
|
|
421
|
+
end
|
|
422
|
+
|
|
423
|
+
subgraph MIDDLEWARE["ASGI Middleware Chain (HTTP mode)"]
|
|
424
|
+
M1[HealthMiddleware<br/>/health · /healthz]
|
|
425
|
+
M2[BearerAuthMiddleware<br/>constant-time compare]
|
|
426
|
+
M3[Rate Limiter<br/>sliding window]
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
subgraph MCP["13 MCP Tools (frozen contract)"]
|
|
430
|
+
MT1[search_knowledge]
|
|
431
|
+
MT2[get_document · search_similar]
|
|
432
|
+
MT3[add_document · add_from_url · update · remove]
|
|
433
|
+
MT4[reindex_documents · get_reindex_status]
|
|
434
|
+
MT5[list_documents · list_categories · get_index_stats · evaluate_retrieval]
|
|
435
|
+
end
|
|
436
|
+
|
|
437
|
+
subgraph SEARCH["Retrieval Pipeline"]
|
|
438
|
+
R[Query Router<br/>lexical vs semantic]
|
|
439
|
+
F[FTS5 Fast-Path<br/>opt-in · lt 10ms]
|
|
440
|
+
BM[BM25 Inverted Index<br/>128x faster than baseline]
|
|
441
|
+
SE[Semantic Search<br/>FastEmbed ONNX lazy-loaded]
|
|
442
|
+
RRF[Reciprocal Rank Fusion]
|
|
443
|
+
CE[Cross-Encoder Rerank<br/>MiniLM-L-6-v2]
|
|
444
|
+
QC[Query Cache<br/>LRU + 5-min TTL]
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
subgraph STORAGE["Storage (100% local)"]
|
|
448
|
+
CH[ChromaDB<br/>vectors + metadata<br/>WAL mode]
|
|
449
|
+
FT[SQLite FTS5<br/>lexical index<br/>WAL + busy-timeout]
|
|
450
|
+
MD[index_metadata.json<br/>durable state]
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
subgraph INGEST["Document Ingestion"]
|
|
454
|
+
FS[documents/ folder]
|
|
455
|
+
WD[Watchdog<br/>10s debounce]
|
|
456
|
+
PA[35 Parsers<br/>MD · PDF · DOCX · code · IaC · IPYNB]
|
|
457
|
+
CK[Chunker<br/>markdown-aware · code-aware]
|
|
458
|
+
EM[FastEmbed ONNX<br/>384D bge-small-en-v1.5]
|
|
459
|
+
DD[SHA256 Dedup]
|
|
460
|
+
SW[Zero-downtime Staging Swap<br/>rollback on validation fail]
|
|
461
|
+
end
|
|
462
|
+
|
|
463
|
+
subgraph OBS["Enterprise Observability (opt-in)"]
|
|
464
|
+
PM[Prometheus /metrics<br/>7 canonical + histograms]
|
|
465
|
+
LG[Structured JSON logs<br/>ELK · Loki · Datadog · CloudWatch]
|
|
466
|
+
HC[Health payload<br/>version · uptime · cache stats]
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
subgraph CFG["Configuration"]
|
|
470
|
+
YM[config.yaml<br/>+ 5 domain presets]
|
|
471
|
+
end
|
|
472
|
+
|
|
473
|
+
C1 & C2 & C3 & C4 & C5 -->|MCP protocol| T1
|
|
474
|
+
C1 & C2 & C3 & C4 & C5 -.->|remote deploy| T2
|
|
475
|
+
T1 --> MCP
|
|
476
|
+
T2 --> M1 --> M2 --> M3 --> MCP
|
|
477
|
+
|
|
478
|
+
MT1 --> QC
|
|
479
|
+
QC -->|cache miss| R
|
|
480
|
+
R -->|lexical| F
|
|
481
|
+
R -->|semantic| SE
|
|
482
|
+
R -->|hybrid| BM
|
|
483
|
+
F --> CH
|
|
484
|
+
F --> FT
|
|
485
|
+
BM --> CH
|
|
486
|
+
SE --> CH
|
|
487
|
+
BM --> RRF
|
|
488
|
+
SE --> RRF
|
|
489
|
+
RRF --> CE
|
|
490
|
+
CE --> QC
|
|
491
|
+
|
|
492
|
+
MT2 --> CH
|
|
493
|
+
MT3 --> INGEST
|
|
494
|
+
MT4 --> SW
|
|
495
|
+
MT5 --> CH
|
|
496
|
+
|
|
497
|
+
FS --> WD --> PA
|
|
498
|
+
PA --> CK --> EM --> DD --> CH
|
|
499
|
+
SW -.->|atomic swap| CH
|
|
500
|
+
SW -.-> FT
|
|
501
|
+
CH -.-> MD
|
|
502
|
+
|
|
503
|
+
MCP -.->|instrumented| PM
|
|
504
|
+
MCP -.->|logs| LG
|
|
505
|
+
M1 --> HC
|
|
506
|
+
|
|
507
|
+
YM -.-> SEARCH
|
|
508
|
+
YM -.-> STORAGE
|
|
509
|
+
YM -.-> OBS
|
|
510
|
+
YM -.-> MIDDLEWARE
|
|
511
|
+
|
|
512
|
+
classDef client fill:#3776AB,stroke:#1e5a8a,color:#fff
|
|
513
|
+
classDef transport fill:#00A67E,stroke:#006e54,color:#fff
|
|
514
|
+
classDef middleware fill:#6b46c1,stroke:#4c1d95,color:#fff
|
|
515
|
+
classDef storage fill:#4b5563,stroke:#1f2937,color:#fff
|
|
516
|
+
classDef obs fill:#dc2626,stroke:#7f1d1d,color:#fff
|
|
517
|
+
classDef ingest fill:#f59e0b,stroke:#78350f,color:#fff
|
|
518
|
+
|
|
519
|
+
class C1,C2,C3,C4,C5 client
|
|
520
|
+
class T1,T2 transport
|
|
521
|
+
class M1,M2,M3 middleware
|
|
522
|
+
class CH,FT,MD storage
|
|
523
|
+
class PM,LG,HC obs
|
|
524
|
+
class FS,WD,PA,CK,EM,DD,SW ingest
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
**Reading the diagram (top → bottom):**
|
|
528
|
+
|
|
529
|
+
1. **Any MCP client** — Claude Code, Cursor, Windsurf, and 5 others — connects via the transport of your choice (stdio for personal use, SSE/streamable-http for teams).
|
|
530
|
+
2. **HTTP mode chains 3 ASGI middlewares in order**: health probes first (always answered), then bearer auth (fenced with `WWW-Authenticate`), then rate limiter (sliding window).
|
|
531
|
+
3. **All 13 MCP tools** are decorated with `@rate_limited` + `@instrument` — Prometheus counts every call, rate limiter enforces RPM+burst, both zero-cost when disabled.
|
|
532
|
+
4. **`search_knowledge` checks the query cache first**; cache miss routes through the Query Router (regex classifier) to either the FTS5 fast-path (lexical) or the hybrid pipeline (BM25 + semantic + RRF + cross-encoder rerank).
|
|
533
|
+
5. **Storage is 100% local**: ChromaDB (WAL mode) for vectors + metadata, SQLite FTS5 (WAL + busy-timeout) for lexical fast-path, `index_metadata.json` for durable state.
|
|
534
|
+
6. **Document ingestion runs continuously**: watchdog observes `documents/`, 35 parsers handle each format, chunker respects language boundaries, FastEmbed ONNX generates embeddings, SHA256 deduplicates, and a staging swap performs zero-downtime rebuilds with rollback-on-failure.
|
|
535
|
+
7. **Enterprise observability** (opt-in) — Prometheus `/metrics`, structured JSON logs, `/health` payload — attaches to the same instrumentation points, no code changes required.
|
|
536
|
+
8. **`config.yaml` (with 5 domain presets)** controls every subsystem — no environment variable spaghetti, no hardcoded paths.
|
|
537
|
+
|
|
538
|
+
**Complete architecture — 4 detailed Mermaid diagrams (System Overview · Query Flow · Document Ingestion · hybrid_alpha effect):** [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md)
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
## 📄 35 File Formats — parsed natively, no plugins needed
|
|
543
|
+
|
|
544
|
+
Every parser is **chunk-aware** — Markdown splits at `##` headers, code splits at function/class boundaries, notebooks skip base64 outputs, PDFs use PyMuPDF, spreadsheets extract sheet-by-sheet. **33 formats are enabled by default**; the 2 MetaTrader formats are opt-in (add to `documents.supported_formats` in `config.yaml`).
|
|
545
|
+
|
|
546
|
+
| # | Format | Extension | Parser | Default | Notes |
|
|
547
|
+
|---|--------|-----------|--------|:-------:|-------|
|
|
548
|
+
| 1 | Markdown | `.md` | Section-aware (splits at `##`) | Yes | Headers preserved as chunk boundaries |
|
|
549
|
+
| 2 | Plain Text | `.txt` | Fixed-size chunking | Yes | 1000 chars + 200 overlap |
|
|
550
|
+
| 3 | PDF | `.pdf` | PyMuPDF extraction | Yes | Text-based PDFs only (no OCR) |
|
|
551
|
+
| 4 | Word | `.docx` | python-docx | Yes | Headings preserved as markdown |
|
|
552
|
+
| 5 | Excel | `.xlsx` | openpyxl | Yes | Sheet-by-sheet extraction |
|
|
553
|
+
| 6 | PowerPoint | `.pptx` | python-pptx | Yes | Slide-by-slide extraction |
|
|
554
|
+
| 7 | Jupyter Notebook | `.ipynb` | Cell-aware parser | Yes | Markdown + code cells only; skips outputs/base64 |
|
|
555
|
+
| 8 | JSON | `.json` | Structure-aware | Yes | Flattened key-value extraction |
|
|
556
|
+
| 9 | CSV | `.csv` | Row-based parser | Yes | Headers + rows as text |
|
|
557
|
+
| 10 | XML | `.xml` | XML parser | Yes | Root element + namespace metadata |
|
|
558
|
+
| 11 | Python | `.py` | Code-aware parser | Yes | Functions/classes as chunks |
|
|
559
|
+
| 12 | C Source | `.c` | Code-aware parser | Yes | Functions / structs / includes extracted |
|
|
560
|
+
| 13 | C/C++ Header | `.h` | Code-aware parser | Yes | Function declarations + structs extracted |
|
|
561
|
+
| 14 | C++ Source | `.cpp` | Code-aware parser | Yes | Classes / structs / includes extracted |
|
|
562
|
+
| 15 | JavaScript | `.js` | Code-aware parser | Yes | Functions / classes / imports (ESM + CJS) |
|
|
563
|
+
| 16 | React JSX | `.jsx` | Code-aware parser | Yes | Same as JS parser |
|
|
564
|
+
| 17 | TypeScript | `.ts` | Code-aware parser | Yes | Functions / classes / interfaces / enums / imports |
|
|
565
|
+
| 18 | React TSX | `.tsx` | Code-aware parser | Yes | Same as TS parser |
|
|
566
|
+
| 19 | Go | `.go` | Code-aware parser | Yes | Functions / structs / imports extracted |
|
|
567
|
+
| 20 | Rust | `.rs` | Code-aware parser | Yes | Functions / structs / enums / traits / `use` imports |
|
|
568
|
+
| 21 | Kotlin | `.kt` | Code-aware parser | Yes | Functions (incl. class members) / classes extracted |
|
|
569
|
+
| 22 | YAML | `.yaml` | YAML parser | Yes | Kubernetes kind / apiVersion / name extracted |
|
|
570
|
+
| 23 | YAML | `.yml` | YAML parser | Yes | Same as YAML parser |
|
|
571
|
+
| 24 | HuJSON | `.hujson` | HuJSON parser | Yes | JSON with comments + trailing commas (e.g. Tailscale ACLs) |
|
|
572
|
+
| 25 | CUE | `.cue` | Code-aware parser | Yes | Imports / package extracted |
|
|
573
|
+
| 26 | Protocol Buffers | `.proto` | Proto parser | Yes | Services / messages / RPCs extracted |
|
|
574
|
+
| 27 | Rego | `.rego` | Code-aware parser | Yes | OPA policies — imports / package extracted |
|
|
575
|
+
| 28 | SQL | `.sql` | SQL parser | Yes | Table names + statement types extracted |
|
|
576
|
+
| 29 | Shell | `.sh` | Shell parser | Yes | Function names extracted |
|
|
577
|
+
| 30 | jq | `.jq` | Shell parser | Yes | Indexed as shell-style script |
|
|
578
|
+
| 31 | Dockerfile | `Dockerfile` | Text parser | Yes | Matched by exact filename (no extension) |
|
|
579
|
+
| 32 | Makefile | `Makefile` | Text parser | Yes | Matched by exact filename (no extension) |
|
|
580
|
+
| 33 | Tiltfile | `Tiltfile` | Code-aware parser | Yes | Starlark — `def` functions / `load()` extracted |
|
|
581
|
+
| 34 | MQL4 Source | `.mq4` | Code parser | **No** | MetaTrader — opt-in via `documents.supported_formats` |
|
|
582
|
+
| 35 | MQL4 Header | `.mqh` | Code parser | **No** | MetaTrader — opt-in via `documents.supported_formats` |
|
|
583
|
+
|
|
584
|
+
> **Enable an opt-in format** — add the extension to `documents.supported_formats` in your `config.yaml`:
|
|
585
|
+
> ```yaml
|
|
586
|
+
> documents:
|
|
587
|
+
> supported_formats: [".md", ".pdf", ".mq4", ".mqh"]
|
|
588
|
+
> ```
|
|
589
|
+
|
|
590
|
+
**Full parser reference with per-format notes:** [docs/CONFIGURATION.md](docs/CONFIGURATION.md)
|
|
591
|
+
|
|
592
|
+
---
|
|
593
|
+
|
|
594
|
+
## 🔌 Choose your MCP integration
|
|
595
|
+
|
|
596
|
+
<table>
|
|
597
|
+
<tr>
|
|
598
|
+
<td align="center" width="14%">
|
|
599
|
+
|
|
600
|
+
**Claude Code**<br/>
|
|
601
|
+
`~/.claude.json`
|
|
602
|
+
|
|
603
|
+
</td>
|
|
604
|
+
<td align="center" width="14%">
|
|
605
|
+
|
|
606
|
+
**Claude Desktop**<br/>
|
|
607
|
+
`claude_desktop_config.json`
|
|
608
|
+
|
|
609
|
+
</td>
|
|
610
|
+
<td align="center" width="14%">
|
|
611
|
+
|
|
612
|
+
**Cursor**<br/>
|
|
613
|
+
`~/.cursor/mcp.json`
|
|
614
|
+
|
|
615
|
+
</td>
|
|
616
|
+
<td align="center" width="14%">
|
|
617
|
+
|
|
618
|
+
**Windsurf**<br/>
|
|
619
|
+
`~/.codeium/windsurf/mcp_config.json`
|
|
620
|
+
|
|
621
|
+
</td>
|
|
622
|
+
<td align="center" width="14%">
|
|
623
|
+
|
|
624
|
+
**VS Code**<br/>
|
|
625
|
+
Copilot Chat `mcp.json`
|
|
626
|
+
|
|
627
|
+
</td>
|
|
628
|
+
<td align="center" width="14%">
|
|
629
|
+
|
|
630
|
+
**Cline · Gemini CLI · Zed**<br/>
|
|
631
|
+
Native MCP
|
|
632
|
+
|
|
633
|
+
</td>
|
|
634
|
+
</tr>
|
|
635
|
+
</table>
|
|
636
|
+
|
|
637
|
+
**Complete client configuration guide with JSON schemas per client:** [docs/INSTALLATION.md#use-with-other-mcp-clients →](docs/INSTALLATION.md#use-with-other-mcp-clients)
|
|
638
|
+
|
|
639
|
+
---
|
|
640
|
+
|
|
641
|
+
## ⚙️ Configuration in 30 seconds
|
|
642
|
+
|
|
643
|
+
```yaml
|
|
644
|
+
# config.yaml — everything is optional; defaults just work
|
|
645
|
+
|
|
646
|
+
paths:
|
|
647
|
+
documents_dir: "./documents"
|
|
648
|
+
data_dir: "./data"
|
|
649
|
+
|
|
650
|
+
models:
|
|
651
|
+
embedding:
|
|
652
|
+
profile: "compact" # "compact" | "quality" | "multilingual" | "custom"
|
|
653
|
+
gpu: "auto" # "auto" | "true" | "false"
|
|
654
|
+
reranker:
|
|
655
|
+
enabled: true # cross-encoder rerank
|
|
656
|
+
|
|
657
|
+
search:
|
|
658
|
+
default_results: 5
|
|
659
|
+
max_results: 100
|
|
660
|
+
|
|
661
|
+
server: # optional — SSE / HTTP mode
|
|
662
|
+
transport: "stdio" # or "sse" / "streamable-http"
|
|
663
|
+
auth:
|
|
664
|
+
bearer_token: "" # set a secret to enable auth
|
|
665
|
+
rate_limit:
|
|
666
|
+
enabled: false
|
|
667
|
+
metrics:
|
|
668
|
+
enabled: false
|
|
669
|
+
logging:
|
|
670
|
+
format: "text" # or "json"
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
**Pre-built presets:** [`cybersecurity.yaml`](presets/cybersecurity.yaml) · [`developer.yaml`](presets/developer.yaml) · [`research.yaml`](presets/research.yaml) · [`general.yaml`](presets/general.yaml) · [`multilingual.yaml`](presets/multilingual.yaml)
|
|
674
|
+
|
|
675
|
+
**Complete configuration reference — every field, every default, tuning guide:** [docs/CONFIGURATION.md →](docs/CONFIGURATION.md)
|
|
676
|
+
|
|
677
|
+
---
|
|
678
|
+
|
|
679
|
+
## 🔒 Security & Compliance
|
|
680
|
+
|
|
681
|
+
knowledge-rag is designed for teams that cannot let their documents leave the perimeter.
|
|
682
|
+
|
|
683
|
+
| Requirement | How knowledge-rag delivers |
|
|
684
|
+
|---|---|
|
|
685
|
+
| **Data locality (LGPD / GDPR / HIPAA)** | 100% on-premise, zero egress network calls after initial model download |
|
|
686
|
+
| **Air-gapped deployment** | ONNX models pre-cached; set `HF_HUB_OFFLINE=1` to enforce zero-network |
|
|
687
|
+
| **CVE monitoring** | Dependabot (weekly) + pip-audit + Socket + CodeQL |
|
|
688
|
+
| **Supply chain security** | PyPI Trusted Publishing via OIDC (no long-lived tokens) |
|
|
689
|
+
| **Vulnerability disclosure** | Private security advisory via [SECURITY.md](SECURITY.md) |
|
|
690
|
+
| **Signed release attestations** | GitHub release attestations on every published version |
|
|
691
|
+
| **Reproducible builds** | Locked `requirements.txt` with pinned versions |
|
|
692
|
+
| **Authenticated access** | Bearer token middleware on SSE / HTTP transports (constant-time compare, RFC 6750) |
|
|
693
|
+
| **Rate limiting** | Sliding-window per-client RPM + burst (opt-in, zero-cost when disabled) |
|
|
694
|
+
| **Audit-ready logging** | Opt-in structured JSON logs → ship to your SIEM |
|
|
695
|
+
| **Path traversal defenses** | CWE-22 / CWE-59 guards on 6 CRUD tools |
|
|
696
|
+
| **Prompt injection defense** | 3-layer sanitization on `add_from_url` (OWASP LLM01:2025) |
|
|
697
|
+
|
|
698
|
+
**OpenSSF Best Practices** badge: passing · project ID [#13864](https://bestpractices.coreinfrastructure.org/projects/13864)
|
|
699
|
+
|
|
700
|
+
---
|
|
701
|
+
|
|
702
|
+
## 📈 Numbers that matter
|
|
703
|
+
|
|
704
|
+
- **26 000+** total downloads on PyPI · **250+** GitHub stars · **70+** enterprise teams (private + community)
|
|
705
|
+
- **700+ tests** collected · **1.33:1** test-to-code ratio · **codecov trend gate** ±0.5pp
|
|
706
|
+
- **35+ status checks** on every PR (9-cell OS×Python matrix · 7 quality pillars)
|
|
707
|
+
- **35 file formats** parsed natively · **13 MCP tools** frozen · **5 domain presets** (cyber · dev · research · multilingual · general)
|
|
708
|
+
- **BM25 128× faster** than baseline · **cross-encoder +1.88pp** Recall@10 (p<0.001) · **cache −40%** p95 latency
|
|
709
|
+
- **1 800+ files / 39 K chunks indexed in < 3 min** on a modern laptop (typical developer corpus)
|
|
710
|
+
- **Verified in production** on 5 889-doc / 75 016-chunk corpora
|
|
711
|
+
|
|
712
|
+
**Public benchmark dashboard:** https://lyonzin.github.io/knowledge-rag/
|
|
713
|
+
|
|
714
|
+
---
|
|
715
|
+
|
|
716
|
+
## 📚 Documentation
|
|
717
|
+
|
|
718
|
+
| Doc | What's inside |
|
|
719
|
+
|---|---|
|
|
720
|
+
| [**Installation guide**](docs/INSTALLATION.md) | 5 install methods · 8 MCP client integrations · GPU setup |
|
|
721
|
+
| [**API reference**](docs/API.md) | Complete reference for all 13 MCP tools |
|
|
722
|
+
| [**Configuration reference**](docs/CONFIGURATION.md) | Every `config.yaml` field · presets · tuning |
|
|
723
|
+
| [**Architecture**](docs/ARCHITECTURE.md) | 4 Mermaid diagrams: System Overview · Query Flow · Ingestion · hybrid_alpha |
|
|
724
|
+
| [**Troubleshooting**](docs/TROUBLESHOOTING.md) | 11 common issues + solutions |
|
|
725
|
+
| [**FTS5 fast-path guide**](docs/features/fts5_fast_path.md) | Opt-in lexical fast-path — when and how |
|
|
726
|
+
| [**Reindex operations**](docs/reindex-operations.md) | Zero-downtime rebuild · resume · checkpoint |
|
|
727
|
+
| [**GPU setup**](docs/gpu-setup.md) | CUDA 12 installation + troubleshooting |
|
|
728
|
+
| [**Migration to v4.8.0**](docs/migration-v4.8.0.md) | Embedding profile · multilingual · zero-downtime |
|
|
729
|
+
| [**Security policy**](SECURITY.md) | Threat model · disclosure channel |
|
|
730
|
+
| [**Contributing**](CONTRIBUTING.md) | Development · testing · PR process |
|
|
731
|
+
| [**Changelog**](CHANGELOG.md) | All release notes since v1.0.0 |
|
|
732
|
+
|
|
733
|
+
---
|
|
734
|
+
|
|
735
|
+
## 🤝 Community & Support
|
|
736
|
+
|
|
737
|
+
- **Report a bug** → [Open an issue](https://github.com/lyonzin/knowledge-rag/issues/new/choose)
|
|
738
|
+
- **Ask a question** → [GitHub Discussions](https://github.com/lyonzin/knowledge-rag/discussions)
|
|
739
|
+
- **Report a vulnerability** → [Security advisory](https://github.com/lyonzin/knowledge-rag/security/advisories/new) (private)
|
|
740
|
+
- **Contribute** → [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
741
|
+
|
|
742
|
+
**Response SLA (best-effort, community project):**
|
|
743
|
+
- Security reports: within 48 h
|
|
744
|
+
- Bug reports with reproduction: within 5 business days
|
|
745
|
+
- Feature requests: triaged on next release cycle
|
|
746
|
+
|
|
747
|
+
---
|
|
748
|
+
|
|
749
|
+
## 🗺️ Recent releases
|
|
750
|
+
|
|
751
|
+
- **v4.8.5** (2026-08-13) — Enterprise observability: `/health` endpoint + opt-in JSON structured logging
|
|
752
|
+
- **v4.8.4** (2026-08-13) — Patch: security + durability + defensive fixes
|
|
753
|
+
- **v4.8.3** (2026-08-10) — Critical hotfix: nuclear-rebuild + smart-reindex hardening on 50k+ chunk corpora
|
|
754
|
+
- **v4.8.2** (2026-08-10) — FTS5 lexical fast-path opt-in release
|
|
755
|
+
- **v4.8.0** (2026-08-06) — Multilingual foundation + zero-downtime reindex
|
|
756
|
+
|
|
757
|
+
**Full history:** [CHANGELOG.md →](CHANGELOG.md)
|
|
758
|
+
|
|
759
|
+
---
|
|
760
|
+
|
|
761
|
+
## 📜 License
|
|
762
|
+
|
|
763
|
+
**MIT License** — [LICENSE](LICENSE). Forever. No cloud upsell, no dual-licensing, no restrictive clauses. Fork it, sell derivatives, embed it in commercial products — the license does not care.
|
|
764
|
+
|
|
765
|
+
---
|
|
766
|
+
|
|
767
|
+
## 🙏 Acknowledgments
|
|
768
|
+
|
|
769
|
+
Built on the shoulders of amazing open-source projects:
|
|
770
|
+
|
|
771
|
+
- [**Anthropic MCP**](https://modelcontextprotocol.io/) — Model Context Protocol spec + Python SDK
|
|
772
|
+
- [**ChromaDB**](https://www.trychroma.com/) — vector database that just works
|
|
773
|
+
- [**FastEmbed**](https://github.com/qdrant/fastembed) — ONNX embeddings, no PyTorch bloat
|
|
774
|
+
- [**HuggingFace**](https://huggingface.co/) — model hosting + `Xenova/ms-marco-MiniLM-L-6-v2` cross-encoder
|
|
775
|
+
- [**BAAI**](https://huggingface.co/BAAI) — the `bge-small-en-v1.5` embedding model
|
|
776
|
+
|
|
777
|
+
**Community contributors:** [@Hohlas](https://github.com/Hohlas) · [@eeshsaxena](https://github.com/eeshsaxena) · Sergey Khokhlov · and everyone who filed issues or PRs.
|
|
778
|
+
|
|
779
|
+
---
|
|
780
|
+
|
|
781
|
+
<div align="center">
|
|
782
|
+
|
|
783
|
+
**Built by [Ailton Rocha (Lyon.)](https://github.com/lyonzin)** · Star ⭐ if this saves you time · [Report an issue](https://github.com/lyonzin/knowledge-rag/issues/new/choose) · [Contribute](CONTRIBUTING.md)
|
|
784
|
+
|
|
785
|
+
*knowledge-rag — the MCP-first local RAG server for Claude Code, Cursor, Windsurf, and every AI agent.*
|
|
786
|
+
|
|
787
|
+
</div>
|