@xmemo/client 0.4.174 → 0.4.175
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/package.json +1 -1
- package/src/mcp/stdio-server.js +57 -2
package/package.json
CHANGED
package/src/mcp/stdio-server.js
CHANGED
|
@@ -213,8 +213,61 @@ const SERVER_INFO = {
|
|
|
213
213
|
version: CLI_VERSION
|
|
214
214
|
};
|
|
215
215
|
|
|
216
|
+
const STATIC_PROMPTS = [
|
|
217
|
+
{
|
|
218
|
+
name: 'remember',
|
|
219
|
+
description: 'Save a memory to XMemo for future recall across sessions.',
|
|
220
|
+
arguments: [
|
|
221
|
+
{ name: 'content', description: 'The text to remember.', required: true },
|
|
222
|
+
{ name: 'path', description: 'Category path, e.g. preferences, projects/myapp.', required: false }
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
name: 'recall',
|
|
227
|
+
description: 'Recall relevant memories from XMemo before answering a question.',
|
|
228
|
+
arguments: [
|
|
229
|
+
{ name: 'query', description: 'What to search for in memory.', required: true }
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
name: 'project-context',
|
|
234
|
+
description: 'Build a context pack from XMemo for the current project or task.',
|
|
235
|
+
arguments: [
|
|
236
|
+
{ name: 'query', description: 'Describe the project or task context needed.', required: true }
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
];
|
|
240
|
+
|
|
241
|
+
function handlePromptsGet(id, params, ctx) {
|
|
242
|
+
const name = params?.name;
|
|
243
|
+
const prompt = STATIC_PROMPTS.find(p => p.name === name);
|
|
244
|
+
if (!prompt) {
|
|
245
|
+
return makeError(id, -32602, `Prompt not found: ${name}`);
|
|
246
|
+
}
|
|
247
|
+
const args = params?.arguments || {};
|
|
248
|
+
const messages = [];
|
|
249
|
+
if (name === 'remember') {
|
|
250
|
+
messages.push({
|
|
251
|
+
role: 'user',
|
|
252
|
+
content: { type: 'text', text: `Remember this: ${args.content || '(no content provided)'}${args.path ? ` [path: ${args.path}]` : ''}` }
|
|
253
|
+
});
|
|
254
|
+
} else if (name === 'recall') {
|
|
255
|
+
messages.push({
|
|
256
|
+
role: 'user',
|
|
257
|
+
content: { type: 'text', text: `Recall memories related to: ${args.query || '(no query provided)'}` }
|
|
258
|
+
});
|
|
259
|
+
} else if (name === 'project-context') {
|
|
260
|
+
messages.push({
|
|
261
|
+
role: 'user',
|
|
262
|
+
content: { type: 'text', text: `Build XMemo context for: ${args.query || '(no query provided)'}` }
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
return makeResult(id, { description: prompt.description, messages });
|
|
266
|
+
}
|
|
267
|
+
|
|
216
268
|
const SERVER_CAPABILITIES = {
|
|
217
|
-
tools: {}
|
|
269
|
+
tools: {},
|
|
270
|
+
prompts: {}
|
|
218
271
|
};
|
|
219
272
|
|
|
220
273
|
// ---------------------------------------------------------------------------
|
|
@@ -297,7 +350,9 @@ async function handleRequest(request, ctx) {
|
|
|
297
350
|
case 'tools/call':
|
|
298
351
|
return handleToolsCall(id, params, ctx);
|
|
299
352
|
case 'prompts/list':
|
|
300
|
-
return makeResult(id, { prompts:
|
|
353
|
+
return makeResult(id, { prompts: STATIC_PROMPTS });
|
|
354
|
+
case 'prompts/get':
|
|
355
|
+
return handlePromptsGet(id, params, ctx);
|
|
301
356
|
case 'resources/list':
|
|
302
357
|
return makeResult(id, { resources: [] });
|
|
303
358
|
case 'ping':
|