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