shabti 2.1.0 → 2.2.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 +9 -1
- package/package.json +1 -1
- package/src/index.js +16 -0
- package/src/mcp/server.js +80 -0
package/README.md
CHANGED
|
@@ -128,7 +128,13 @@ npx shabti-mcp
|
|
|
128
128
|
|
|
129
129
|
### Claude Code configuration
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
Generate the MCP settings JSON:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
shabti mcp-config
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Or manually add to your MCP settings:
|
|
132
138
|
|
|
133
139
|
```json
|
|
134
140
|
{
|
|
@@ -147,6 +153,8 @@ Add to your MCP settings:
|
|
|
147
153
|
| --------------- | -------------------------------------- |
|
|
148
154
|
| `memory_store` | Store a memory entry |
|
|
149
155
|
| `memory_search` | Search memories by semantic similarity |
|
|
156
|
+
| `memory_delete` | Delete a memory entry by ID |
|
|
157
|
+
| `memory_list` | List recent memory entries |
|
|
150
158
|
| `memory_status` | Get engine status |
|
|
151
159
|
|
|
152
160
|
### Available resources
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -78,6 +78,22 @@ function buildProgram() {
|
|
|
78
78
|
registerSpin(program);
|
|
79
79
|
registerStatus(program);
|
|
80
80
|
registerStore(program);
|
|
81
|
+
|
|
82
|
+
program
|
|
83
|
+
.command("mcp-config")
|
|
84
|
+
.description("Print MCP server configuration JSON for Claude Code / Cursor")
|
|
85
|
+
.action(() => {
|
|
86
|
+
const config = {
|
|
87
|
+
mcpServers: {
|
|
88
|
+
"shabti-memory": {
|
|
89
|
+
command: "npx",
|
|
90
|
+
args: ["shabti-mcp"],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
console.log(JSON.stringify(config, null, 2));
|
|
95
|
+
});
|
|
96
|
+
|
|
81
97
|
return program;
|
|
82
98
|
}
|
|
83
99
|
|
package/src/mcp/server.js
CHANGED
|
@@ -44,6 +44,31 @@ const TOOLS = [
|
|
|
44
44
|
required: ["query"],
|
|
45
45
|
},
|
|
46
46
|
},
|
|
47
|
+
{
|
|
48
|
+
name: "memory_delete",
|
|
49
|
+
description: "Delete a memory entry by ID",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
id: { type: "string", description: "UUID of the memory entry to delete" },
|
|
54
|
+
},
|
|
55
|
+
required: ["id"],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "memory_list",
|
|
60
|
+
description: "List recent memory entries",
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: {
|
|
64
|
+
limit: {
|
|
65
|
+
type: "integer",
|
|
66
|
+
description: "Maximum number of entries to return (default: 10)",
|
|
67
|
+
},
|
|
68
|
+
namespace: { type: "string", description: "Filter by namespace" },
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
47
72
|
{
|
|
48
73
|
name: "memory_status",
|
|
49
74
|
description: "Get the current status of the memory engine",
|
|
@@ -70,9 +95,12 @@ const RESOURCES = [
|
|
|
70
95
|
];
|
|
71
96
|
|
|
72
97
|
let engine = null;
|
|
98
|
+
let engineInitAttempted = false;
|
|
73
99
|
|
|
74
100
|
function initEngine() {
|
|
75
101
|
if (engine) return engine;
|
|
102
|
+
if (engineInitAttempted) return null;
|
|
103
|
+
engineInitAttempted = true;
|
|
76
104
|
try {
|
|
77
105
|
engine = createEngine();
|
|
78
106
|
} catch {
|
|
@@ -213,6 +241,58 @@ async function handleToolsCall(id, params) {
|
|
|
213
241
|
}
|
|
214
242
|
}
|
|
215
243
|
|
|
244
|
+
if (name === "memory_delete") {
|
|
245
|
+
if (!eng) {
|
|
246
|
+
return respondError(id, -32603, "Engine not available");
|
|
247
|
+
}
|
|
248
|
+
const entryId = args?.id;
|
|
249
|
+
if (!entryId) {
|
|
250
|
+
return respondError(id, -32602, "Missing required parameter: id");
|
|
251
|
+
}
|
|
252
|
+
try {
|
|
253
|
+
await eng.delete(entryId);
|
|
254
|
+
return respond(id, {
|
|
255
|
+
content: [
|
|
256
|
+
{
|
|
257
|
+
type: "text",
|
|
258
|
+
text: JSON.stringify({ deleted: true, id: entryId }, null, 2),
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
});
|
|
262
|
+
} catch (err) {
|
|
263
|
+
return respondError(id, -32603, err.message);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (name === "memory_list") {
|
|
268
|
+
if (!eng) {
|
|
269
|
+
return respondError(id, -32603, "Engine not available");
|
|
270
|
+
}
|
|
271
|
+
try {
|
|
272
|
+
const limit = args?.limit || 10;
|
|
273
|
+
const queryObj = { text: "*", limit };
|
|
274
|
+
if (args?.namespace) queryObj.namespace = args.namespace;
|
|
275
|
+
const results = await eng.executeQuery(queryObj);
|
|
276
|
+
const entries = results.map((r) => ({
|
|
277
|
+
id: r.id,
|
|
278
|
+
content: r.content,
|
|
279
|
+
score: r.score,
|
|
280
|
+
namespace: r.namespace,
|
|
281
|
+
createdAt: r.createdAt,
|
|
282
|
+
}));
|
|
283
|
+
return respond(id, {
|
|
284
|
+
content: [
|
|
285
|
+
{
|
|
286
|
+
type: "text",
|
|
287
|
+
text: JSON.stringify({ entries, count: entries.length }, null, 2),
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
});
|
|
291
|
+
} catch (err) {
|
|
292
|
+
return respondError(id, -32603, err.message);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
216
296
|
respondError(id, -32601, `Unknown tool: ${name}`);
|
|
217
297
|
}
|
|
218
298
|
|