@slorenzot/memento-mcp-server 1.0.0 → 2.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.es.md +493 -0
- package/README.md +122 -120
- package/commands/memento-recents.md +30 -0
- package/commands/memento-status.md +33 -0
- package/dist/__tests__/helpers.d.ts +80 -0
- package/dist/__tests__/helpers.d.ts.map +1 -0
- package/dist/__tests__/helpers.js +152 -0
- package/dist/__tests__/helpers.js.map +1 -0
- package/dist/formatters.d.ts +124 -0
- package/dist/formatters.d.ts.map +1 -0
- package/dist/formatters.js +339 -0
- package/dist/formatters.js.map +1 -0
- package/dist/index.js +25 -609
- package/dist/index.js.map +1 -1
- package/dist/tools.d.ts +19 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +951 -0
- package/dist/tools.js.map +1 -0
- package/package.json +8 -6
- package/skills/memento/SKILL.md +149 -168
package/README.es.md
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
# @slorenzot/memento-mcp-server
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@slorenzot/memento-mcp-server)
|
|
4
|
+
[](https://creativecommons.org/licenses/by-nc-nd/4.0/)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
[](https://modelcontextprotocol.io)
|
|
7
|
+
|
|
8
|
+
> Model Context Protocol (MCP) server providing 15 memory tools for AI agent integration with Claude Desktop, VS Code, and other MCP clients.
|
|
9
|
+
|
|
10
|
+
## 🚀 Instalación
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
# Using Bun (recomendado)
|
|
14
|
+
bun add @slorenzot/memento-mcp-server
|
|
15
|
+
|
|
16
|
+
# Using npm
|
|
17
|
+
npm install @slorenzot/memento-mcp-server
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 💡 Uso Básico
|
|
21
|
+
|
|
22
|
+
### TypeScript
|
|
23
|
+
```typescript
|
|
24
|
+
import { MCPServer } from '@slorenzot/memento-mcp-server';
|
|
25
|
+
|
|
26
|
+
// Inicializar servidor MCP
|
|
27
|
+
const server = new MCPServer('./data/memento.db');
|
|
28
|
+
|
|
29
|
+
// Iniciar servidor (usa stdio para comunicación MCP)
|
|
30
|
+
// Nota: Este servidor está diseñado para ser ejecutado por clientes MCP
|
|
31
|
+
// No es necesario llamar start() manualmente en producción
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Shell/Bun
|
|
35
|
+
```bash
|
|
36
|
+
# Ejecutar servidor MCP (recomendado)
|
|
37
|
+
npx -p @slorenzot/memento-mcp-server
|
|
38
|
+
|
|
39
|
+
# O usando bunx (si está instalado globalmente)
|
|
40
|
+
bunx @slorenzot/memento-mcp-server
|
|
41
|
+
|
|
42
|
+
# Usar con variable de entorno para base de datos personalizada
|
|
43
|
+
MEMENTO_DB_PATH=/custom/path/database.db npx -p @slorenzot/memento-mcp-server
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 🔧 API Esencial
|
|
47
|
+
|
|
48
|
+
### Clase Principal
|
|
49
|
+
|
|
50
|
+
#### `MCPServer(dbPath?: string)`
|
|
51
|
+
|
|
52
|
+
Constructor del servidor MCP con integración automática al motor de memoria.
|
|
53
|
+
|
|
54
|
+
**Parámetros:**
|
|
55
|
+
- `dbPath` (opcional): Ruta al archivo de base de datos. Default: `'./data/memento.db'`
|
|
56
|
+
|
|
57
|
+
**Ejemplo:**
|
|
58
|
+
```typescript
|
|
59
|
+
const server = new MCPServer('./custom/path.db');
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
#### Métodos de Control
|
|
65
|
+
|
|
66
|
+
##### `start()`
|
|
67
|
+
|
|
68
|
+
Inicia el servidor MCP y comienza a escuchar solicitudes MCP via stdio.
|
|
69
|
+
|
|
70
|
+
**Retorna:** `Promise<void>`
|
|
71
|
+
|
|
72
|
+
**Nota:** Este método es llamado automáticamente cuando el servidor se inicia como proceso independiente.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
##### `close()`
|
|
77
|
+
|
|
78
|
+
Detiene el servidor MCP y cierra la conexión con la base de datos.
|
|
79
|
+
|
|
80
|
+
**Retorna:** `void`
|
|
81
|
+
|
|
82
|
+
**Ejemplo:**
|
|
83
|
+
```typescript
|
|
84
|
+
const server = new MCPServer();
|
|
85
|
+
|
|
86
|
+
// En cleanup o shutdown
|
|
87
|
+
server.close();
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## 🛠️ Herramientas MCP Disponibles
|
|
93
|
+
|
|
94
|
+
El servidor proporciona 15 herramientas MCP para gestión de memoria:
|
|
95
|
+
|
|
96
|
+
### Gestión de Observaciones
|
|
97
|
+
|
|
98
|
+
#### `mem_save`
|
|
99
|
+
Guarda una nueva observación en la memoria.
|
|
100
|
+
|
|
101
|
+
**Parámetros:**
|
|
102
|
+
```typescript
|
|
103
|
+
{
|
|
104
|
+
title: string;
|
|
105
|
+
content: string;
|
|
106
|
+
type?: 'decision' | 'bug' | 'discovery' | 'note';
|
|
107
|
+
topic_key?: string;
|
|
108
|
+
project_id?: string;
|
|
109
|
+
metadata?: Record<string, unknown>;
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Ejemplo de uso:**
|
|
114
|
+
```typescript
|
|
115
|
+
await mem_save({
|
|
116
|
+
title: 'Decisión de arquitectura',
|
|
117
|
+
content: 'Usar PostgreSQL en lugar de MySQL',
|
|
118
|
+
type: 'decision',
|
|
119
|
+
project_id: 'my-project'
|
|
120
|
+
});
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
#### `mem_search`
|
|
126
|
+
Busca observaciones usando búsqueda full-text.
|
|
127
|
+
|
|
128
|
+
**Parámetros:**
|
|
129
|
+
```typescript
|
|
130
|
+
{
|
|
131
|
+
query?: string;
|
|
132
|
+
type?: 'decision' | 'bug' | 'discovery' | 'note';
|
|
133
|
+
project_id?: string;
|
|
134
|
+
topic_key?: string;
|
|
135
|
+
limit?: number;
|
|
136
|
+
offset?: number;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
#### `mem_get_observation`
|
|
143
|
+
Obtiene una observación específica por ID.
|
|
144
|
+
|
|
145
|
+
**Parámetros:**
|
|
146
|
+
```typescript
|
|
147
|
+
{
|
|
148
|
+
id: number;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
#### `mem_update`
|
|
155
|
+
Actualiza una observación existente.
|
|
156
|
+
|
|
157
|
+
**Parámetros:**
|
|
158
|
+
```typescript
|
|
159
|
+
{
|
|
160
|
+
id: number;
|
|
161
|
+
title?: string;
|
|
162
|
+
content?: string;
|
|
163
|
+
type?: 'decision' | 'bug' | 'discovery' | 'note';
|
|
164
|
+
topic_key?: string;
|
|
165
|
+
metadata?: Record<string, unknown>;
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
#### `mem_delete`
|
|
172
|
+
Elimina una observación por ID.
|
|
173
|
+
|
|
174
|
+
**Parámetros:**
|
|
175
|
+
```typescript
|
|
176
|
+
{
|
|
177
|
+
id: number;
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### Gestión de Sesiones
|
|
184
|
+
|
|
185
|
+
#### `mem_session_start`
|
|
186
|
+
Inicia una nueva sesión para seguimiento de conversaciones.
|
|
187
|
+
|
|
188
|
+
**Parámetros:**
|
|
189
|
+
```typescript
|
|
190
|
+
{
|
|
191
|
+
project_id: string;
|
|
192
|
+
metadata?: Record<string, unknown>;
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
#### `mem_session_end`
|
|
199
|
+
Finaliza una sesión activa.
|
|
200
|
+
|
|
201
|
+
**Parámetros:**
|
|
202
|
+
```typescript
|
|
203
|
+
{
|
|
204
|
+
id: number;
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
#### `mem_list_sessions`
|
|
211
|
+
Lista todas las sesiones del proyecto.
|
|
212
|
+
|
|
213
|
+
**Parámetros:**
|
|
214
|
+
```typescript
|
|
215
|
+
{
|
|
216
|
+
project_id?: string;
|
|
217
|
+
limit?: number;
|
|
218
|
+
offset?: number;
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
#### `mem_get_session`
|
|
225
|
+
Obtiene una sesión específica.
|
|
226
|
+
|
|
227
|
+
**Parámetros:**
|
|
228
|
+
```typescript
|
|
229
|
+
{
|
|
230
|
+
id: number;
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### Herramientas de Utilidad
|
|
237
|
+
|
|
238
|
+
#### `mem_timeline`
|
|
239
|
+
Obtiene una línea temporal de observaciones.
|
|
240
|
+
|
|
241
|
+
**Parámetros:**
|
|
242
|
+
```typescript
|
|
243
|
+
{
|
|
244
|
+
project_id?: string;
|
|
245
|
+
session_id?: number;
|
|
246
|
+
limit?: number;
|
|
247
|
+
offset?: number;
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
#### `mem_stats`
|
|
254
|
+
Obtiene estadísticas del sistema de memoria.
|
|
255
|
+
|
|
256
|
+
**Retorna:** Métricas de uso, totales por tipo, etc.
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
#### `mem_import`
|
|
261
|
+
Importa observaciones desde JSON.
|
|
262
|
+
|
|
263
|
+
**Parámetros:**
|
|
264
|
+
```typescript
|
|
265
|
+
{
|
|
266
|
+
data: Array<{
|
|
267
|
+
title: string;
|
|
268
|
+
content: string;
|
|
269
|
+
type?: string;
|
|
270
|
+
project_id?: string;
|
|
271
|
+
}>;
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
#### `mem_export`
|
|
278
|
+
Exporta observaciones a JSON.
|
|
279
|
+
|
|
280
|
+
**Parámetros:**
|
|
281
|
+
```typescript
|
|
282
|
+
{
|
|
283
|
+
project_id?: string;
|
|
284
|
+
type?: string;
|
|
285
|
+
limit?: number;
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
### Herramientas de Sistema
|
|
292
|
+
|
|
293
|
+
#### `mem_health`
|
|
294
|
+
Verifica el estado del sistema de memoria.
|
|
295
|
+
|
|
296
|
+
**Retorna:** Estado de conexión, salud de base de datos, etc.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
#### `mem_config`
|
|
301
|
+
Obtiene la configuración actual del servidor.
|
|
302
|
+
|
|
303
|
+
**Retorna:** Configuración de rutas, versión, etc.
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## ⚡ Ejemplos Prácticos
|
|
308
|
+
|
|
309
|
+
### Ejemplo 1: Integración con Claude Desktop
|
|
310
|
+
|
|
311
|
+
```json
|
|
312
|
+
{
|
|
313
|
+
"mcpServers": {
|
|
314
|
+
"memento": {
|
|
315
|
+
"command": "bun",
|
|
316
|
+
"args": ["run", "node_modules/@slorenzot/memento-mcp-server/dist/index.js"],
|
|
317
|
+
"env": {
|
|
318
|
+
"DATABASE_PATH": "./data/memento.db"
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Ejemplo 2: Uso Programático del Servidor
|
|
326
|
+
|
|
327
|
+
```typescript
|
|
328
|
+
import { MCPServer } from '@slorenzot/memento-mcp-server';
|
|
329
|
+
|
|
330
|
+
// Crear servidor personalizado
|
|
331
|
+
const server = new MCPServer('./memory.db');
|
|
332
|
+
|
|
333
|
+
// El servidor manejará automáticamente solicitudes MCP
|
|
334
|
+
// cuando sea ejecutado por un cliente MCP
|
|
335
|
+
|
|
336
|
+
// Para control manual (testing)
|
|
337
|
+
const toolResult = await server.handleToolCall('mem_save', {
|
|
338
|
+
title: 'Test observación',
|
|
339
|
+
content: 'Contenido de prueba',
|
|
340
|
+
type: 'note',
|
|
341
|
+
project_id: 'test-project'
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
console.log('Resultado:', toolResult);
|
|
345
|
+
|
|
346
|
+
// Cerrar cuando termine
|
|
347
|
+
server.close();
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Ejemplo 3: Flujo Completo de Sesión
|
|
351
|
+
|
|
352
|
+
```typescript
|
|
353
|
+
// Usando herramientas MCP a través del servidor
|
|
354
|
+
|
|
355
|
+
// 1. Iniciar sesión
|
|
356
|
+
const sessionStart = await mem_session_start({
|
|
357
|
+
project_id: 'my-app',
|
|
358
|
+
metadata: { agent: 'claude' }
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
console.log('Sesión iniciada:', sessionStart.id);
|
|
362
|
+
|
|
363
|
+
// 2. Guardar observaciones durante trabajo
|
|
364
|
+
await mem_save({
|
|
365
|
+
title: 'Configuración completada',
|
|
366
|
+
content: 'Servidor configurado en puerto 3000',
|
|
367
|
+
type: 'decision',
|
|
368
|
+
project_id: 'my-app'
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
// 3. Buscar decisiones anteriores
|
|
372
|
+
const searchResults = await mem_search({
|
|
373
|
+
query: 'configuración servidor',
|
|
374
|
+
type: 'decision'
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
console.log('Decisiones encontradas:', searchResults.observations);
|
|
378
|
+
|
|
379
|
+
// 4. Finalizar sesión
|
|
380
|
+
await mem_session_end({ id: sessionStart.id });
|
|
381
|
+
|
|
382
|
+
// 5. Obtener estadísticas
|
|
383
|
+
const stats = await mem_stats();
|
|
384
|
+
console.log('Total observaciones:', stats.total);
|
|
385
|
+
console.log('Por tipo:', stats.by_type);
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
## 🔗 Integración con Clientes MCP
|
|
389
|
+
|
|
390
|
+
### Claude Desktop
|
|
391
|
+
```json
|
|
392
|
+
{
|
|
393
|
+
"mcpServers": {
|
|
394
|
+
"memento": {
|
|
395
|
+
"command": "bun",
|
|
396
|
+
"args": [
|
|
397
|
+
"run",
|
|
398
|
+
"node_modules/@slorenzot/memento-mcp-server/dist/index.js"
|
|
399
|
+
],
|
|
400
|
+
"env": {
|
|
401
|
+
"DATABASE_PATH": "${userHome}/.memento/database.db"
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### VS Code (con extensión MCP)
|
|
409
|
+
```json
|
|
410
|
+
{
|
|
411
|
+
"mcp.servers": {
|
|
412
|
+
"memento": {
|
|
413
|
+
"command": "bun",
|
|
414
|
+
"args": [
|
|
415
|
+
"run",
|
|
416
|
+
"node_modules/@slorenzot/memento-mcp-server/dist/index.js"
|
|
417
|
+
]
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
## ⚠️ Licencia Restrictiva
|
|
424
|
+
|
|
425
|
+
Este paquete está bajo **Licencia CC BY-NC-ND 4.0**:
|
|
426
|
+
- ✅ **Uso personal y educacional permitido**
|
|
427
|
+
- ✅ **Compartir con atribución al autor**
|
|
428
|
+
- ❌ **Uso comercial NO permitido**
|
|
429
|
+
- ❌ **Modificaciones o forks NO permitidos**
|
|
430
|
+
|
|
431
|
+
**Autor**: Soulberto Lorenzo (slorenzot@gmail.com)
|
|
432
|
+
|
|
433
|
+
## 🔄 Dependencias
|
|
434
|
+
|
|
435
|
+
### Dependencias Principales
|
|
436
|
+
- `@slorenzot/memento-core` - Motor de memoria
|
|
437
|
+
- `@modelcontextprotocol/sdk` - SDK de Model Context Protocol
|
|
438
|
+
- `zod` - Validación de esquemas
|
|
439
|
+
|
|
440
|
+
### Peer Dependencies
|
|
441
|
+
- `bun` v1.0+ (recomendado)
|
|
442
|
+
- `node` v20+ (compatible)
|
|
443
|
+
|
|
444
|
+
## 🛠️ Desarrollo
|
|
445
|
+
|
|
446
|
+
```bash
|
|
447
|
+
# Clonar el proyecto
|
|
448
|
+
git clone https://github.com/slorenzot/memento.git
|
|
449
|
+
cd memento/packages/mcp-server
|
|
450
|
+
|
|
451
|
+
# Instalar dependencias
|
|
452
|
+
bun install
|
|
453
|
+
|
|
454
|
+
# Desarrollo
|
|
455
|
+
bun run dev
|
|
456
|
+
|
|
457
|
+
# Build
|
|
458
|
+
bun run build
|
|
459
|
+
|
|
460
|
+
# Tests
|
|
461
|
+
bun test
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
## 📋 Changelog
|
|
465
|
+
|
|
466
|
+
### [0.1.1] - 2024-04-04
|
|
467
|
+
- **Fixed**: Actualización de dependencias core
|
|
468
|
+
- **Fixed**: Corrección de método deleteObservation
|
|
469
|
+
- **Updated**: Mejora en validación de parámetros
|
|
470
|
+
|
|
471
|
+
### [0.1.0] - 2024-04-04
|
|
472
|
+
- **Added**: Versión inicial del servidor MCP
|
|
473
|
+
- **Added**: 15 herramientas de gestión de memoria
|
|
474
|
+
- **Added**: Integración completa con Model Context Protocol
|
|
475
|
+
- **Added**: Soporte para Claude Desktop y VS Code
|
|
476
|
+
|
|
477
|
+
## 👤 Autor
|
|
478
|
+
|
|
479
|
+
**Soulberto Lorenzo**
|
|
480
|
+
- GitHub: [@slorenzot](https://github.com/slorenzot)
|
|
481
|
+
- Email: slorenzot@gmail.com
|
|
482
|
+
|
|
483
|
+
## 📄 Licencia
|
|
484
|
+
|
|
485
|
+
Este paquete está bajo Licencia **Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International**.
|
|
486
|
+
|
|
487
|
+
[Ver Licencia Completa](https://github.com/slorenzot/memento/blob/main/LICENSE)
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
**⚠️ Importante**: Este paquete tiene licencia restrictiva. Respeta los términos de la licencia CC BY-NC-ND 4.0.
|
|
492
|
+
|
|
493
|
+
**[📖 English version](./README.md)**
|