@astramindapp/mcp-server 0.8.2 → 0.9.0

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/server.d.ts CHANGED
@@ -4,26 +4,38 @@
4
4
  * Exposes the MIND knowledge graph as MCP tools that any LLM agent can use.
5
5
  * This is the universal AI memory layer.
6
6
  *
7
- * Tools (17):
8
- * mind_query — Semantic search across the knowledge graph
9
- * mind_remember — Store/manage content in the graph (auto-categorized)
10
- * mind_context — Get structured always-loaded context (soul/user/rules)
11
- * mind_life — Read/write goals, projects, tasks, calendar events, stats
12
- * mind_crm — Read/write contacts, interactions, and activities
13
- * mind_graph — Get graph statistics, diagnostics, and labels
14
- * mind_admin — Admin-only user and featured mind management
15
- * mind_sense — MINDsense emotional intelligence layer
16
- * mind_research — Deep research agent jobs
17
- * mind_train — Self-training and chat-to-KG sessions
18
- * mind_social — Thoughts, communities, and feed
19
- * mind_profile — Profile, prompts, and model preferences
20
- * mind_insights — ALE insights and analytics
21
- * mind_automate — Automations and triggers
22
- * mind_notify — Notifications management
23
- * mind_agents — Admin-only Agent Command Center (registry, heartbeat,
24
- * probe, status — for Anthony's agent fleet)
25
- * mind_accounts — Multi-MIND accounts: discover/create MINDs, manage
26
- * owners and viewers, send invitations
7
+ * The server is self-describing: every connecting client receives
8
+ * SERVER_INSTRUCTIONS (from ./integration-guide) in the MCP `initialize`
9
+ * response, and can read the full playbook from the `mind://integration-guide`
10
+ * resource. Any agent that connects therefore knows what MIND is, which
11
+ * integration path to use for its runtime, how to authenticate, and the
12
+ * session protocol — without having to be told.
13
+ *
14
+ * Tools (23):
15
+ * mind_query — Semantic search across the knowledge graph
16
+ * mind_remember — Store/manage content in the graph (auto-categorized)
17
+ * mind_folders — Organize documents into folders (list/create/rename/
18
+ * move/delete/move_documents)
19
+ * mind_context — Get structured always-loaded context (soul/user/rules)
20
+ * mind_life — Goals, projects, tasks, calendar (incl. bulk_delete)
21
+ * mind_tasks — Site-wide assignable, reportable work items
22
+ * mind_crm — Read/write contacts, interactions, and activities
23
+ * mind_graph — Get graph statistics, diagnostics, and labels
24
+ * mind_admin — Admin-only user and featured mind management
25
+ * mind_sense — MINDsense emotional intelligence layer
26
+ * mind_research — Deep research agent jobs
27
+ * mind_train — Self-training and chat-to-KG sessions
28
+ * mind_social — Thoughts, communities, and feed
29
+ * mind_profile — Profile, prompts, and model preferences
30
+ * mind_insights — ALE insights and analytics
31
+ * mind_automate — Automations and triggers
32
+ * mind_notify — Notifications management
33
+ * mind_agents — Admin-only Agent Command Center (registry, heartbeat,
34
+ * probe, status — for the agent fleet)
35
+ * mind_accounts — Multi-MIND accounts: discover/create MINDs, manage
36
+ * owners and viewers, send invitations
37
+ * mind_list_templates / mind_get_template / mind_save_typed /
38
+ * mind_bootstrap_templates — the 16 Front Layer typed-document templates
27
39
  */
28
40
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
29
41
  import { MindClient } from "./mind-client.js";
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAi/FjE"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAG9C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAkpGjE"}
package/dist/server.js CHANGED
@@ -5,36 +5,68 @@
5
5
  * Exposes the MIND knowledge graph as MCP tools that any LLM agent can use.
6
6
  * This is the universal AI memory layer.
7
7
  *
8
- * Tools (17):
9
- * mind_query — Semantic search across the knowledge graph
10
- * mind_remember — Store/manage content in the graph (auto-categorized)
11
- * mind_context — Get structured always-loaded context (soul/user/rules)
12
- * mind_life — Read/write goals, projects, tasks, calendar events, stats
13
- * mind_crm — Read/write contacts, interactions, and activities
14
- * mind_graph — Get graph statistics, diagnostics, and labels
15
- * mind_admin — Admin-only user and featured mind management
16
- * mind_sense — MINDsense emotional intelligence layer
17
- * mind_research — Deep research agent jobs
18
- * mind_train — Self-training and chat-to-KG sessions
19
- * mind_social — Thoughts, communities, and feed
20
- * mind_profile — Profile, prompts, and model preferences
21
- * mind_insights — ALE insights and analytics
22
- * mind_automate — Automations and triggers
23
- * mind_notify — Notifications management
24
- * mind_agents — Admin-only Agent Command Center (registry, heartbeat,
25
- * probe, status — for Anthony's agent fleet)
26
- * mind_accounts — Multi-MIND accounts: discover/create MINDs, manage
27
- * owners and viewers, send invitations
8
+ * The server is self-describing: every connecting client receives
9
+ * SERVER_INSTRUCTIONS (from ./integration-guide) in the MCP `initialize`
10
+ * response, and can read the full playbook from the `mind://integration-guide`
11
+ * resource. Any agent that connects therefore knows what MIND is, which
12
+ * integration path to use for its runtime, how to authenticate, and the
13
+ * session protocol — without having to be told.
14
+ *
15
+ * Tools (23):
16
+ * mind_query — Semantic search across the knowledge graph
17
+ * mind_remember — Store/manage content in the graph (auto-categorized)
18
+ * mind_folders — Organize documents into folders (list/create/rename/
19
+ * move/delete/move_documents)
20
+ * mind_context — Get structured always-loaded context (soul/user/rules)
21
+ * mind_life — Goals, projects, tasks, calendar (incl. bulk_delete)
22
+ * mind_tasks — Site-wide assignable, reportable work items
23
+ * mind_crm — Read/write contacts, interactions, and activities
24
+ * mind_graph — Get graph statistics, diagnostics, and labels
25
+ * mind_admin — Admin-only user and featured mind management
26
+ * mind_sense — MINDsense emotional intelligence layer
27
+ * mind_research — Deep research agent jobs
28
+ * mind_train — Self-training and chat-to-KG sessions
29
+ * mind_social — Thoughts, communities, and feed
30
+ * mind_profile — Profile, prompts, and model preferences
31
+ * mind_insights — ALE insights and analytics
32
+ * mind_automate — Automations and triggers
33
+ * mind_notify — Notifications management
34
+ * mind_agents — Admin-only Agent Command Center (registry, heartbeat,
35
+ * probe, status — for the agent fleet)
36
+ * mind_accounts — Multi-MIND accounts: discover/create MINDs, manage
37
+ * owners and viewers, send invitations
38
+ * mind_list_templates / mind_get_template / mind_save_typed /
39
+ * mind_bootstrap_templates — the 16 Front Layer typed-document templates
28
40
  */
29
41
  Object.defineProperty(exports, "__esModule", { value: true });
30
42
  exports.createMindMcpServer = createMindMcpServer;
31
43
  const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
32
44
  const zod_1 = require("zod");
45
+ const integration_guide_js_1 = require("./integration-guide.js");
33
46
  function createMindMcpServer(client) {
34
47
  const server = new mcp_js_1.McpServer({
35
48
  name: "mind",
36
- version: "0.2.0",
49
+ version: "0.9.0",
50
+ }, {
51
+ // Returned to every client in the MCP `initialize` response — the first
52
+ // thing any connecting agent sees about how to integrate with MIND.
53
+ instructions: integration_guide_js_1.SERVER_INSTRUCTIONS,
37
54
  });
55
+ // ─── mind://integration-guide ───────────────────────────
56
+ // The full integration playbook, readable on demand by any MCP client.
57
+ server.registerResource("integration-guide", "mind://integration-guide", {
58
+ title: "MIND Integration Guide",
59
+ description: "Complete playbook for integrating any AI agent with MIND — the three integration paths (MCP server, OpenClaw plugin, REST API), authentication, the session protocol, all 22 tools, REST endpoint mapping, and common recipes.",
60
+ mimeType: "text/markdown",
61
+ }, async (uri) => ({
62
+ contents: [
63
+ {
64
+ uri: uri.href,
65
+ mimeType: "text/markdown",
66
+ text: integration_guide_js_1.INTEGRATION_GUIDE,
67
+ },
68
+ ],
69
+ }));
38
70
  // ─── mind_query ─────────────────────────────────────────
39
71
  // Semantic search across the user's knowledge graph.
40
72
  // Replaces flat MEMORY.md — returns only relevant memories.
@@ -253,6 +285,131 @@ function createMindMcpServer(client) {
253
285
  };
254
286
  }
255
287
  });
288
+ // ─── mind_folders ───────────────────────────────────────
289
+ // Organize documents into folders. Folders are a presentation layer — the
290
+ // knowledge graph still indexes every document regardless of folder.
291
+ server.tool("mind_folders", "Organize your MIND documents into folders. Folders are a presentation layer — the knowledge graph still indexes and retrieves across every document regardless of folder. Use mind_remember to create a document, then mind_folders move_documents to file it. Actions: list, create, rename, move, delete, move_documents.", {
292
+ action: zod_1.z
293
+ .enum(["list", "create", "rename", "move", "delete", "move_documents"])
294
+ .describe("list (all folders + counts), create (new folder), rename (change a folder's name), move (re-nest a folder), delete (remove a folder — its documents and subfolders move up a level, nothing is deleted), move_documents (file documents into a folder)"),
295
+ name: zod_1.z.string().optional().describe("Folder name — required for create and rename"),
296
+ folder_id: zod_1.z
297
+ .string()
298
+ .optional()
299
+ .describe("Folder id — the folder to rename/move/delete, or the destination for move_documents (omit or pass 'root' to file documents at the top level)"),
300
+ parent_id: zod_1.z
301
+ .string()
302
+ .optional()
303
+ .describe("Parent folder id for create and move. Omit or pass 'root' for the top level"),
304
+ doc_ids: zod_1.z
305
+ .array(zod_1.z.string())
306
+ .optional()
307
+ .describe("Document ids to file — required for move_documents"),
308
+ }, async ({ action, name, folder_id, parent_id, doc_ids }) => {
309
+ try {
310
+ switch (action) {
311
+ case "list": {
312
+ const res = await client.listFolders();
313
+ if (!res.folders.length) {
314
+ return {
315
+ content: [
316
+ {
317
+ type: "text",
318
+ text: `No folders yet. ${res.unfiled_count} document(s), all at the top level. Create one with action 'create'.`,
319
+ },
320
+ ],
321
+ };
322
+ }
323
+ const byId = new Map(res.folders.map((f) => [f.id, f]));
324
+ const lines = res.folders.map((f) => {
325
+ const parent = f.parent_id ? byId.get(f.parent_id)?.name ?? "?" : "(top level)";
326
+ return `• ${f.name} — ${f.document_count ?? 0} doc(s) · id: ${f.id} · parent: ${parent}`;
327
+ });
328
+ return {
329
+ content: [
330
+ {
331
+ type: "text",
332
+ text: [
333
+ `${res.folders.length} folder(s) · ${res.unfiled_count} unfiled · ${res.total_count} total documents`,
334
+ "",
335
+ ...lines,
336
+ ].join("\n"),
337
+ },
338
+ ],
339
+ };
340
+ }
341
+ case "create": {
342
+ if (!name)
343
+ throw new Error("'name' is required to create a folder");
344
+ const res = await client.createFolder(name, parent_id ?? null);
345
+ return {
346
+ content: [
347
+ { type: "text", text: `Created folder "${res.folder.name}" (id: ${res.folder.id})` },
348
+ ],
349
+ };
350
+ }
351
+ case "rename": {
352
+ if (!folder_id)
353
+ throw new Error("'folder_id' is required to rename a folder");
354
+ if (!name)
355
+ throw new Error("'name' is required to rename a folder");
356
+ const res = await client.updateFolder(folder_id, { name });
357
+ return {
358
+ content: [{ type: "text", text: `Renamed folder to "${res.folder.name}"` }],
359
+ };
360
+ }
361
+ case "move": {
362
+ if (!folder_id)
363
+ throw new Error("'folder_id' is required to move a folder");
364
+ // Always send parent_id explicitly (id or null) so the move applies.
365
+ const res = await client.updateFolder(folder_id, { parent_id: parent_id ?? null });
366
+ return {
367
+ content: [
368
+ {
369
+ type: "text",
370
+ text: `Moved folder "${res.folder.name}" ${res.folder.parent_id ? "into another folder" : "to the top level"}`,
371
+ },
372
+ ],
373
+ };
374
+ }
375
+ case "delete": {
376
+ if (!folder_id)
377
+ throw new Error("'folder_id' is required to delete a folder");
378
+ const res = await client.deleteFolder(folder_id);
379
+ return {
380
+ content: [
381
+ {
382
+ type: "text",
383
+ text: `Deleted folder. ${res.documents_reparented} document(s) moved up a level — no documents were deleted.`,
384
+ },
385
+ ],
386
+ };
387
+ }
388
+ case "move_documents": {
389
+ if (!doc_ids || !doc_ids.length)
390
+ throw new Error("'doc_ids' is required for move_documents");
391
+ const dest = !folder_id || folder_id === "root" ? null : folder_id;
392
+ const res = await client.moveDocuments(doc_ids, dest);
393
+ return {
394
+ content: [
395
+ {
396
+ type: "text",
397
+ text: `Moved ${res.moved} document(s) ${dest ? "into the folder" : "to the top level"}`,
398
+ },
399
+ ],
400
+ };
401
+ }
402
+ default:
403
+ throw new Error(`Unknown action: ${action}`);
404
+ }
405
+ }
406
+ catch (err) {
407
+ return {
408
+ content: [{ type: "text", text: `Error managing folders: ${err}` }],
409
+ isError: true,
410
+ };
411
+ }
412
+ });
256
413
  // ─── mind_context ───────────────────────────────────────
257
414
  // Get structured always-loaded context.
258
415
  // Equivalent to OpenClaw's SOUL.md + USER.md + AGENTS.md bootstrap injection,