rag-memory-epf-mcp 1.8.0 → 2.0.0

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 CHANGED
@@ -5,38 +5,19 @@
5
5
  [![GitHub license](https://img.shields.io/github/license/heesongkoh/rag-memory-epf-mcp)](https://github.com/heesongkoh/rag-memory-epf-mcp/blob/main/LICENSE)
6
6
  [![Platforms](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-blue)](https://github.com/heesongkoh/rag-memory-epf-mcp)
7
7
 
8
- An advanced MCP server for **project-local RAG memory** through a knowledge graph with **multilingual vector search** capabilities.
8
+ A **project-local RAG memory** MCP server knowledge graph + multilingual vector search + FTS5 full-text search, all in a single SQLite file per project.
9
9
 
10
- **Each project folder gets its own isolated memory database** — set `DB_FILE_PATH` to a project-local `.memory/rag-memory.db` so every project maintains its own entities, relations, and documents independently. Multiple projects can run simultaneously without interference since they read/write to separate SQLite databases while sharing the same server binary.
10
+ ## Key Features
11
11
 
12
- **Fork of:** [rag-memory-mcp](https://github.com/ttommyth/rag-memory-mcp) upgraded with **Qwen3-Embedding-0.6B** (1024-dim, 100+ languages) for significantly better multilingual semantic search.
13
-
14
- ## What's Different
15
-
16
- | | rag-memory-mcp (original) | rag-memory-epf-mcp (this fork) |
17
- |---|---|---|
18
- | **Embedding Model** | all-MiniLM-L12-v2 | **Qwen3-Embedding-0.6B** |
19
- | **Dimensions** | 384 | **1024** |
20
- | **Languages** | English only | **100+ (Korean, Chinese, Japanese, Arabic, etc.)** |
21
- | **MTEB Score** | ~49 | **63.0+** |
22
- | **Max Tokens** | 256 | **8192** |
23
- | **Unicode Support** | ASCII only fallback | **Full Unicode (CJK, Arabic, Cyrillic, etc.)** |
24
- | **Auto Entity Linking** | None | **Chunk-level with word boundary + CJK support** |
12
+ - **Project-local isolation**each project gets its own `.memory/rag-memory.db`. Multiple projects run simultaneously without interference.
13
+ - **3-signal hybrid search** — vector similarity (Qwen3-Embedding-0.6B, 1024-dim) + FTS5 BM25 keyword matching + knowledge graph re-ranking, combined via Reciprocal Rank Fusion
14
+ - **100+ languages** — Korean, Chinese, Japanese, Arabic, and more. Cross-lingual search works out of the box.
15
+ - **27 MCP tools** — entity/relation CRUD, document pipeline, multi-hop graph traversal, export/import, temporal queries
16
+ - **SQLite optimized** WAL mode, 32MB cache, 256MB mmap, FTS5 triggers, 7 indexes
17
+ - **MCP SDK 1.27.1** — Tool Annotations (readOnly/destructive/idempotent), latest protocol 2025-11-25
25
18
 
26
19
  ## Quick Start
27
20
 
28
- ```json
29
- {
30
- "mcpServers": {
31
- "rag-memory": {
32
- "command": "npx",
33
- "args": ["-y", "rag-memory-epf-mcp@latest"]
34
- }
35
- }
36
- }
37
- ```
38
-
39
- **Project-local memory (recommended):**
40
21
  ```json
41
22
  {
42
23
  "mcpServers": {
@@ -51,154 +32,137 @@ An advanced MCP server for **project-local RAG memory** through a knowledge grap
51
32
  }
52
33
  ```
53
34
 
54
- Place this `.mcp.json` in each project folder with its own `DB_FILE_PATH`. Each project maintains completely isolated memory — entities, relations, and documents are never mixed between projects.
35
+ Place this `.mcp.json` in each project folder with its own `DB_FILE_PATH`. Each project maintains completely isolated memory.
36
+
37
+ ## Tools (27)
38
+
39
+ ### Knowledge Graph (7)
40
+ | Tool | Description | Annotation |
41
+ |------|------------|------------|
42
+ | `createEntities` | Create entities with observations and types (upsert) | idempotent |
43
+ | `createRelations` | Establish relationships between entities | idempotent |
44
+ | `addObservations` | Add contextual information to entities (dedup) | idempotent |
45
+ | `updateRelations` | Update relationship confidence and metadata | idempotent |
46
+ | `deleteEntities` | Remove entities and relationships | destructive |
47
+ | `deleteRelations` | Remove specific relationships | destructive |
48
+ | `deleteObservations` | Remove specific observations | destructive |
49
+
50
+ ### Document Pipeline (8)
51
+ | Tool | Description | Annotation |
52
+ |------|------------|------------|
53
+ | `storeDocument` | Store documents with metadata | idempotent |
54
+ | `chunkDocument` | Create text chunks with configurable parameters | — |
55
+ | `embedChunks` | Generate 1024-dim embeddings + auto-link entities | idempotent |
56
+ | `embedAllEntities` | Batch embed all entities (32 parallel) | idempotent |
57
+ | `extractTerms` | Extract potential entity terms | — |
58
+ | `linkEntitiesToDocument` | Manually link entities to document chunks | idempotent |
59
+ | `deleteDocuments` | Remove documents and associated data | destructive |
60
+ | `listDocuments` | View all stored documents | readOnly |
61
+
62
+ ### Search & Retrieval (9)
63
+ | Tool | Description | Annotation |
64
+ |------|------------|------------|
65
+ | `hybridSearch` | Vector + FTS5 BM25 + graph traversal (3-signal) | readOnly |
66
+ | `searchNodes` | Semantic entity search with `since`/`until` temporal filtering | readOnly |
67
+ | `openNodes` | Retrieve specific entities by name | readOnly |
68
+ | `readGraph` | Get complete knowledge graph | readOnly |
69
+ | `getNeighbors` | Multi-hop graph traversal (depth 1-5, cycle detection) | readOnly |
70
+ | `getDetailedContext` | Get full context for a chunk | readOnly |
71
+ | `exportGraph` | Export full graph as JSON (backup) | readOnly |
72
+ | `importGraph` | Import graph from JSON (merge or replace) | destructive |
73
+ | `getKnowledgeGraphStats` | Knowledge base statistics | readOnly |
74
+
75
+ ### Migration (3)
76
+ | Tool | Description | Annotation |
77
+ |------|------------|------------|
78
+ | `getMigrationStatus` | Check database schema version | readOnly |
79
+ | `runMigrations` | Apply pending migrations | idempotent |
80
+ | `rollbackMigration` | Revert to a previous schema version | destructive |
55
81
 
56
82
  ## Document Processing Pipeline
57
83
 
58
- `embedChunks` automatically links entities to the specific chunks where they appear:
59
-
60
84
  ```
61
85
  storeDocument(id, content, metadata)
62
- |
63
- chunkDocument(documentId, maxTokens, overlap)
64
- |
65
- embedChunks(documentId)
66
- |-- generates vector embeddings for each chunk
67
- |-- auto-links entities to chunks where they appear (chunk-level precision)
68
- +-- returns { embeddedChunks, linkedEntities }
69
-
70
- linkEntitiesToDocument(documentId, entityNames)
71
- +-- [optional] manually link additional entities that auto-linking missed
86
+ → chunkDocument(documentId, maxTokens, overlap)
87
+ → embedChunks(documentId)
88
+ ├── generates vector embeddings for each chunk
89
+ ├── auto-links entities to chunks (word boundary + CJK aware)
90
+ └── returns { embeddedChunks, linkedEntities }
72
91
  ```
73
92
 
74
- ### Auto Entity Linking (v1.5.0+)
75
-
76
- When `embedChunks` runs, it automatically:
77
-
78
- - **Chunk-level matching** entities are linked only to chunks where they actually appear, not all chunks
79
- - **Word boundary matching** — for Latin text, prevents partial-word false matches (e.g. "Phase" won't match "multiphase")
80
- - **CJK-aware matching** — Korean/Chinese/Japanese entity names use substring matching (word boundaries don't apply)
81
- - **Observation-derived aliases** — file paths and identifiers from entity observations are also matched
82
- - **Smart length thresholds** — min 2 chars for CJK entities, min 4 chars for Latin entities
83
-
84
- ## Migration
85
-
86
- ### From rag-memory-mcp (original)
87
-
88
- 1. Replace `rag-memory-mcp` with `rag-memory-epf-mcp@latest` in your config
89
- 2. Migrations run automatically (384 -> 1024 dimensions)
90
- 3. Re-embed your data:
91
- - `embedAllEntities()` re-embeds all entities
92
- - `embedChunks(documentId)` — re-embeds each document's chunks
93
-
94
- ### From rag-memory-epf-mcp v1.2.x (jina-v5-nano)
95
-
96
- 1. Update to `rag-memory-epf-mcp@latest`
97
- 2. Migration v5 runs automatically (768 -> 1024 dimensions)
98
- 3. Re-embed your data (same commands as above)
99
-
100
- Your entities, relationships, documents, and chunk text are preserved. Only vector embeddings are regenerated.
101
-
102
- ## Tools
103
-
104
- ### Document Management
105
- - `storeDocument`: Store documents with metadata
106
- - `chunkDocument`: Create text chunks with configurable parameters
107
- - `embedChunks`: Generate 1024-dim vector embeddings + auto-link entities (chunk-level)
108
- - `extractTerms`: Extract potential entity terms
109
- - `linkEntitiesToDocument`: Manually create entity-document associations
110
- - `deleteDocuments`: Remove documents and associated data
111
- - `listDocuments`: View all stored documents
112
-
113
- ### Knowledge Graph
114
- - `createEntities`: Create entities with observations and types
115
- - `createRelations`: Establish relationships between entities
116
- - `addObservations`: Add contextual information to entities
117
- - `updateRelations`: Update relationship confidence and metadata
118
- - `deleteEntities`: Remove entities and relationships
119
- - `deleteRelations`: Remove specific relationships
120
- - `deleteObservations`: Remove specific observations
121
- - `embedAllEntities`: Generate embeddings for all entities (batch 32 parallel)
122
-
123
- ### Search & Retrieval
124
- - `hybridSearch`: Vector + FTS5 BM25 + graph traversal (3-signal hybrid)
125
- - `searchNodes`: Semantic entity search (multilingual, with since/until temporal filtering)
126
- - `openNodes`: Retrieve specific entities
127
- - `readGraph`: Get complete knowledge graph
128
- - `getDetailedContext`: Get full context for a chunk
129
-
130
- ### Backup & Migration
131
- - `exportGraph`: Export full knowledge graph as JSON (entities, relations, documents)
132
- - `importGraph`: Import knowledge graph from JSON (merge or replace mode)
133
- - `getKnowledgeGraphStats`: Knowledge base statistics
134
- - `getMigrationStatus`: Check database schema version
135
- - `runMigrations`: Apply pending migrations
136
- - `rollbackMigration`: Revert to a previous schema version
93
+ ## Architecture
94
+
95
+ ```
96
+ ┌─────────────────────────────────────────────┐
97
+ │ MCP Client (Claude Code, Gemini CLI, etc) │
98
+ └──────────────────┬──────────────────────────┘
99
+ stdio (MCP SDK 1.27.1)
100
+ ┌──────────────────▼──────────────────────────┐
101
+ │ rag-memory-epf-mcp │
102
+ │ ┌────────────┐ ┌─────────────┐ ┌────────┐ │
103
+ │ │ Knowledge │ │ RAG Document│ │ Search │ │
104
+ │ │ Graph CRUD │ │ Pipeline │ │ Engine │ │
105
+ │ └─────┬──────┘ └──────┬──────┘ └───┬────┘ │
106
+ │ │ │ │ │
107
+ │ ┌─────▼───────────────▼────────────▼─────┐ │
108
+ │ │ SQLite (WAL mode, per-project file) │ │
109
+ │ │ ├── entities + relationships │ │
110
+ │ │ ├── documents + chunk_metadata │ │
111
+ │ │ ├── chunks (sqlite-vec, 1024-dim) │ │
112
+ │ │ ├── entity_embeddings (sqlite-vec) │ │
113
+ │ │ ├── entities_fts + chunks_fts (FTS5) │ │
114
+ │ │ └── 7 migrations (auto-applied) │ │
115
+ │ └────────────────────────────────────────┘ │
116
+ │ │
117
+ │ Qwen3-Embedding-0.6B (ONNX, 100+ langs)
118
+ └──────────────────────────────────────────────┘
119
+ ```
120
+
121
+ ## Environment Variables
122
+
123
+ | Variable | Default | Description |
124
+ |----------|---------|-------------|
125
+ | `DB_FILE_PATH` | `rag-memory.db` (server dir) | Path to project-local SQLite database |
126
+ | `EMBEDDING_MODEL` | `onnx-community/Qwen3-Embedding-0.6B-ONNX` | HuggingFace model ID for embeddings |
137
127
 
138
128
  ## Changelog
139
129
 
140
- ### v1.7.0
130
+ ### v1.9.0
131
+ - **Multi-hop graph traversal** — `getNeighbors` tool with `WITH RECURSIVE` CTE, depth 1-5, cycle detection, bidirectional
132
+ - **Embedding LRU cache** — 500-entry in-memory cache, skips redundant re-computation
133
+ - **Configurable model** — `EMBEDDING_MODEL` env var to use alternative embedding models
134
+ - 27 tools total
135
+
136
+ ### v1.8.0
137
+ - **MCP SDK 1.27.1** — protocol 2025-11-25, security fix GHSA-345p-7cg4-v4c7 (CVSS 7.1)
138
+ - **Tool Annotations** — all 27 tools annotated (readOnlyHint, destructiveHint, idempotentHint)
139
+ - **SIGTERM graceful shutdown** — clean exit without ONNX mutex crash
141
140
 
142
- - **SQLite optimization** — WAL mode, 32MB cache, 256MB mmap, busy_timeout for concurrent access
143
- - **FTS5 full-text search** — keyword-exact matching via BM25, combined with vector search using Reciprocal Rank Fusion (RRF, k=60)
144
- - **updateRelations** — update relationship confidence scores and metadata without delete+recreate
145
- - **exportGraph / importGraph** — JSON backup and restore with merge or replace mode
146
- - **Batch embedding** — `embedAllEntities` processes 32 entities in parallel instead of sequential
147
- - **Temporal filtering** — `searchNodes` supports `since` and `until` (ISO 8601) date filters
141
+ ### v1.7.0
142
+ - **SQLite optimization** — WAL mode, 32MB cache, 256MB mmap, busy_timeout
143
+ - **FTS5 full-text search** — BM25 keyword matching + Reciprocal Rank Fusion with vector search
144
+ - **updateRelations** — update confidence scores and metadata without delete+recreate
145
+ - **exportGraph / importGraph** — JSON backup and restore (merge or replace)
146
+ - **Batch embedding** — `embedAllEntities` processes 32 entities in parallel
147
+ - **Temporal filtering** — `searchNodes` with `since`/`until` ISO 8601 date filters
148
148
  - **better-sqlite3 12.x** — SQLite 3.51.3 with query planner improvements
149
149
  - **sqlite-vec 0.1.7** — DELETE space reclaim, KNN distance constraints
150
- - **Missing indexes** — entityType, relationType, chunk lookups for faster queries
151
- - **SQL safety** — `safeRowid()` validation for vec0 virtual table operations
150
+ - **DB indexes** — entityType, relationType, chunk lookups
151
+ - **SQL safety** — `safeRowid()` validation for vec0 operations
152
152
 
153
153
  ### v1.6.0
154
-
155
- - **Entity upsert** — `createEntities` now merges new observations into existing entities instead of silently ignoring duplicates. Entity type is also updated if a more specific type is provided.
156
- - **Automatic observation timestamps** — all new observations are prefixed with `[YYYY-MM-DD]` for staleness tracking. Existing dated observations are preserved as-is.
157
- - **Dedup by content** — date prefixes are stripped when comparing observations to prevent duplicate entries with different dates.
154
+ - **Entity upsert** — merges new observations into existing entities instead of ignoring duplicates
155
+ - **Observation timestamps** — auto `[YYYY-MM-DD]` prefix for staleness tracking
156
+ - **Dedup by content** — date-stripped comparison prevents duplicate observations
158
157
 
159
158
  ### v1.5.0
159
+ - **Chunk-level entity linking** — precision linking to specific chunks, not all chunks
160
+ - **Word boundary + CJK matching** — Latin word boundaries, CJK substring matching
161
+ - **Observation-derived aliases** — file paths from observations matched against chunks
160
162
 
161
- - **Improved auto entity linking** — chunk-level precision instead of linking to all chunks
162
- - **Word boundary matching** Latin entity names use regex word boundaries to prevent partial matches
163
- - **CJK-aware matching** Korean/Chinese/Japanese names use substring matching with lower min-length threshold (2 chars vs 4)
164
- - **Observation-derived aliases** — file paths from entity observations are matched against chunk text
165
- - **README overhaul** — added pipeline diagram, auto-linking docs, changelog section
166
-
167
- ### v1.4.2
168
-
169
- - fp16 quantization for embeddings
170
- - Auto-link entities after `embedChunks` (document-level, basic substring match)
171
-
172
- ### v1.4.1
173
-
174
- - Qwen3 instruction prefix optimization
175
- - Entity embedding text format improvements
176
-
177
- ### v1.4.0
178
-
179
- - Switched embedding model to **Qwen3-Embedding-0.6B** (1024-dim, 100+ languages)
180
- - Replaced BGE-M3 for better multilingual performance
181
-
182
- ### v1.3.x
183
-
184
- - Cross-lingual graph boost via entity vector search
185
- - Korean + acronym + partial matching improvements
186
- - Unicode/Korean fallback embedding fixes
187
-
188
- ### v1.2.x
189
-
190
- - jina-v5-nano embedding model (768-dim)
191
- - Initial multilingual support
192
-
193
- ### v1.0.0
194
-
195
- - Initial fork from rag-memory-mcp
196
- - BGE-M3 embedding model (1024-dim)
197
- - sqlite-vec vector search
198
-
199
- ## Environment Variables
200
-
201
- - `DB_FILE_PATH`: Path to the SQLite database file (default: `rag-memory.db` in the server directory)
163
+ ### v1.4.x
164
+ - Switched to **Qwen3-Embedding-0.6B** (1024-dim, 100+ languages, MTEB 63.0+)
165
+ - fp16 quantization, instruction prefix optimization
202
166
 
203
167
  ## Development
204
168
 
@@ -211,17 +175,17 @@ npm run build
211
175
 
212
176
  ## License
213
177
 
214
- This MCP server code is licensed under the **MIT License**. See [LICENSE](LICENSE) for details.
178
+ MIT License. See [LICENSE](LICENSE).
215
179
 
216
180
  ### Third-Party Model Licenses
217
181
 
218
182
  | Component | License | Details |
219
183
  |-----------|---------|---------|
220
- | **Qwen3-Embedding-0.6B** | Apache 2.0 | Embedding model by Alibaba Qwen team. [Model card](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B) |
184
+ | **Qwen3-Embedding-0.6B** | Apache 2.0 | [Model card](https://huggingface.co/Qwen/Qwen3-Embedding-0.6B) |
221
185
  | **@huggingface/transformers** | Apache 2.0 | JS inference runtime |
222
186
 
223
- Apache 2.0 is compatible with MIT for downstream use. The model weights are downloaded at runtime via Hugging Face and are not bundled in this package.
187
+ Model weights are downloaded at runtime and not bundled in this package.
224
188
 
225
189
  ---
226
190
 
227
- **Built with**: TypeScript, SQLite, sqlite-vec, Hugging Face Transformers (Qwen3-Embedding-0.6B), Model Context Protocol SDK
191
+ **Built with**: TypeScript, SQLite (WAL + FTS5 + sqlite-vec), Qwen3-Embedding-0.6B, MCP SDK 1.27.1