@romandp/context-memory-mcp 1.0.0 → 1.0.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 +81 -364
- package/docs/api.md +104 -0
- package/docs/architecture.md +40 -0
- package/docs/database.md +49 -0
- package/docs/project-history.md +34 -0
- package/docs/release.md +43 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,335 +1,112 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Context Memory MCP
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Persistent local memory server for AI assistants over the Model Context Protocol (MCP).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
It stores project context in SQLite and exposes:
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- MCP over STDIO
|
|
8
|
+
- HTTP REST API
|
|
9
|
+
- CLI for start/stop/status and maintenance
|
|
8
10
|
|
|
9
|
-
##
|
|
11
|
+
## What It Stores
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
│ │ STDIO │ │ :3001 │ │
|
|
17
|
-
│ └────┬─────┘ └──────┬───────┘ │
|
|
18
|
-
│ └──────┬────────┘ │
|
|
19
|
-
│ ▼ │
|
|
20
|
-
│ ┌─────────────────┐ │
|
|
21
|
-
│ │ better-sqlite3 │ │
|
|
22
|
-
│ │ (WAL mode) │ │
|
|
23
|
-
│ └────────┬────────┘ │
|
|
24
|
-
└─────────────┼─────────────────────┘
|
|
25
|
-
▼
|
|
26
|
-
~/.local/share/mcp-memory/memory.db
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Estructura de datos
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
projects
|
|
33
|
-
├── id, name, description, status
|
|
34
|
-
│
|
|
35
|
-
├── sdd_entries
|
|
36
|
-
│ ├── id, project_id
|
|
37
|
-
│ ├── section (plan | design | tasks | general)
|
|
38
|
-
│ ├── title, content, status, parent_id
|
|
39
|
-
│ └── metadata (JSON)
|
|
40
|
-
│
|
|
41
|
-
├── tasks
|
|
42
|
-
│ ├── id, project_id, sdd_entry_id
|
|
43
|
-
│ ├── title, description
|
|
44
|
-
│ └── status, priority
|
|
45
|
-
│
|
|
46
|
-
├── design_decisions
|
|
47
|
-
│ ├── id, entry_id
|
|
48
|
-
│ ├── decision, rationale
|
|
49
|
-
│ └── alternatives_considered
|
|
50
|
-
│
|
|
51
|
-
├── entry_relationships
|
|
52
|
-
│ ├── id, source_entry_id, target_entry_id
|
|
53
|
-
│ └── relationship_type (depends_on|implements|related_to|supersedes)
|
|
54
|
-
│
|
|
55
|
-
├── classifications (polymorphic)
|
|
56
|
-
│ ├── classifiable_type (project | entry | task)
|
|
57
|
-
│ └── tag, confidence
|
|
58
|
-
│
|
|
59
|
-
├── audit_log
|
|
60
|
-
│ ├── id, entity_type, entity_id
|
|
61
|
-
│ ├── action (created | updated | deleted)
|
|
62
|
-
│ └── changes (JSON), project_id, timestamp
|
|
63
|
-
│
|
|
64
|
-
└── fts_entries (FTS5 virtual table)
|
|
65
|
-
├── entry_id, section, title, content
|
|
66
|
-
└── auto-sincronizada via triggers
|
|
67
|
-
|
|
68
|
-
_migrations (tracking de cambios de schema)
|
|
69
|
-
```
|
|
13
|
+
- Projects
|
|
14
|
+
- Structured entries (`plan`, `design`, `tasks`, `general`)
|
|
15
|
+
- Tasks
|
|
16
|
+
- Design decisions and relationships
|
|
17
|
+
- Derived summaries and compact memory facts for LLM-friendly retrieval
|
|
70
18
|
|
|
71
|
-
|
|
19
|
+
## Install
|
|
72
20
|
|
|
73
|
-
|
|
74
|
-
|------|-----------|
|
|
75
|
-
| Lenguaje | TypeScript (ESM) |
|
|
76
|
-
| MCP SDK | `@modelcontextprotocol/sdk` |
|
|
77
|
-
| HTTP Server | Express 5 |
|
|
78
|
-
| Base de datos | SQLite vía `better-sqlite3` (WAL mode) |
|
|
79
|
-
| Validación | Zod |
|
|
80
|
-
| Tests | Vitest + Supertest |
|
|
21
|
+
Requirements:
|
|
81
22
|
|
|
82
|
-
|
|
23
|
+
- Node.js 18+
|
|
24
|
+
- npm 9+
|
|
83
25
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
### Requisitos
|
|
87
|
-
|
|
88
|
-
- Node.js ≥ 18
|
|
89
|
-
- npm ≥ 9
|
|
90
|
-
|
|
91
|
-
### Instalación global desde release/npm
|
|
26
|
+
Install globally:
|
|
92
27
|
|
|
93
28
|
```bash
|
|
94
|
-
# Instalar última release publicada
|
|
95
29
|
npm install -g @romandp/context-memory-mcp
|
|
96
|
-
|
|
97
|
-
# Ver rutas resueltas y versión
|
|
98
|
-
mcp-memory paths
|
|
99
|
-
mcp-memory version
|
|
100
|
-
|
|
101
|
-
# Iniciar servidor
|
|
102
|
-
mcp-memory start
|
|
103
|
-
|
|
104
|
-
# Ver estado
|
|
105
|
-
mcp-memory status
|
|
106
30
|
```
|
|
107
31
|
|
|
108
|
-
|
|
32
|
+
Or run without installing globally:
|
|
109
33
|
|
|
110
34
|
```bash
|
|
111
35
|
npx -y @romandp/context-memory-mcp@latest stdio
|
|
112
36
|
```
|
|
113
37
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
```bash
|
|
117
|
-
# Actualizar a última release
|
|
118
|
-
npm install -g @romandp/context-memory-mcp@latest
|
|
119
|
-
|
|
120
|
-
# Instalar versión concreta
|
|
121
|
-
npm install -g @romandp/context-memory-mcp@1.0.0
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Releases
|
|
38
|
+
## Quick Start
|
|
125
39
|
|
|
126
|
-
|
|
127
|
-
- El workflow requiere secreto `NPM_TOKEN`
|
|
128
|
-
- El artefacto `.tgz` de la release permite probar instalación sin clonar repo
|
|
129
|
-
|
|
130
|
-
### Desarrollo local
|
|
40
|
+
Start server in background:
|
|
131
41
|
|
|
132
42
|
```bash
|
|
133
|
-
|
|
134
|
-
cd context-memory-mcp
|
|
135
|
-
npm install
|
|
136
|
-
npm run build
|
|
137
|
-
node bin/mcp-memory.js start
|
|
43
|
+
mcp-memory start
|
|
138
44
|
```
|
|
139
45
|
|
|
140
|
-
|
|
46
|
+
Check status:
|
|
141
47
|
|
|
142
48
|
```bash
|
|
143
|
-
mcp-memory
|
|
49
|
+
mcp-memory status
|
|
144
50
|
```
|
|
145
51
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
## Uso
|
|
149
|
-
|
|
150
|
-
### CLI
|
|
52
|
+
Show resolved paths:
|
|
151
53
|
|
|
152
54
|
```bash
|
|
153
|
-
mcp-memory
|
|
154
|
-
mcp-memory stop # Detiene el servidor
|
|
155
|
-
mcp-memory status # Muestra estado (PID, health)
|
|
156
|
-
mcp-memory restart # Reinicia
|
|
157
|
-
mcp-memory logs # Tail de logs
|
|
158
|
-
mcp-memory info # Información del proyecto
|
|
159
|
-
mcp-memory paths # Muestra rutas resueltas
|
|
160
|
-
mcp-memory version # Muestra versión instalada
|
|
161
|
-
mcp-memory rebuild-memory # Regenera summaries/facts compactos
|
|
162
|
-
mcp-memory migrate-db --from /ruta/db.sqlite
|
|
55
|
+
mcp-memory paths
|
|
163
56
|
```
|
|
164
57
|
|
|
165
|
-
|
|
58
|
+
Run MCP server in foreground:
|
|
166
59
|
|
|
167
60
|
```bash
|
|
168
|
-
|
|
169
|
-
npm run stop # stop
|
|
170
|
-
npm run status # status
|
|
171
|
-
npm start # start en foreground
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### API REST
|
|
175
|
-
|
|
176
|
-
El servidor HTTP corre en `http://localhost:3001` (configurable con `HTTP_PORT`).
|
|
177
|
-
|
|
178
|
-
Documentación interactiva disponible en: `http://localhost:3001/api-docs`
|
|
179
|
-
|
|
180
|
-
> Todos los endpoints de listado soportan paginación con `?page=1&limit=50` (max 200).
|
|
181
|
-
> La respuesta incluye `pagination: { page, limit, total, totalPages }`.
|
|
182
|
-
|
|
183
|
-
#### Proyectos
|
|
184
|
-
|
|
61
|
+
mcp-memory stdio
|
|
185
62
|
```
|
|
186
|
-
GET /api/projects → Listar proyectos (?page=&limit=)
|
|
187
|
-
POST /api/projects → Crear proyecto { name, description? }
|
|
188
|
-
GET /api/projects/:id → Proyecto con entries + tasks + clasificaciones
|
|
189
|
-
PUT /api/projects/:id → Actualizar proyecto { name?, status?, description? }
|
|
190
|
-
DELETE /api/projects/:id → Eliminar proyecto (cascade)
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
#### Entradas SDD
|
|
194
|
-
|
|
195
|
-
```
|
|
196
|
-
GET /api/projects/:pid/entries → Listar entradas (?section=&page=&limit=)
|
|
197
|
-
POST /api/projects/:pid/entries → Crear entrada { section, title, content? }
|
|
198
|
-
GET /api/projects/:pid/entries/search?q=texto → Buscar entradas en el proyecto (FTS5, ?page=&limit=)
|
|
199
|
-
GET /api/projects/:pid/entries/:eid → Obtener entrada + clasificaciones
|
|
200
|
-
PUT /api/projects/:pid/entries/:eid → Actualizar entrada
|
|
201
|
-
DELETE /api/projects/:pid/entries/:eid → Eliminar entrada
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
#### Búsqueda global
|
|
205
|
-
|
|
206
|
-
```
|
|
207
|
-
GET /api/entries/search?q=texto → Buscar entradas en todos los proyectos (FTS5, ?page=&limit=)
|
|
208
|
-
GET /api/entries/search?q=texto&view=compact → Resultados compactos optimizados para LLM
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### TOON y vistas compactas
|
|
212
|
-
|
|
213
|
-
Parámetros nuevos en rutas/tools compatibles:
|
|
214
|
-
|
|
215
|
-
- `view=full|summary|compact`
|
|
216
|
-
- `format=json|toon-r|toon-d`
|
|
217
|
-
- `max_items=<n>`
|
|
218
|
-
- `max_chars=<n>`
|
|
219
|
-
- `cursor=<last_id>`
|
|
220
63
|
|
|
221
|
-
|
|
64
|
+
## CLI
|
|
222
65
|
|
|
223
66
|
```bash
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
-
|
|
232
|
-
-
|
|
233
|
-
-
|
|
234
|
-
- `toon-r`: TOON legible para debug
|
|
235
|
-
- `toon-d`: TOON denso para mínimo tamaño
|
|
236
|
-
- `max_items`: corta arrays compactos y marca `truncated`
|
|
237
|
-
- `max_chars`: limita volumen aproximado de texto compacto
|
|
238
|
-
- `cursor`: continúa desde último `id` devuelto en respuesta previa
|
|
239
|
-
- `metrics`: cada respuesta compacta JSON incluye `bytes`, `chars`, `estimated_tokens`
|
|
240
|
-
|
|
241
|
-
Implementación actual:
|
|
242
|
-
|
|
243
|
-
- `summary_short` y `summary_dense` derivadas por entry
|
|
244
|
-
- `memory_facts` derivadas desde entries, decisiones y relaciones
|
|
245
|
-
- FTS5 compacta sobre `fts_entry_summaries` para búsquedas TOON/compact
|
|
246
|
-
- Fallback automático al índice legacy si faltan datos derivados
|
|
247
|
-
|
|
248
|
-
#### Contexto enriquecido
|
|
249
|
-
|
|
250
|
-
```
|
|
251
|
-
GET /api/entries/:eid/context → Entry + decisions + relationships
|
|
252
|
-
GET /api/entries/:eid/summary → Summary derivada compacta
|
|
253
|
-
GET /api/entries/:eid/compact → Contexto compacto/TOON
|
|
254
|
-
GET /api/entries/batch?ids=e1,e2 → Batch compacto por IDs
|
|
255
|
-
POST /api/entries/:eid/decisions → Registrar decisión de diseño { decision, rationale, alternatives_considered? }
|
|
256
|
-
POST /api/entries/:eid/relationships → Relacionar entries { target_entry_id, relationship_type }
|
|
257
|
-
GET /api/facts → Facts derivadas (?project_id=&entry_id=&kind=&page=&limit=&max_items=&max_chars=&cursor=)
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
#### Tareas
|
|
261
|
-
|
|
262
|
-
```
|
|
263
|
-
GET /api/projects/:pid/tasks → Listar tareas (?entry_id=&page=&limit=)
|
|
264
|
-
POST /api/projects/:pid/tasks → Crear tarea { title, priority?, sdd_entry_id? }
|
|
265
|
-
PUT /api/projects/:pid/tasks/:tid → Actualizar tarea { status? }
|
|
266
|
-
DELETE /api/projects/:pid/tasks/:tid → Eliminar tarea
|
|
67
|
+
mcp-memory start
|
|
68
|
+
mcp-memory stop
|
|
69
|
+
mcp-memory status
|
|
70
|
+
mcp-memory restart
|
|
71
|
+
mcp-memory logs
|
|
72
|
+
mcp-memory info
|
|
73
|
+
mcp-memory paths
|
|
74
|
+
mcp-memory version
|
|
75
|
+
mcp-memory rebuild-memory
|
|
76
|
+
mcp-memory migrate-db --from /path/to/old/memory.db
|
|
267
77
|
```
|
|
268
78
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
```
|
|
272
|
-
GET /api/audit → Historial de cambios (?entity_type=&entity_id=&project_id=&page=&limit=)
|
|
273
|
-
```
|
|
79
|
+
## HTTP API
|
|
274
80
|
|
|
275
|
-
|
|
81
|
+
Default base URL:
|
|
276
82
|
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
GET /api/db/download → Descargar el fichero SQLite
|
|
83
|
+
```text
|
|
84
|
+
http://localhost:3001
|
|
280
85
|
```
|
|
281
86
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
El servidor expone estas herramientas vía MCP (STDIO):
|
|
285
|
-
|
|
286
|
-
| Tool | Descripción |
|
|
287
|
-
|------|-------------|
|
|
288
|
-
| `project-create` | Crear proyecto |
|
|
289
|
-
| `project-list` | Listar proyectos (con paginación opcional) |
|
|
290
|
-
| `project-get` | Proyecto completo con entries y tasks |
|
|
291
|
-
| `entry-create` | Crear entrada SDD (plan/design/tasks/general) |
|
|
292
|
-
| `entry-get` | Listar entradas de un proyecto (con paginación opcional) |
|
|
293
|
-
| `entry-search` | Buscar entradas por texto (FTS5, con paginación opcional) |
|
|
294
|
-
| `entry-search-global` | Buscar entradas en todos los proyectos (FTS5, sin project_id) |
|
|
295
|
-
| `entry-update` | Actualizar entrada (title, content, status, section, parent_id) |
|
|
296
|
-
| `entry-delete` | Eliminar entrada |
|
|
297
|
-
| `entry-add-decision` | Registrar decisión de diseño |
|
|
298
|
-
| `entry-add-relationship` | Relacionar dos entradas |
|
|
299
|
-
| `entry-batch-get` | Obtener varias entradas compactas por ID |
|
|
300
|
-
| `entry-get-context` | Obtener entrada + decisions + relationships |
|
|
301
|
-
| `entry-get-summary` | Obtener summary derivada compacta |
|
|
302
|
-
| `task-create` | Crear tarea |
|
|
303
|
-
| `task-list` | Listar tareas de un proyecto (con paginación opcional) |
|
|
304
|
-
| `task-update` | Actualizar estado de tarea |
|
|
305
|
-
| `memory-facts-get` | Consultar facts derivadas |
|
|
306
|
-
| `audit-get` | Consultar historial de cambios (filtros: entity_type, entity_id, project_id) |
|
|
307
|
-
|
|
308
|
-
---
|
|
309
|
-
|
|
310
|
-
## Configuración
|
|
311
|
-
|
|
312
|
-
Variables de entorno (fichero `.env`):
|
|
87
|
+
Swagger UI:
|
|
313
88
|
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
DB_PATH=/ruta/memory.db # Override directo de base de datos
|
|
317
|
-
MCP_MEMORY_HOME=/ruta/base
|
|
318
|
-
LOG_PATH=/ruta/server.log
|
|
319
|
-
PID_PATH=/ruta/server.pid
|
|
89
|
+
```text
|
|
90
|
+
http://localhost:3001/api-docs
|
|
320
91
|
```
|
|
321
92
|
|
|
322
|
-
|
|
93
|
+
Typical endpoints:
|
|
323
94
|
|
|
324
|
-
-
|
|
325
|
-
-
|
|
326
|
-
-
|
|
95
|
+
- `/health`
|
|
96
|
+
- `/api/projects`
|
|
97
|
+
- `/api/projects/:id`
|
|
98
|
+
- `/api/projects/:pid/entries`
|
|
99
|
+
- `/api/projects/:pid/tasks`
|
|
100
|
+
- `/api/entries/:eid/context`
|
|
101
|
+
- `/api/entries/:eid/summary`
|
|
102
|
+
- `/api/entries/batch`
|
|
103
|
+
- `/api/facts`
|
|
327
104
|
|
|
328
|
-
|
|
105
|
+
For full endpoint and MCP tool reference, see `docs/api.md`.
|
|
329
106
|
|
|
330
|
-
##
|
|
107
|
+
## MCP Client Setup
|
|
331
108
|
|
|
332
|
-
|
|
109
|
+
Example `opencode` config:
|
|
333
110
|
|
|
334
111
|
```json
|
|
335
112
|
{
|
|
@@ -344,9 +121,7 @@ Para conectar este servidor MCP desde **opencode**, añade la siguiente configur
|
|
|
344
121
|
}
|
|
345
122
|
```
|
|
346
123
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
Ejemplo sin instalación global permanente:
|
|
124
|
+
Without global install:
|
|
350
125
|
|
|
351
126
|
```json
|
|
352
127
|
{
|
|
@@ -361,94 +136,36 @@ Ejemplo sin instalación global permanente:
|
|
|
361
136
|
}
|
|
362
137
|
```
|
|
363
138
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
### Herramientas MCP disponibles
|
|
367
|
-
|
|
368
|
-
Una vez conectado, opencode tendrá acceso a estas herramientas:
|
|
369
|
-
|
|
370
|
-
| Tool | Descripción |
|
|
371
|
-
|------|-------------|
|
|
372
|
-
| `project-create` | Crear un proyecto nuevo |
|
|
373
|
-
| `project-list` | Listar todos los proyectos |
|
|
374
|
-
| `project-get` | Obtener un proyecto completo con entradas y tareas |
|
|
375
|
-
| `entry-create` | Crear una entrada SDD (plan/design/tasks/general) |
|
|
376
|
-
| `entry-get` | Obtener entradas de un proyecto |
|
|
377
|
-
| `entry-search` | Buscar entradas por texto (FTS5) |
|
|
378
|
-
| `entry-search-global` | Buscar entradas en todos los proyectos |
|
|
379
|
-
| `entry-update` | Actualizar una entrada (title, content, status, section, parent_id) |
|
|
380
|
-
| `entry-delete` | Eliminar una entrada |
|
|
381
|
-
| `entry-add-decision` | Registrar decisión de diseño |
|
|
382
|
-
| `entry-add-relationship` | Relacionar dos entradas |
|
|
383
|
-
| `entry-batch-get` | Obtener varias entradas compactas por ID |
|
|
384
|
-
| `entry-get-context` | Obtener entrada + decisions + relationships |
|
|
385
|
-
| `entry-get-summary` | Obtener summary derivada compacta |
|
|
386
|
-
| `task-create` | Crear una tarea |
|
|
387
|
-
| `task-list` | Listar tareas de un proyecto |
|
|
388
|
-
| `task-update` | Actualizar estado de una tarea |
|
|
389
|
-
| `memory-facts-get` | Consultar facts derivadas |
|
|
390
|
-
| `audit-get` | Consultar historial de cambios de entradas y tareas |
|
|
391
|
-
|
|
392
|
-
---
|
|
393
|
-
|
|
394
|
-
## Tests y calidad
|
|
139
|
+
## Configuration
|
|
395
140
|
|
|
396
|
-
|
|
397
|
-
npm test # Ejecutar tests (Vitest, 137 tests)
|
|
398
|
-
npm run test:watch # Modo watch
|
|
399
|
-
npm run lint # ESLint
|
|
400
|
-
npm run lint:fix # ESLint con auto-fix
|
|
401
|
-
npm run format # Prettier (check)
|
|
402
|
-
npm run format:fix # Prettier (formatear)
|
|
403
|
-
npm run type-check # TypeScript strict check
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
---
|
|
407
|
-
|
|
408
|
-
## Migraciones
|
|
409
|
-
|
|
410
|
-
El schema de la base de datos se gestiona mediante migraciones numeradas en `src/db/migrations/runner.ts`:
|
|
411
|
-
|
|
412
|
-
| Migración | Descripción |
|
|
413
|
-
|-----------|-------------|
|
|
414
|
-
| `001_initial_schema` | Tablas base: projects, sdd_entries, tasks, classifications |
|
|
415
|
-
| `002_add_fts5` | Búsqueda de texto completo (FTS5) con sincronización automática |
|
|
416
|
-
| `003_add_audit_log` | Auditoría de cambios con triggers en entries y tasks |
|
|
417
|
-
| `004_add_context_tables` | Tablas de contexto enriquecido: file_changes (legacy), design_decisions, entry_relationships |
|
|
418
|
-
| `005_add_compact_memory` | Summaries derivadas y memory facts para views compactas / TOON |
|
|
419
|
-
| `006_add_compact_memory_fts` | Índice FTS5 sobre summaries/keywords para búsqueda compacta |
|
|
141
|
+
Supported environment variables:
|
|
420
142
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
## Acceso a la base de datos
|
|
429
|
-
|
|
430
|
-
Primero obtén ruta real:
|
|
431
|
-
|
|
432
|
-
```bash
|
|
433
|
-
mcp-memory paths
|
|
143
|
+
```env
|
|
144
|
+
HTTP_PORT=3001
|
|
145
|
+
DB_PATH=/path/to/memory.db
|
|
146
|
+
MCP_MEMORY_HOME=/path/to/home
|
|
147
|
+
LOG_PATH=/path/to/server.log
|
|
148
|
+
PID_PATH=/path/to/server.pid
|
|
434
149
|
```
|
|
435
150
|
|
|
436
|
-
|
|
151
|
+
Default storage locations:
|
|
437
152
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
153
|
+
- Linux: `~/.local/share/mcp-memory/memory.db` and `~/.local/state/mcp-memory/`
|
|
154
|
+
- macOS: `~/Library/Application Support/mcp-memory/`
|
|
155
|
+
- Windows: `%LOCALAPPDATA%\mcp-memory\`
|
|
441
156
|
|
|
442
|
-
|
|
157
|
+
## Development
|
|
443
158
|
|
|
444
159
|
```bash
|
|
445
|
-
|
|
160
|
+
npm install
|
|
161
|
+
npm run build
|
|
162
|
+
npm test
|
|
446
163
|
```
|
|
447
164
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
O descárgala vía HTTP:
|
|
165
|
+
## Documentation
|
|
451
166
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
167
|
+
- `docs/api.md`: HTTP endpoints and MCP tools
|
|
168
|
+
- `docs/architecture.md`: runtime architecture and data flow
|
|
169
|
+
- `docs/database.md`: schema and migrations
|
|
170
|
+
- `docs/release.md`: install, packaging, and release process
|
|
171
|
+
- `docs/project-history.md`: project history and milestones
|
package/docs/api.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
## HTTP API
|
|
4
|
+
|
|
5
|
+
Base URL:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
http://localhost:3001
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Swagger UI:
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
http://localhost:3001/api-docs
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
List endpoints support pagination with `page` and `limit`.
|
|
18
|
+
|
|
19
|
+
### Projects
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
GET /api/projects
|
|
23
|
+
POST /api/projects
|
|
24
|
+
GET /api/projects/:id
|
|
25
|
+
PUT /api/projects/:id
|
|
26
|
+
DELETE /api/projects/:id
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Entries
|
|
30
|
+
|
|
31
|
+
```text
|
|
32
|
+
GET /api/projects/:pid/entries
|
|
33
|
+
POST /api/projects/:pid/entries
|
|
34
|
+
GET /api/projects/:pid/entries/search?q=...
|
|
35
|
+
GET /api/projects/:pid/entries/:eid
|
|
36
|
+
PUT /api/projects/:pid/entries/:eid
|
|
37
|
+
DELETE /api/projects/:pid/entries/:eid
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Global Search
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
GET /api/entries/search?q=...
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Context and Compact Views
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
GET /api/entries/:eid/context
|
|
50
|
+
GET /api/entries/:eid/summary
|
|
51
|
+
GET /api/entries/:eid/compact
|
|
52
|
+
GET /api/entries/batch?ids=e1,e2
|
|
53
|
+
POST /api/entries/:eid/decisions
|
|
54
|
+
POST /api/entries/:eid/relationships
|
|
55
|
+
GET /api/facts
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Supported compact-response parameters:
|
|
59
|
+
|
|
60
|
+
- `view=full|summary|compact`
|
|
61
|
+
- `format=json|toon-r|toon-d`
|
|
62
|
+
- `max_items=<n>`
|
|
63
|
+
- `max_chars=<n>`
|
|
64
|
+
- `cursor=<last_id>`
|
|
65
|
+
|
|
66
|
+
### Tasks
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
GET /api/projects/:pid/tasks
|
|
70
|
+
POST /api/projects/:pid/tasks
|
|
71
|
+
PUT /api/projects/:pid/tasks/:tid
|
|
72
|
+
DELETE /api/projects/:pid/tasks/:tid
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Audit and Utilities
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
GET /api/audit
|
|
79
|
+
POST /api/classify
|
|
80
|
+
GET /api/db/download
|
|
81
|
+
GET /health
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## MCP Tools
|
|
85
|
+
|
|
86
|
+
- `project-create`
|
|
87
|
+
- `project-list`
|
|
88
|
+
- `project-get`
|
|
89
|
+
- `entry-create`
|
|
90
|
+
- `entry-get`
|
|
91
|
+
- `entry-search`
|
|
92
|
+
- `entry-search-global`
|
|
93
|
+
- `entry-update`
|
|
94
|
+
- `entry-delete`
|
|
95
|
+
- `entry-add-decision`
|
|
96
|
+
- `entry-add-relationship`
|
|
97
|
+
- `entry-batch-get`
|
|
98
|
+
- `entry-get-context`
|
|
99
|
+
- `entry-get-summary`
|
|
100
|
+
- `task-create`
|
|
101
|
+
- `task-list`
|
|
102
|
+
- `task-update`
|
|
103
|
+
- `memory-facts-get`
|
|
104
|
+
- `audit-get`
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Runtime Overview
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
MCP client (STDIO)
|
|
7
|
+
|
|
|
8
|
+
v
|
|
9
|
+
MCP server layer
|
|
10
|
+
|
|
|
11
|
+
+---- HTTP REST server (Express)
|
|
12
|
+
|
|
|
13
|
+
v
|
|
14
|
+
SQLite database
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Main Components
|
|
18
|
+
|
|
19
|
+
- `src/index.ts`: process bootstrap, tool dispatch, HTTP startup
|
|
20
|
+
- `src/server/setup.ts`: MCP server and tool definitions
|
|
21
|
+
- `src/http/routes.ts`: REST routes
|
|
22
|
+
- `src/db/schema.ts`: data access and queries
|
|
23
|
+
- `src/memory/*`: summaries, facts, TOON formatting, compact responses
|
|
24
|
+
- `bin/mcp-memory.js`: CLI wrapper and process management
|
|
25
|
+
|
|
26
|
+
## Retrieval Model
|
|
27
|
+
|
|
28
|
+
The server stores canonical project data in SQLite and derives compact memory artifacts for LLM-friendly access:
|
|
29
|
+
|
|
30
|
+
- entry summaries
|
|
31
|
+
- dense summaries
|
|
32
|
+
- memory facts
|
|
33
|
+
- FTS indexes for compact search
|
|
34
|
+
|
|
35
|
+
Compact retrieval supports:
|
|
36
|
+
|
|
37
|
+
- reduced payloads
|
|
38
|
+
- response budgets
|
|
39
|
+
- cursor pagination
|
|
40
|
+
- JSON or TOON output
|
package/docs/database.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Database
|
|
2
|
+
|
|
3
|
+
## Core Schema
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
projects
|
|
7
|
+
id, name, description, status
|
|
8
|
+
|
|
9
|
+
sdd_entries
|
|
10
|
+
id, project_id, section, title, content, status, parent_id, metadata
|
|
11
|
+
|
|
12
|
+
tasks
|
|
13
|
+
id, project_id, sdd_entry_id, title, description, status, priority
|
|
14
|
+
|
|
15
|
+
design_decisions
|
|
16
|
+
id, entry_id, decision, rationale, alternatives_considered
|
|
17
|
+
|
|
18
|
+
entry_relationships
|
|
19
|
+
id, source_entry_id, target_entry_id, relationship_type
|
|
20
|
+
|
|
21
|
+
classifications
|
|
22
|
+
classifiable_type, classifiable_id, tag, confidence
|
|
23
|
+
|
|
24
|
+
audit_log
|
|
25
|
+
entity_type, entity_id, action, changes, project_id, timestamp
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Derived Memory Tables
|
|
29
|
+
|
|
30
|
+
- `entry_summaries`
|
|
31
|
+
- `memory_facts`
|
|
32
|
+
- `fts_entry_summaries`
|
|
33
|
+
- `fts_entries`
|
|
34
|
+
|
|
35
|
+
## Migrations
|
|
36
|
+
|
|
37
|
+
- `001_initial_schema`
|
|
38
|
+
- `002_add_fts5`
|
|
39
|
+
- `003_add_audit_log`
|
|
40
|
+
- `004_add_context_tables`
|
|
41
|
+
- `005_add_compact_memory`
|
|
42
|
+
- `006_add_compact_memory_fts`
|
|
43
|
+
|
|
44
|
+
Migrations are applied automatically on startup and tracked in `_migrations`.
|
|
45
|
+
|
|
46
|
+
## Notes
|
|
47
|
+
|
|
48
|
+
- SQLite runs in WAL mode
|
|
49
|
+
- Some legacy databases may still contain `file_changes`, but it is not part of the active public model
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Project History
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
- SDD-oriented memory model implemented
|
|
6
|
+
- Full CRUD for projects, entries, and tasks
|
|
7
|
+
- HTTP API and MCP tools available
|
|
8
|
+
- Compact memory and TOON responses added
|
|
9
|
+
- CLI packaging and npm release flow added
|
|
10
|
+
- Test suite passing
|
|
11
|
+
|
|
12
|
+
## Main Milestones
|
|
13
|
+
|
|
14
|
+
### SDD Memory Refactor
|
|
15
|
+
|
|
16
|
+
- replaced older schema with project, entry, task, and classification model
|
|
17
|
+
- added supporting context and relationship tables
|
|
18
|
+
|
|
19
|
+
### Test Coverage
|
|
20
|
+
|
|
21
|
+
- Vitest coverage for database, tools, and HTTP routes
|
|
22
|
+
|
|
23
|
+
### CLI Distribution
|
|
24
|
+
|
|
25
|
+
- installable `mcp-memory` command
|
|
26
|
+
- per-user runtime storage
|
|
27
|
+
- database migration and rebuild commands
|
|
28
|
+
|
|
29
|
+
### Compact Memory
|
|
30
|
+
|
|
31
|
+
- derived summaries and facts
|
|
32
|
+
- compact views
|
|
33
|
+
- TOON formats
|
|
34
|
+
- compact FTS search
|
package/docs/release.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Release and Installation
|
|
2
|
+
|
|
3
|
+
## Package
|
|
4
|
+
|
|
5
|
+
Published package:
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
@romandp/context-memory-mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g @romandp/context-memory-mcp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx -y @romandp/context-memory-mcp@latest stdio
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Runtime Paths
|
|
22
|
+
|
|
23
|
+
Defaults:
|
|
24
|
+
|
|
25
|
+
- Linux: `~/.local/share/mcp-memory/memory.db` and `~/.local/state/mcp-memory/`
|
|
26
|
+
- macOS: `~/Library/Application Support/mcp-memory/`
|
|
27
|
+
- Windows: `%LOCALAPPDATA%\mcp-memory\`
|
|
28
|
+
|
|
29
|
+
## Maintenance Commands
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
mcp-memory version
|
|
33
|
+
mcp-memory paths
|
|
34
|
+
mcp-memory status
|
|
35
|
+
mcp-memory rebuild-memory
|
|
36
|
+
mcp-memory migrate-db --from /path/to/old/memory.db
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Release Flow
|
|
40
|
+
|
|
41
|
+
- Tagging `v*` triggers `.github/workflows/release.yml`
|
|
42
|
+
- Workflow installs dependencies, runs tests, builds, packs, publishes to npm, and creates a GitHub Release
|
|
43
|
+
- Current workflow uses `NPM_TOKEN` for npm publish
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@romandp/context-memory-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Local SQLite-backed MCP server for AI memory and project context.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"dist",
|
|
9
9
|
"bin",
|
|
10
|
-
"README.md"
|
|
10
|
+
"README.md",
|
|
11
|
+
"docs"
|
|
11
12
|
],
|
|
12
13
|
"bin": {
|
|
13
14
|
"mcp-memory": "./bin/mcp-memory.js"
|