memvid-mcp-server 1.0.3 → 1.0.5
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 +7 -5
- package/dist/index.js +22 -8
- 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
|
}
|
|
@@ -51,7 +53,7 @@ Add the following to your `claude_desktop_config.json`:
|
|
|
51
53
|
|
|
52
54
|
1. **`create_or_open_memory`**: Initialize a new project memory or open an existing one.
|
|
53
55
|
2. **`add_content`**: Add text and metadata to the memory.
|
|
54
|
-
3. **`search_memory`**: Search your memory.
|
|
56
|
+
3. **`search_memory`**: Search your memory. Use `query="*"` to list all recent items.
|
|
55
57
|
4. **`ask_memory`**: (Optional) Ask questions about your memory using an LLM.
|
|
56
58
|
|
|
57
59
|
## Development
|
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() {
|
|
@@ -144,15 +149,24 @@ function registerSearchMemory(server) {
|
|
|
144
149
|
server.tool("search_memory", "Search for content in the project's memory using semantic search.", SearchMemorySchema.shape, async (args) => {
|
|
145
150
|
const manager = MemoryManager.getInstance();
|
|
146
151
|
const mem = await manager.getMemory(args.project_name);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
let results;
|
|
153
|
+
if (args.query === "*") {
|
|
154
|
+
if (typeof mem.timeline === "function") {
|
|
155
|
+
results = await mem.timeline({ k: args.limit });
|
|
156
|
+
} else {
|
|
157
|
+
results = await mem.find(undefined, { k: args.limit });
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
results = await mem.find(args.query, {
|
|
161
|
+
k: args.limit,
|
|
162
|
+
mode: args.mode
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
const hits = Array.isArray(results) ? results : results.hits || [];
|
|
152
166
|
const formatted = hits.map((hit) => {
|
|
153
167
|
return `[Title: ${hit.title || "Untitled"}]
|
|
154
|
-
${hit.snippet || hit.text}
|
|
155
|
-
(Score: ${hit.score})`;
|
|
168
|
+
${hit.snippet || hit.text || hit.preview}
|
|
169
|
+
(Score: ${hit.score || "N/A"})`;
|
|
156
170
|
}).join(`
|
|
157
171
|
|
|
158
172
|
---
|