memax-cli 0.1.0-alpha.1 → 0.1.0-alpha.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.
@@ -99,6 +99,23 @@ function createServer(): Server {
99
99
  required: ["content"],
100
100
  },
101
101
  },
102
+ {
103
+ name: "memax_get",
104
+ description:
105
+ "Get the full content of a specific note by ID. " +
106
+ "Use this after memax_recall to read the complete content of a relevant memory.",
107
+ inputSchema: {
108
+ type: "object" as const,
109
+ properties: {
110
+ id: {
111
+ type: "string",
112
+ description:
113
+ "The note ID (from memax_recall or memax_search results)",
114
+ },
115
+ },
116
+ required: ["id"],
117
+ },
118
+ },
102
119
  {
103
120
  name: "memax_search",
104
121
  description:
@@ -153,7 +170,7 @@ function createServer(): Server {
153
170
  const score = (n.relevance_score * 100).toFixed(0);
154
171
  const heading = n.heading_chain ? ` — ${n.heading_chain}` : "";
155
172
  return (
156
- `[${i + 1}] ${n.title} [${n.category}, ${score}%, ${n.age}]${heading}\n` +
173
+ `[${i + 1}] ${n.title} [${n.category}, ${score}%, ${n.age}] (id: ${n.id})${heading}\n` +
157
174
  n.chunk_content
158
175
  );
159
176
  })
@@ -210,6 +227,53 @@ function createServer(): Server {
210
227
  }
211
228
  }
212
229
 
230
+ case "memax_get": {
231
+ const typedArgs = args as { id: string };
232
+ try {
233
+ const note = await apiGet<{
234
+ id: string;
235
+ title: string;
236
+ content: string;
237
+ summary: string;
238
+ category: string;
239
+ tags: string[];
240
+ source: string;
241
+ source_path: string;
242
+ created_at: string;
243
+ updated_at: string;
244
+ }>(`/v1/notes/${typedArgs.id}`);
245
+
246
+ const parts = [
247
+ `# ${note.title}`,
248
+ `Category: ${note.category} | Source: ${note.source} | Created: ${note.created_at}`,
249
+ ];
250
+ if (note.tags?.length > 0) {
251
+ parts.push(`Tags: ${note.tags.join(", ")}`);
252
+ }
253
+ if (note.source_path) {
254
+ parts.push(`Source: ${note.source_path}`);
255
+ }
256
+ if (note.summary) {
257
+ parts.push(`\n## Summary\n${note.summary}`);
258
+ }
259
+ parts.push(`\n## Content\n${note.content}`);
260
+
261
+ return {
262
+ content: [{ type: "text" as const, text: parts.join("\n") }],
263
+ };
264
+ } catch (err) {
265
+ return {
266
+ content: [
267
+ {
268
+ type: "text" as const,
269
+ text: `Get failed: ${(err as Error).message}`,
270
+ },
271
+ ],
272
+ isError: true,
273
+ };
274
+ }
275
+ }
276
+
213
277
  case "memax_search": {
214
278
  const typedArgs = args as {
215
279
  category?: string;
@@ -268,6 +332,17 @@ async function mcpServeCommand(): Promise<void> {
268
332
  const server = createServer();
269
333
  const transport = new StdioServerTransport();
270
334
  await server.connect(transport);
335
+
336
+ // Keep the process alive — some agent launchers close stdin early
337
+ // which makes Node think the event loop is empty and exit.
338
+ await new Promise<void>((resolve) => {
339
+ process.on("SIGINT", resolve);
340
+ process.on("SIGTERM", resolve);
341
+ // Also resolve if stdin closes (transport disconnected)
342
+ process.stdin.on("end", resolve);
343
+ });
344
+
345
+ await server.close();
271
346
  }
272
347
 
273
348
  export function registerMcpCommand(program: Command): void {
@@ -103,7 +103,9 @@ export async function recallCommand(
103
103
  }
104
104
  for (const note of notes) {
105
105
  const score = (note.relevance_score * 100).toFixed(0);
106
- console.log(`${note.title} [${note.category}] ${score}% · ${note.age}`);
106
+ console.log(
107
+ `${note.title} [${note.category}] ${score}% · ${note.age} (${note.id})`,
108
+ );
107
109
  if (note.heading_chain) {
108
110
  console.log(` ${note.heading_chain}`);
109
111
  }
@@ -143,6 +145,7 @@ export async function recallCommand(
143
145
  chalk.cyan(`${score}%`),
144
146
  chalk.gray(`· ${note.age}`),
145
147
  );
148
+ console.log(chalk.gray(` id: ${note.id}`));
146
149
  if (note.heading_chain) {
147
150
  console.log(chalk.gray(` ${note.heading_chain}`));
148
151
  }