@robthepcguy/rag-vault 1.3.1 → 1.5.1
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.
- package/README.md +479 -441
- package/dist/embedder/index.d.ts +8 -0
- package/dist/embedder/index.js +38 -0
- package/dist/parser/index.js +21 -4
- package/dist/server/index.js +33 -12
- package/dist/server/raw-data-utils.d.ts +9 -0
- package/dist/server/raw-data-utils.js +15 -0
- package/dist/vectordb/index.js +14 -13
- package/dist/web/database-manager.d.ts +4 -0
- package/dist/web/database-manager.js +15 -0
- package/dist/web/http-server.js +13 -1
- package/package.json +11 -6
- package/skills/rag-vault/SKILL.md +111 -111
- package/skills/rag-vault/references/html-ingestion.md +73 -73
- package/skills/rag-vault/references/query-optimization.md +57 -57
- package/skills/rag-vault/references/result-refinement.md +54 -54
- package/web-ui/dist/assets/{index-BcRp9-z9.js → index-SBHxoAwi.js} +2 -2
- package/web-ui/dist/index.html +1 -1
- package/dist/bin/install-skills.d.ts.map +0 -1
- package/dist/bin/install-skills.js.map +0 -1
- package/dist/chunker/index.d.ts.map +0 -1
- package/dist/chunker/index.js.map +0 -1
- package/dist/chunker/semantic-chunker.d.ts.map +0 -1
- package/dist/chunker/semantic-chunker.js.map +0 -1
- package/dist/chunker/sentence-splitter.d.ts.map +0 -1
- package/dist/chunker/sentence-splitter.js.map +0 -1
- package/dist/embedder/index.d.ts.map +0 -1
- package/dist/embedder/index.js.map +0 -1
- package/dist/errors/index.d.ts.map +0 -1
- package/dist/errors/index.js.map +0 -1
- package/dist/explainability/index.d.ts.map +0 -1
- package/dist/explainability/index.js.map +0 -1
- package/dist/explainability/keywords.d.ts.map +0 -1
- package/dist/explainability/keywords.js.map +0 -1
- package/dist/flywheel/feedback.d.ts.map +0 -1
- package/dist/flywheel/feedback.js.map +0 -1
- package/dist/flywheel/index.d.ts.map +0 -1
- package/dist/flywheel/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/parser/html-parser.d.ts.map +0 -1
- package/dist/parser/html-parser.js.map +0 -1
- package/dist/parser/index.d.ts.map +0 -1
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/pdf-filter.d.ts.map +0 -1
- package/dist/parser/pdf-filter.js.map +0 -1
- package/dist/query/index.d.ts.map +0 -1
- package/dist/query/index.js.map +0 -1
- package/dist/query/parser.d.ts.map +0 -1
- package/dist/query/parser.js.map +0 -1
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js.map +0 -1
- package/dist/server/raw-data-utils.d.ts.map +0 -1
- package/dist/server/raw-data-utils.js.map +0 -1
- package/dist/server/schemas.d.ts.map +0 -1
- package/dist/server/schemas.js.map +0 -1
- package/dist/utils/config-parsers.d.ts.map +0 -1
- package/dist/utils/config-parsers.js.map +0 -1
- package/dist/utils/config.d.ts.map +0 -1
- package/dist/utils/config.js.map +0 -1
- package/dist/utils/file-utils.d.ts.map +0 -1
- package/dist/utils/file-utils.js.map +0 -1
- package/dist/utils/math.d.ts.map +0 -1
- package/dist/utils/math.js.map +0 -1
- package/dist/utils/process-handlers.d.ts.map +0 -1
- package/dist/utils/process-handlers.js.map +0 -1
- package/dist/vectordb/index.d.ts.map +0 -1
- package/dist/vectordb/index.js.map +0 -1
- package/dist/web/api-routes.d.ts.map +0 -1
- package/dist/web/api-routes.js.map +0 -1
- package/dist/web/config-routes.d.ts.map +0 -1
- package/dist/web/config-routes.js.map +0 -1
- package/dist/web/database-manager.d.ts.map +0 -1
- package/dist/web/database-manager.js.map +0 -1
- package/dist/web/http-server.d.ts.map +0 -1
- package/dist/web/http-server.js.map +0 -1
- package/dist/web/index.d.ts.map +0 -1
- package/dist/web/index.js.map +0 -1
- package/dist/web/middleware/async-handler.d.ts.map +0 -1
- package/dist/web/middleware/async-handler.js.map +0 -1
- package/dist/web/middleware/auth.d.ts.map +0 -1
- package/dist/web/middleware/auth.js.map +0 -1
- package/dist/web/middleware/error-handler.d.ts.map +0 -1
- package/dist/web/middleware/error-handler.js.map +0 -1
- package/dist/web/middleware/index.d.ts.map +0 -1
- package/dist/web/middleware/index.js.map +0 -1
- package/dist/web/middleware/rate-limit.d.ts.map +0 -1
- package/dist/web/middleware/rate-limit.js.map +0 -1
- package/dist/web/middleware/request-logger.d.ts.map +0 -1
- package/dist/web/middleware/request-logger.js.map +0 -1
- package/dist/web/types.d.ts.map +0 -1
- package/dist/web/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,441 +1,479 @@
|
|
|
1
|
-
# RAG Vault
|
|
2
|
-
|
|
3
|
-
[](https://opensource.org/licenses/MIT)
|
|
4
|
-
[](https://www.typescriptlang.org/)
|
|
5
|
-
[](https://registry.modelcontextprotocol.io/servers/io.github.RobThePCGuy/rag-vault)
|
|
6
|
-
|
|
7
|
-
**Your documents. Your machine. Your control.**
|
|
8
|
-
|
|
9
|
-
RAG Vault gives AI coding assistants
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
|
16
|
-
|
|
17
|
-
| "
|
|
18
|
-
| "
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- **
|
|
26
|
-
- **
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
###
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
You: "
|
|
235
|
-
AI:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
|
285
|
-
|
|
286
|
-
|
|
|
287
|
-
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
| `
|
|
302
|
-
| `
|
|
303
|
-
| `
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
| `
|
|
311
|
-
| `
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
1
|
+
# RAG Vault
|
|
2
|
+
|
|
3
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
|
+
[](https://www.typescriptlang.org/)
|
|
5
|
+
[](https://registry.modelcontextprotocol.io/servers/io.github.RobThePCGuy/rag-vault)
|
|
6
|
+
|
|
7
|
+
**Your documents. Your machine. Your control.**
|
|
8
|
+
|
|
9
|
+
RAG Vault gives AI coding assistants fast access to your private documents such as API specs, research papers, and internal docs. Indexing and search run locally, and your data stays on your machine unless you explicitly ingest content from a remote URL.
|
|
10
|
+
|
|
11
|
+
One command to run, minimal setup, privacy by default.
|
|
12
|
+
|
|
13
|
+
## Why RAG Vault?
|
|
14
|
+
|
|
15
|
+
| Pain Point | RAG Vault Solution |
|
|
16
|
+
|------------|-------------------|
|
|
17
|
+
| "I don't want my docs on someone else's server" | Everything stays local by default. No background cloud calls for indexing or search. |
|
|
18
|
+
| "Semantic search misses exact code terms" | Hybrid search: meaning + exact matches like `useEffect` |
|
|
19
|
+
| "Setup requires Docker, Python, databases..." | One `npx` command plus a small MCP config block. |
|
|
20
|
+
| "Cloud APIs charge per query" | Free forever. No subscriptions. |
|
|
21
|
+
|
|
22
|
+
## Security
|
|
23
|
+
|
|
24
|
+
RAG Vault includes security features for production deployment:
|
|
25
|
+
- **API Authentication**: Optional API key via `RAG_API_KEY`
|
|
26
|
+
- **Rate Limiting**: Configurable request throttling
|
|
27
|
+
- **CORS Control**: Restrict allowed origins
|
|
28
|
+
- **Security Headers**: Helmet.js protection
|
|
29
|
+
|
|
30
|
+
See [SECURITY.md](SECURITY.md) for complete documentation.
|
|
31
|
+
|
|
32
|
+
## First-Time Setup Checklist
|
|
33
|
+
|
|
34
|
+
Before adding MCP config:
|
|
35
|
+
|
|
36
|
+
1. Install Node.js 20 or newer.
|
|
37
|
+
2. Pick a documents directory and set `BASE_DIR` to that path.
|
|
38
|
+
3. Make sure your AI tool process can read `BASE_DIR`.
|
|
39
|
+
4. Restart your AI tool after editing config.
|
|
40
|
+
|
|
41
|
+
## Get Started Quickly
|
|
42
|
+
|
|
43
|
+
### For Cursor
|
|
44
|
+
|
|
45
|
+
Add to `~/.cursor/mcp.json`:
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"local-rag": {
|
|
51
|
+
"type": "stdio",
|
|
52
|
+
"command": "npx",
|
|
53
|
+
"args": ["-y", "github:RobThePCGuy/rag-vault"],
|
|
54
|
+
"env": {
|
|
55
|
+
"BASE_DIR": "/path/to/your/documents"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Replace `/path/to/your/documents` with your real absolute path.
|
|
63
|
+
|
|
64
|
+
### For Claude Code
|
|
65
|
+
|
|
66
|
+
Add to `.mcp.json` in your project directory:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"local-rag": {
|
|
72
|
+
"type": "stdio",
|
|
73
|
+
"command": "npx",
|
|
74
|
+
"args": ["-y", "github:RobThePCGuy/rag-vault"],
|
|
75
|
+
"env": {
|
|
76
|
+
"BASE_DIR": "./documents",
|
|
77
|
+
"DB_PATH": "./documents/.rag-db",
|
|
78
|
+
"CACHE_DIR": "./.cache",
|
|
79
|
+
"RAG_HYBRID_WEIGHT": "0.6",
|
|
80
|
+
"RAG_GROUPING": "related"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Or add inline via CLI:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
claude mcp add local-rag --scope user --env BASE_DIR=/path/to/your/documents -- npx -y github:RobThePCGuy/rag-vault
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### For Codex
|
|
94
|
+
|
|
95
|
+
Add to `~/.codex/config.toml`:
|
|
96
|
+
|
|
97
|
+
```toml
|
|
98
|
+
[mcp_servers.local-rag]
|
|
99
|
+
command = "npx"
|
|
100
|
+
args = ["-y", "github:RobThePCGuy/rag-vault"]
|
|
101
|
+
|
|
102
|
+
[mcp_servers.local-rag.env]
|
|
103
|
+
BASE_DIR = "/path/to/your/documents"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Install Skills (Optional)
|
|
107
|
+
|
|
108
|
+
For enhanced AI guidance on query formulation and result interpretation, install the RAG Vault skills:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Claude Code (project-level - recommended for team projects)
|
|
112
|
+
npx github:RobThePCGuy/rag-vault skills install --claude-code
|
|
113
|
+
|
|
114
|
+
# Claude Code (user-level - available in all projects)
|
|
115
|
+
npx github:RobThePCGuy/rag-vault skills install --claude-code --global
|
|
116
|
+
|
|
117
|
+
# Codex (user-level)
|
|
118
|
+
npx github:RobThePCGuy/rag-vault skills install --codex
|
|
119
|
+
|
|
120
|
+
# Custom location
|
|
121
|
+
npx github:RobThePCGuy/rag-vault skills install --path /your/custom/path
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Skills teach Claude best practices for:
|
|
125
|
+
- Query formulation and expansion strategies
|
|
126
|
+
- Score interpretation (< 0.3 = good match, > 0.5 = skip)
|
|
127
|
+
- When to use `ingest_file` vs `ingest_data`
|
|
128
|
+
- HTML ingestion and URL handling
|
|
129
|
+
|
|
130
|
+
Restart your AI tool, and start talking:
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
You: "Ingest api-spec.pdf"
|
|
134
|
+
AI: Successfully ingested api-spec.pdf (47 chunks)
|
|
135
|
+
|
|
136
|
+
You: "How does authentication work?"
|
|
137
|
+
AI: Based on section 3.2, authentication uses OAuth 2.0 with JWT tokens...
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
That's it. No Docker. No Python. No server infrastructure to manage.
|
|
141
|
+
|
|
142
|
+
## Web Interface
|
|
143
|
+
|
|
144
|
+
RAG Vault includes a full-featured web UI for managing your documents without the command line.
|
|
145
|
+
|
|
146
|
+
### Launch the Web UI
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
npx github:RobThePCGuy/rag-vault web
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Open [http://localhost:3000](http://localhost:3000) in your browser.
|
|
153
|
+
|
|
154
|
+
### What You Can Do
|
|
155
|
+
|
|
156
|
+
- **Upload documents**: Drag and drop PDF, DOCX, Markdown, TXT, JSON, JSONL, and NDJSON files
|
|
157
|
+
- **Search instantly**: Type queries and see results with relevance scores
|
|
158
|
+
- **Preview content**: Click any result to see the full chunk in context
|
|
159
|
+
- **Manage files**: View all indexed documents and delete what you do not need
|
|
160
|
+
- **Switch databases**: Create and switch between multiple knowledge bases
|
|
161
|
+
- **Monitor status**: See document counts, memory usage, and search mode
|
|
162
|
+
- **Export/Import settings**: Back up and restore your vault configuration
|
|
163
|
+
- **Theme preferences**: Switch between light, dark, or system theme
|
|
164
|
+
- **Folder browser**: Navigate directories to select documents
|
|
165
|
+
|
|
166
|
+
### REST API
|
|
167
|
+
|
|
168
|
+
The web server exposes a REST API for programmatic access. Set `RAG_API_KEY` to require authentication:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# With authentication (when RAG_API_KEY is set)
|
|
172
|
+
curl -X POST "http://localhost:3000/api/v1/search" \
|
|
173
|
+
-H "Authorization: Bearer your-api-key" \
|
|
174
|
+
-H "Content-Type: application/json" \
|
|
175
|
+
-d '{"query": "authentication", "limit": 5}'
|
|
176
|
+
|
|
177
|
+
# Search documents (no auth required if RAG_API_KEY is not set)
|
|
178
|
+
curl -X POST "http://localhost:3000/api/v1/search" \
|
|
179
|
+
-H "Content-Type: application/json" \
|
|
180
|
+
-d '{"query": "authentication", "limit": 5}'
|
|
181
|
+
|
|
182
|
+
# List all files
|
|
183
|
+
curl "http://localhost:3000/api/v1/files"
|
|
184
|
+
|
|
185
|
+
# Upload a document
|
|
186
|
+
curl -X POST "http://localhost:3000/api/v1/files/upload" \
|
|
187
|
+
-F "file=@spec.pdf"
|
|
188
|
+
|
|
189
|
+
# Delete a file
|
|
190
|
+
curl -X DELETE "http://localhost:3000/api/v1/files" \
|
|
191
|
+
-H "Content-Type: application/json" \
|
|
192
|
+
-d '{"filePath": "/path/to/spec.pdf"}'
|
|
193
|
+
|
|
194
|
+
# Get system status
|
|
195
|
+
curl "http://localhost:3000/api/v1/status"
|
|
196
|
+
|
|
197
|
+
# Health check (for load balancers)
|
|
198
|
+
curl "http://localhost:3000/api/v1/health"
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Reader API Endpoints
|
|
202
|
+
|
|
203
|
+
For programmatic document reading and cross-document discovery:
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Get all chunks for a document (ordered by index)
|
|
207
|
+
curl "http://localhost:3000/api/v1/documents/chunks?filePath=/path/to/doc.pdf"
|
|
208
|
+
|
|
209
|
+
# Find related chunks for cross-document discovery
|
|
210
|
+
curl "http://localhost:3000/api/v1/chunks/related?filePath=/path/to/doc.pdf&chunkIndex=0&limit=5"
|
|
211
|
+
|
|
212
|
+
# Batch request for multiple chunks (efficient for UIs)
|
|
213
|
+
curl -X POST "http://localhost:3000/api/v1/chunks/batch-related" \
|
|
214
|
+
-H "Content-Type: application/json" \
|
|
215
|
+
-d '{"chunks": [{"filePath": "/path/to/doc.pdf", "chunkIndex": 0}], "limit": 3}'
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Real-World Examples
|
|
219
|
+
|
|
220
|
+
### Search Your Codebase Documentation
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
You: "Ingest all the markdown files in /docs"
|
|
224
|
+
AI: Ingested 23 files (847 chunks total)
|
|
225
|
+
|
|
226
|
+
You: "What's the retry policy for failed API calls?"
|
|
227
|
+
AI: According to error-handling.md, failed requests retry 3 times
|
|
228
|
+
with exponential backoff: 1s, 2s, 4s...
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Index Web Documentation
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
You: "Fetch https://docs.example.com/api and ingest the HTML"
|
|
235
|
+
AI: Ingested "docs.example.com/api" (156 chunks)
|
|
236
|
+
|
|
237
|
+
You: "What rate limits apply to the /users endpoint?"
|
|
238
|
+
AI: The API limits /users to 100 requests per minute per API key...
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Build a Personal Knowledge Base
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
You: "Ingest my research papers folder"
|
|
245
|
+
AI: Ingested 12 PDFs (2,341 chunks)
|
|
246
|
+
|
|
247
|
+
You: "What do recent studies say about transformer attention mechanisms?"
|
|
248
|
+
AI: Based on attention-mechanisms-2024.pdf, the key finding is...
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Search Exact Technical Terms
|
|
252
|
+
|
|
253
|
+
RAG Vault's hybrid search catches both meaning and exact matches:
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
You: "Search for ERR_CONNECTION_REFUSED"
|
|
257
|
+
AI: Found 3 results mentioning ERR_CONNECTION_REFUSED:
|
|
258
|
+
1. troubleshooting.md - "When you see ERR_CONNECTION_REFUSED..."
|
|
259
|
+
2. network-errors.pdf - "Common causes include..."
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Pure semantic search would miss this. RAG Vault finds it.
|
|
263
|
+
|
|
264
|
+
## How It Works
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
Document → Parse → Chunk by meaning → Embed locally → Store in LanceDB
|
|
268
|
+
↓
|
|
269
|
+
Query → Embed → Vector search → Keyword boost → Quality filter → Results
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Smart chunking**: Splits by meaning, not character count. Keeps code blocks intact.
|
|
273
|
+
|
|
274
|
+
**Hybrid search**: Vector similarity finds related content. Keyword boost ranks exact matches higher.
|
|
275
|
+
|
|
276
|
+
**Quality filtering**: Groups results by relevance gaps instead of arbitrary top-K cutoffs.
|
|
277
|
+
|
|
278
|
+
**Local by default**: Embeddings via Transformers.js. Storage via LanceDB. Network is only needed for initial model download or if you explicitly ingest remote URLs.
|
|
279
|
+
|
|
280
|
+
**MCP tools included**: `ingest_file`, `ingest_data`, `query_documents`, `list_files`, and `delete_file`.
|
|
281
|
+
|
|
282
|
+
## Supported Formats
|
|
283
|
+
|
|
284
|
+
| Format | Extension | Notes |
|
|
285
|
+
|--------|-----------|-------|
|
|
286
|
+
| PDF | `.pdf` | Full text extraction, header/footer filtering |
|
|
287
|
+
| Word | `.docx` | Tables, lists, formatting preserved |
|
|
288
|
+
| Markdown | `.md` | Code blocks kept intact |
|
|
289
|
+
| Text | `.txt` | Plain text |
|
|
290
|
+
| JSON | `.json` | Converted to searchable key-value text |
|
|
291
|
+
| JSONL / NDJSON | `.jsonl`, `.ndjson` | Parsed line-by-line for logs and structured records |
|
|
292
|
+
| HTML | via `ingest_data` | Auto-cleaned with Readability |
|
|
293
|
+
|
|
294
|
+
## Configuration
|
|
295
|
+
|
|
296
|
+
### Environment Variables
|
|
297
|
+
|
|
298
|
+
| Variable | Default | What it does |
|
|
299
|
+
|----------|---------|--------------|
|
|
300
|
+
| `BASE_DIR` | Current directory | Only files under this path can be accessed |
|
|
301
|
+
| `DB_PATH` | `./lancedb/` | Where vectors are stored |
|
|
302
|
+
| `MODEL_NAME` | `Xenova/all-MiniLM-L6-v2` | HuggingFace embedding model |
|
|
303
|
+
| `WEB_PORT` | `3000` | Port for web interface |
|
|
304
|
+
|
|
305
|
+
### Search Tuning
|
|
306
|
+
|
|
307
|
+
| Variable | Default | What it does |
|
|
308
|
+
|----------|---------|--------------|
|
|
309
|
+
| `RAG_HYBRID_WEIGHT` | `0.6` | Keyword boost strength. 0 = semantic-only, higher = stronger boost for exact keyword matches |
|
|
310
|
+
| `RAG_GROUPING` | unset | `similar` = top group only, `related` = top 2 groups |
|
|
311
|
+
| `RAG_MAX_DISTANCE` | unset | Filter out results below this relevance threshold |
|
|
312
|
+
|
|
313
|
+
### Security (optional)
|
|
314
|
+
|
|
315
|
+
| Variable | Default | What it does |
|
|
316
|
+
|----------|---------|--------------|
|
|
317
|
+
| `RAG_API_KEY` | unset | API key for authentication |
|
|
318
|
+
| `CORS_ORIGINS` | localhost | Allowed origins (comma-separated, or `*`) |
|
|
319
|
+
| `RATE_LIMIT_WINDOW_MS` | `60000` | Rate limit time window (ms) |
|
|
320
|
+
| `RATE_LIMIT_MAX_REQUESTS` | `100` | Max requests per window |
|
|
321
|
+
|
|
322
|
+
### Advanced
|
|
323
|
+
|
|
324
|
+
| Variable | Default | What it does |
|
|
325
|
+
|----------|---------|--------------|
|
|
326
|
+
| `ALLOWED_SCAN_ROOTS` | Home directory | Directories allowed for database scanning |
|
|
327
|
+
| `JSON_BODY_LIMIT` | `5mb` | Max request body size |
|
|
328
|
+
| `REQUEST_TIMEOUT_MS` | `30000` | API request timeout |
|
|
329
|
+
| `REQUEST_LOGGING` | `false` | Enable request audit logging |
|
|
330
|
+
|
|
331
|
+
> Copy [`.env.example`](.env.example) for a complete configuration template.
|
|
332
|
+
|
|
333
|
+
**For code-heavy content**, try:
|
|
334
|
+
|
|
335
|
+
```json
|
|
336
|
+
"env": {
|
|
337
|
+
"RAG_HYBRID_WEIGHT": "0.8",
|
|
338
|
+
"RAG_GROUPING": "similar"
|
|
339
|
+
}
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
## Frequently Asked Questions
|
|
343
|
+
|
|
344
|
+
<details>
|
|
345
|
+
<summary><strong>Is my data really private?</strong></summary>
|
|
346
|
+
|
|
347
|
+
For local files, yes. Indexing and search run on your machine after the embedding model downloads (~90MB). RAG Vault only uses network if you choose remote URL ingestion or need to download a model.
|
|
348
|
+
|
|
349
|
+
</details>
|
|
350
|
+
|
|
351
|
+
<details>
|
|
352
|
+
<summary><strong>Does it work offline?</strong></summary>
|
|
353
|
+
|
|
354
|
+
Yes, after the first run. The model caches locally.
|
|
355
|
+
|
|
356
|
+
</details>
|
|
357
|
+
|
|
358
|
+
<details>
|
|
359
|
+
<summary><strong>What about GPU acceleration?</strong></summary>
|
|
360
|
+
|
|
361
|
+
Transformers.js runs on CPU. GPU support is experimental, and CPU performance is solid for typical local vault sizes.
|
|
362
|
+
|
|
363
|
+
</details>
|
|
364
|
+
|
|
365
|
+
<details>
|
|
366
|
+
<summary><strong>Can I change the embedding model?</strong></summary>
|
|
367
|
+
|
|
368
|
+
Yes. Set `MODEL_NAME` to any compatible HuggingFace model. You must delete `DB_PATH` and re-ingest because different models produce incompatible vectors.
|
|
369
|
+
|
|
370
|
+
**Recommended upgrade:** For better quality and multilingual support, use [EmbeddingGemma](https://huggingface.co/onnx-community/embeddinggemma-300m-ONNX):
|
|
371
|
+
|
|
372
|
+
```json
|
|
373
|
+
"MODEL_NAME": "onnx-community/embeddinggemma-300m-ONNX"
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
This model is a strong option for multilingual and higher-quality retrieval use cases.
|
|
377
|
+
|
|
378
|
+
**Other specialized models:**
|
|
379
|
+
- Scientific: `sentence-transformers/allenai-specter`
|
|
380
|
+
- Code: `jinaai/jina-embeddings-v2-base-code`
|
|
381
|
+
|
|
382
|
+
</details>
|
|
383
|
+
|
|
384
|
+
<details>
|
|
385
|
+
<summary><strong>How do I back up my data?</strong></summary>
|
|
386
|
+
|
|
387
|
+
Copy the `DB_PATH` directory (default: `./lancedb/`).
|
|
388
|
+
|
|
389
|
+
</details>
|
|
390
|
+
|
|
391
|
+
## Troubleshooting
|
|
392
|
+
|
|
393
|
+
| Problem | Solution |
|
|
394
|
+
|---------|----------|
|
|
395
|
+
| No results found | Documents must be ingested first. Run "List all ingested files" to check. |
|
|
396
|
+
| Model download failed | Check internet connection. Model is ~90MB from HuggingFace. |
|
|
397
|
+
| File too large | Default limit is 100MB. Set `MAX_FILE_SIZE` higher or split the file. |
|
|
398
|
+
| Path outside BASE_DIR | All file paths must be under `BASE_DIR`. Use absolute paths. |
|
|
399
|
+
| MCP tools not showing | Verify config syntax, restart your AI tool completely (Cmd+Q on Mac). |
|
|
400
|
+
| `mcp-publisher login github` fails with `slow_down` | Use token login instead: `mcp-publisher login github --token "$(gh auth token)"` (or pass a PAT). |
|
|
401
|
+
| 401 Unauthorized | API key required. Set `RAG_API_KEY` or use correct header format. |
|
|
402
|
+
| 429 Too Many Requests | Rate limited. Wait for reset or increase `RATE_LIMIT_MAX_REQUESTS`. |
|
|
403
|
+
| CORS errors | Add your origin to `CORS_ORIGINS` environment variable. |
|
|
404
|
+
|
|
405
|
+
## Development
|
|
406
|
+
|
|
407
|
+
```bash
|
|
408
|
+
git clone https://github.com/RobThePCGuy/rag-vault.git
|
|
409
|
+
cd rag-vault
|
|
410
|
+
pnpm install
|
|
411
|
+
pnpm --prefix web-ui install
|
|
412
|
+
|
|
413
|
+
# Install local git hooks (recommended, even for solo dev)
|
|
414
|
+
pnpm hooks:install
|
|
415
|
+
|
|
416
|
+
# Fast local quality gate (backend + web-ui type/lint/format, deps, unused, build, unit tests)
|
|
417
|
+
pnpm check:all
|
|
418
|
+
|
|
419
|
+
# Unit tests only (no model download required)
|
|
420
|
+
pnpm test:unit
|
|
421
|
+
|
|
422
|
+
# Integration/E2E tests (requires model download/network)
|
|
423
|
+
pnpm test:integration
|
|
424
|
+
|
|
425
|
+
# Build
|
|
426
|
+
pnpm build
|
|
427
|
+
|
|
428
|
+
# Run MCP server locally
|
|
429
|
+
pnpm dev
|
|
430
|
+
|
|
431
|
+
# Run web server locally
|
|
432
|
+
pnpm web:dev
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
### Test Tiers
|
|
437
|
+
|
|
438
|
+
- `pnpm test:unit`: deterministic tests for local/CI quality checks, excluding model-download integration paths.
|
|
439
|
+
- `pnpm test:integration`: full integration and E2E workflows, including embedding model initialization.
|
|
440
|
+
|
|
441
|
+
Use `RUN_EMBEDDING_INTEGRATION=1` to explicitly opt into network/model-dependent suites.
|
|
442
|
+
|
|
443
|
+
### CI Strategy
|
|
444
|
+
|
|
445
|
+
- `quality.yml` runs on PRs and pushes and enforces the root quality gate (`pnpm check:all`), which includes backend checks and web-ui type/lint/format checks plus unit tests.
|
|
446
|
+
- A nightly scheduled job runs the integration/E2E suite so model-dependent workflows stay healthy without blocking every PR.
|
|
447
|
+
- `publish-npm.yml` publishes to npm on GitHub Releases, validates tag/version alignment, blocks duplicate npm versions, and supports a manual dry-run, while a real publish requires `NPM_TOKEN`.
|
|
448
|
+
|
|
449
|
+
### Project Structure
|
|
450
|
+
|
|
451
|
+
```
|
|
452
|
+
src/
|
|
453
|
+
├── server/ # MCP tool handlers
|
|
454
|
+
├── vectordb/ # LanceDB + hybrid search
|
|
455
|
+
├── chunker/ # Semantic text splitting
|
|
456
|
+
├── embedder/ # Transformers.js wrapper
|
|
457
|
+
├── parser/ # PDF, DOCX, HTML parsing
|
|
458
|
+
├── web/ # Express server + REST API
|
|
459
|
+
└── __tests__/ # Test suites
|
|
460
|
+
|
|
461
|
+
web-ui/ # React frontend
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
## Documentation
|
|
465
|
+
|
|
466
|
+
- [SECURITY.md](SECURITY.md): Security configuration and best practices
|
|
467
|
+
- [.env.example](.env.example): Complete environment variable template
|
|
468
|
+
|
|
469
|
+
## License
|
|
470
|
+
|
|
471
|
+
MIT: free for personal and commercial use.
|
|
472
|
+
|
|
473
|
+
## Acknowledgments
|
|
474
|
+
|
|
475
|
+
Built with [Model Context Protocol](https://modelcontextprotocol.io/), [LanceDB](https://lancedb.com/), and [Transformers.js](https://huggingface.co/docs/transformers.js).
|
|
476
|
+
|
|
477
|
+
> Started as a fork of [mcp-local-rag](https://github.com/shinpr/mcp-local-rag) by [Shinsuke Kagawa](https://github.com/shinpr). Now it’s its own thing.
|
|
478
|
+
> Huge credit to upstream contributors for the foundation, I’ve been iterating hard from there.
|
|
479
|
+
> Local-first dev tools, all the way.
|