memvid-mcp-server 1.0.1 → 1.0.3
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/dist/index.js +60 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -80,6 +80,23 @@ class MemoryManager {
|
|
|
80
80
|
throw error;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
+
async deleteProject(projectName) {
|
|
84
|
+
const memoryPath = this.getStoragePath(projectName);
|
|
85
|
+
if (this.memories.has(projectName)) {
|
|
86
|
+
this.memories.delete(projectName);
|
|
87
|
+
}
|
|
88
|
+
if (fs.existsSync(memoryPath)) {
|
|
89
|
+
try {
|
|
90
|
+
fs.unlinkSync(memoryPath);
|
|
91
|
+
console.error(`[Memvid] Deleted memory: ${memoryPath}`);
|
|
92
|
+
return true;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
console.error(`[Memvid] Failed to delete memory file: ${memoryPath}`, error);
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
83
100
|
}
|
|
84
101
|
|
|
85
102
|
// src/tools/create.ts
|
|
@@ -197,11 +214,54 @@ function registerAskMemory(server) {
|
|
|
197
214
|
});
|
|
198
215
|
}
|
|
199
216
|
|
|
217
|
+
// src/tools/context.ts
|
|
218
|
+
import { z as z2 } from "zod";
|
|
219
|
+
import path2 from "path";
|
|
220
|
+
var GetProjectContextSchema = z2.object({});
|
|
221
|
+
async function getProjectContext() {
|
|
222
|
+
const cwd = process.cwd();
|
|
223
|
+
const suggested_project_name = path2.basename(cwd);
|
|
224
|
+
return {
|
|
225
|
+
content: [
|
|
226
|
+
{
|
|
227
|
+
type: "text",
|
|
228
|
+
text: JSON.stringify({
|
|
229
|
+
suggested_project_name,
|
|
230
|
+
cwd,
|
|
231
|
+
hint: "Use 'suggested_project_name' as the 'project_name' argument for other tools if you are unsure."
|
|
232
|
+
}, null, 2)
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// src/tools/delete.ts
|
|
239
|
+
import { z as z3 } from "zod";
|
|
240
|
+
var DeleteProjectSchema = z3.object({
|
|
241
|
+
project_name: z3.string().describe("The name of the project memory to delete.")
|
|
242
|
+
});
|
|
243
|
+
function registerDeleteProject(server) {
|
|
244
|
+
server.tool("memvid_delete_project", "Permanently delete a project's memory file. This action is irreversible.", DeleteProjectSchema.shape, async (args) => {
|
|
245
|
+
const manager = MemoryManager.getInstance();
|
|
246
|
+
const success = await manager.deleteProject(args.project_name);
|
|
247
|
+
return {
|
|
248
|
+
content: [
|
|
249
|
+
{
|
|
250
|
+
type: "text",
|
|
251
|
+
text: success ? `Successfully deleted memory for project '${args.project_name}'.` : `Project '${args.project_name}' not found or could not be deleted.`
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
};
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
200
258
|
// src/tools/index.ts
|
|
201
259
|
function registerAllTools(server) {
|
|
260
|
+
server.tool("memvid_get_project_context", "Get context about the current project (e.g. inferred project name from CWD) to help the agent decide which memory project to use.", GetProjectContextSchema.shape, async () => getProjectContext());
|
|
202
261
|
registerCreateMemory(server);
|
|
203
262
|
registerAddContent(server);
|
|
204
263
|
registerSearchMemory(server);
|
|
264
|
+
registerDeleteProject(server);
|
|
205
265
|
if (process.env.OPENAI_API_KEY) {
|
|
206
266
|
registerAskMemory(server);
|
|
207
267
|
console.error("AskMemory tool enabled (API key found).");
|