memvid-mcp-server 1.0.2 → 1.0.4
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 +6 -4
- package/dist/index.js +44 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,9 +23,10 @@ This server can be used with any MCP-compliant client (e.g., Claude Desktop, Cur
|
|
|
23
23
|
|
|
24
24
|
### Environment Variables
|
|
25
25
|
|
|
26
|
-
| Variable
|
|
27
|
-
|
|
|
28
|
-
| `OPENAI_API_KEY`
|
|
26
|
+
| Variable | Description | Required |
|
|
27
|
+
| ---------------------- | -------------------------------------------------------------------------------------------------------- | ------------- |
|
|
28
|
+
| `OPENAI_API_KEY` | Your OpenAI API Key. Required to enable the `ask_memory` tool and for semantic embeddings in some modes. | No (Optional) |
|
|
29
|
+
| `MEMVID_LOCAL_STORAGE` | Set to `"1"` to store memory files in `./memvid_mcp` (current directory) instead of `~/.memvid_mcp`. | No (Optional) |
|
|
29
30
|
|
|
30
31
|
### Claude Desktop Configuration
|
|
31
32
|
|
|
@@ -38,7 +39,8 @@ Add the following to your `claude_desktop_config.json`:
|
|
|
38
39
|
"command": "npx",
|
|
39
40
|
"args": ["-y", "memvid-mcp-server"],
|
|
40
41
|
"env": {
|
|
41
|
-
"OPENAI_API_KEY": "sk-..."
|
|
42
|
+
"OPENAI_API_KEY": "sk-...",
|
|
43
|
+
"MEMVID_LOCAL_STORAGE": "0"
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
}
|
package/dist/index.js
CHANGED
|
@@ -42,7 +42,12 @@ class MemoryManager {
|
|
|
42
42
|
storageDir;
|
|
43
43
|
constructor() {
|
|
44
44
|
this.memories = new Map;
|
|
45
|
-
|
|
45
|
+
if (process.env.MEMVID_LOCAL_STORAGE === "1") {
|
|
46
|
+
this.storageDir = path.join(process.cwd(), "memvid_mcp");
|
|
47
|
+
console.error(`[Memvid] Using local storage: ${this.storageDir}`);
|
|
48
|
+
} else {
|
|
49
|
+
this.storageDir = path.join(os.homedir(), ".memvid_mcp");
|
|
50
|
+
}
|
|
46
51
|
this.ensureStorageDir();
|
|
47
52
|
}
|
|
48
53
|
static getInstance() {
|
|
@@ -80,6 +85,23 @@ class MemoryManager {
|
|
|
80
85
|
throw error;
|
|
81
86
|
}
|
|
82
87
|
}
|
|
88
|
+
async deleteProject(projectName) {
|
|
89
|
+
const memoryPath = this.getStoragePath(projectName);
|
|
90
|
+
if (this.memories.has(projectName)) {
|
|
91
|
+
this.memories.delete(projectName);
|
|
92
|
+
}
|
|
93
|
+
if (fs.existsSync(memoryPath)) {
|
|
94
|
+
try {
|
|
95
|
+
fs.unlinkSync(memoryPath);
|
|
96
|
+
console.error(`[Memvid] Deleted memory: ${memoryPath}`);
|
|
97
|
+
return true;
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.error(`[Memvid] Failed to delete memory file: ${memoryPath}`, error);
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
83
105
|
}
|
|
84
106
|
|
|
85
107
|
// src/tools/create.ts
|
|
@@ -218,12 +240,33 @@ async function getProjectContext() {
|
|
|
218
240
|
};
|
|
219
241
|
}
|
|
220
242
|
|
|
243
|
+
// src/tools/delete.ts
|
|
244
|
+
import { z as z3 } from "zod";
|
|
245
|
+
var DeleteProjectSchema = z3.object({
|
|
246
|
+
project_name: z3.string().describe("The name of the project memory to delete.")
|
|
247
|
+
});
|
|
248
|
+
function registerDeleteProject(server) {
|
|
249
|
+
server.tool("memvid_delete_project", "Permanently delete a project's memory file. This action is irreversible.", DeleteProjectSchema.shape, async (args) => {
|
|
250
|
+
const manager = MemoryManager.getInstance();
|
|
251
|
+
const success = await manager.deleteProject(args.project_name);
|
|
252
|
+
return {
|
|
253
|
+
content: [
|
|
254
|
+
{
|
|
255
|
+
type: "text",
|
|
256
|
+
text: success ? `Successfully deleted memory for project '${args.project_name}'.` : `Project '${args.project_name}' not found or could not be deleted.`
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
|
|
221
263
|
// src/tools/index.ts
|
|
222
264
|
function registerAllTools(server) {
|
|
223
265
|
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());
|
|
224
266
|
registerCreateMemory(server);
|
|
225
267
|
registerAddContent(server);
|
|
226
268
|
registerSearchMemory(server);
|
|
269
|
+
registerDeleteProject(server);
|
|
227
270
|
if (process.env.OPENAI_API_KEY) {
|
|
228
271
|
registerAskMemory(server);
|
|
229
272
|
console.error("AskMemory tool enabled (API key found).");
|