@astramindapp/mcp-server 0.22.0 → 0.23.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/mind-client.d.ts +90 -0
- package/dist/mind-client.d.ts.map +1 -1
- package/dist/mind-client.js +34 -0
- package/dist/mind-client.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +150 -1
- package/dist/server.js.map +1 -1
- package/package.json +2 -2
package/dist/server.js
CHANGED
|
@@ -48,7 +48,7 @@ const integration_guide_js_1 = require("./integration-guide.js");
|
|
|
48
48
|
function createMindMcpServer(client) {
|
|
49
49
|
const server = new mcp_js_1.McpServer({
|
|
50
50
|
name: "mind",
|
|
51
|
-
version: "0.
|
|
51
|
+
version: "0.23.0",
|
|
52
52
|
}, {
|
|
53
53
|
// Returned to every client in the MCP `initialize` response — the first
|
|
54
54
|
// thing any connecting agent sees about how to integrate with MIND.
|
|
@@ -1392,6 +1392,155 @@ function createMindMcpServer(client) {
|
|
|
1392
1392
|
};
|
|
1393
1393
|
}
|
|
1394
1394
|
});
|
|
1395
|
+
// ─── mind_checklists ────────────────────────────────────
|
|
1396
|
+
// The granular level beneath a Task. Shape: Template → Sections[phase] →
|
|
1397
|
+
// Items. Templates (yours + flagship) instantiate into runs attached to a
|
|
1398
|
+
// task or life item; items are toggled and runs completed (which mirrors the
|
|
1399
|
+
// finished checklist into the knowledge graph).
|
|
1400
|
+
server.tool("mind_checklists", "Manage checklists in MIND — the granular level beneath a Task in the Focus→Project→Outcome→Task→Checklist hierarchy. A checklist attaches to a task (parent_type=task) or a Life item (parent_type=life_item) and groups checkable steps into phase-bucketed sections (pre/run/post). Use list_templates/get_template/create_template for reusable blueprints (including global flagship templates), then create a run from a template_id or inline sections_json, toggle_item to check steps, and complete to finish + mirror it into the knowledge graph.", {
|
|
1401
|
+
action: zod_1.z
|
|
1402
|
+
.enum([
|
|
1403
|
+
"list_templates", "get_template", "create_template",
|
|
1404
|
+
"list", "create", "get", "toggle_item", "complete", "delete",
|
|
1405
|
+
])
|
|
1406
|
+
.describe("What to do: list_templates/get_template/create_template (blueprints); list/create/get/toggle_item/complete/delete (runs)"),
|
|
1407
|
+
template_id: zod_1.z.string().optional().describe("Template ID — required for get_template; optional on create (instantiate from a template)"),
|
|
1408
|
+
checklist_id: zod_1.z.string().optional().describe("Checklist run ID — required for get/toggle_item/complete/delete"),
|
|
1409
|
+
item_id: zod_1.z.string().optional().describe("Checklist item ID — required for toggle_item"),
|
|
1410
|
+
title: zod_1.z.string().optional().describe("Title (required for create_template; optional for create run)"),
|
|
1411
|
+
description: zod_1.z.string().optional().describe("Template description (create_template)"),
|
|
1412
|
+
parent_type: zod_1.z.string().optional().describe("Attach a run to: task or life_item (required for create + list filter)"),
|
|
1413
|
+
parent_id: zod_1.z.string().optional().describe("ID of the parent task / life item (required for create)"),
|
|
1414
|
+
parent_label: zod_1.z.string().optional().describe("Optional human label for the parent"),
|
|
1415
|
+
sections_json: zod_1.z.string().optional().describe('Inline sections as JSON, e.g. [{"title":"Setup","phase":"pre","items":[{"label":"do x"}]}] — for create_template or an inline create run'),
|
|
1416
|
+
}, async ({ action, template_id, checklist_id, item_id, title, description, parent_type, parent_id, parent_label, sections_json }) => {
|
|
1417
|
+
try {
|
|
1418
|
+
const parseSections = () => {
|
|
1419
|
+
if (!sections_json)
|
|
1420
|
+
return undefined;
|
|
1421
|
+
const parsed = JSON.parse(sections_json);
|
|
1422
|
+
if (!Array.isArray(parsed))
|
|
1423
|
+
throw new Error("sections_json must be a JSON array of sections");
|
|
1424
|
+
return parsed;
|
|
1425
|
+
};
|
|
1426
|
+
const fmtTemplate = (t) => {
|
|
1427
|
+
const secCount = (t.sections ?? []).length;
|
|
1428
|
+
const itemCount = (t.sections ?? []).reduce((n, s) => n + (s.items?.length ?? 0), 0);
|
|
1429
|
+
return `• ${t.title}${t.origin === "flagship" ? " ⭐ flagship" : ""} — ${secCount} section(s), ${itemCount} item(s) — id: ${t.template_id}`;
|
|
1430
|
+
};
|
|
1431
|
+
const fmtSections = (sections) => (sections ?? [])
|
|
1432
|
+
.map((s) => {
|
|
1433
|
+
const head = ` [${s.phase}] ${s.title}`;
|
|
1434
|
+
const items = (s.items ?? [])
|
|
1435
|
+
.map((it) => ` ${it.checked ? "[x]" : "[ ]"} ${it.label} — id: ${it.item_id}`)
|
|
1436
|
+
.join("\n");
|
|
1437
|
+
return items ? `${head}\n${items}` : head;
|
|
1438
|
+
})
|
|
1439
|
+
.join("\n");
|
|
1440
|
+
const fmtChecklist = (c, withItems = false) => {
|
|
1441
|
+
const p = c.progress ?? { done: 0, total: 0, pct: 0 };
|
|
1442
|
+
const head = `• ${c.title} (${p.done}/${p.total}, ${p.pct}%)` +
|
|
1443
|
+
`${c.completed_at ? " ✅ complete" : ""}` +
|
|
1444
|
+
`${c.parent_label ? `, on ${c.parent_label}` : ""} — id: ${c.checklist_id}`;
|
|
1445
|
+
return withItems ? `${head}\n${fmtSections(c.sections ?? [])}` : head;
|
|
1446
|
+
};
|
|
1447
|
+
switch (action) {
|
|
1448
|
+
case "list_templates": {
|
|
1449
|
+
const result = await client.listChecklistTemplates();
|
|
1450
|
+
const templates = result.templates ?? [];
|
|
1451
|
+
if (templates.length === 0) {
|
|
1452
|
+
return { content: [{ type: "text", text: "No checklist templates found." }] };
|
|
1453
|
+
}
|
|
1454
|
+
return {
|
|
1455
|
+
content: [{
|
|
1456
|
+
type: "text",
|
|
1457
|
+
text: `${result.total} template(s):\n` + templates.map(fmtTemplate).join("\n"),
|
|
1458
|
+
}],
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
case "get_template": {
|
|
1462
|
+
if (!template_id) {
|
|
1463
|
+
return { content: [{ type: "text", text: "Error: template_id is required for get_template" }], isError: true };
|
|
1464
|
+
}
|
|
1465
|
+
const t = await client.getChecklistTemplate(template_id);
|
|
1466
|
+
return {
|
|
1467
|
+
content: [{
|
|
1468
|
+
type: "text",
|
|
1469
|
+
text: `${fmtTemplate(t)}${t.description ? `\n${t.description}` : ""}\n${fmtSections(t.sections ?? [])}`,
|
|
1470
|
+
}],
|
|
1471
|
+
};
|
|
1472
|
+
}
|
|
1473
|
+
case "create_template": {
|
|
1474
|
+
if (!title) {
|
|
1475
|
+
return { content: [{ type: "text", text: "Error: title is required to create a template" }], isError: true };
|
|
1476
|
+
}
|
|
1477
|
+
const t = await client.createChecklistTemplate({
|
|
1478
|
+
title, description, sections: parseSections(),
|
|
1479
|
+
});
|
|
1480
|
+
return { content: [{ type: "text", text: `✅ Created template: ${fmtTemplate(t)}` }] };
|
|
1481
|
+
}
|
|
1482
|
+
case "list": {
|
|
1483
|
+
const result = await client.listChecklists(parent_type, parent_id);
|
|
1484
|
+
const checklists = result.checklists ?? [];
|
|
1485
|
+
if (checklists.length === 0) {
|
|
1486
|
+
return { content: [{ type: "text", text: "No checklists found." }] };
|
|
1487
|
+
}
|
|
1488
|
+
return {
|
|
1489
|
+
content: [{
|
|
1490
|
+
type: "text",
|
|
1491
|
+
text: `${result.total} checklist(s):\n` + checklists.map((c) => fmtChecklist(c)).join("\n"),
|
|
1492
|
+
}],
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
case "create": {
|
|
1496
|
+
if (!parent_type || !parent_id) {
|
|
1497
|
+
return { content: [{ type: "text", text: "Error: parent_type and parent_id are required to create a checklist run" }], isError: true };
|
|
1498
|
+
}
|
|
1499
|
+
const c = await client.createChecklist({
|
|
1500
|
+
parent_type, parent_id, parent_label, title,
|
|
1501
|
+
template_id, sections: parseSections(),
|
|
1502
|
+
});
|
|
1503
|
+
return { content: [{ type: "text", text: `✅ Created checklist:\n${fmtChecklist(c, true)}` }] };
|
|
1504
|
+
}
|
|
1505
|
+
case "get": {
|
|
1506
|
+
if (!checklist_id) {
|
|
1507
|
+
return { content: [{ type: "text", text: "Error: checklist_id is required for get" }], isError: true };
|
|
1508
|
+
}
|
|
1509
|
+
const c = await client.getChecklist(checklist_id);
|
|
1510
|
+
return { content: [{ type: "text", text: fmtChecklist(c, true) }] };
|
|
1511
|
+
}
|
|
1512
|
+
case "toggle_item": {
|
|
1513
|
+
if (!checklist_id || !item_id) {
|
|
1514
|
+
return { content: [{ type: "text", text: "Error: checklist_id and item_id are required for toggle_item" }], isError: true };
|
|
1515
|
+
}
|
|
1516
|
+
const c = await client.toggleChecklistItem(checklist_id, item_id);
|
|
1517
|
+
return { content: [{ type: "text", text: `✅ Toggled item:\n${fmtChecklist(c, true)}` }] };
|
|
1518
|
+
}
|
|
1519
|
+
case "complete": {
|
|
1520
|
+
if (!checklist_id) {
|
|
1521
|
+
return { content: [{ type: "text", text: "Error: checklist_id is required for complete" }], isError: true };
|
|
1522
|
+
}
|
|
1523
|
+
const c = await client.completeChecklist(checklist_id);
|
|
1524
|
+
return { content: [{ type: "text", text: `✅ Completed checklist "${c.title}" — mirrored to the knowledge graph.` }] };
|
|
1525
|
+
}
|
|
1526
|
+
case "delete": {
|
|
1527
|
+
if (!checklist_id) {
|
|
1528
|
+
return { content: [{ type: "text", text: "Error: checklist_id is required for delete" }], isError: true };
|
|
1529
|
+
}
|
|
1530
|
+
await client.deleteChecklist(checklist_id);
|
|
1531
|
+
return { content: [{ type: "text", text: `🗑️ Deleted checklist ${checklist_id}` }] };
|
|
1532
|
+
}
|
|
1533
|
+
default:
|
|
1534
|
+
return { content: [{ type: "text", text: `Unknown action: ${action}` }], isError: true };
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
catch (err) {
|
|
1538
|
+
return {
|
|
1539
|
+
content: [{ type: "text", text: `mind_checklists error: ${err instanceof Error ? err.message : String(err)}` }],
|
|
1540
|
+
isError: true,
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
1543
|
+
});
|
|
1395
1544
|
// ─── mind_crm ───────────────────────────────────────────
|
|
1396
1545
|
// Read/write contacts, interactions, and activities.
|
|
1397
1546
|
// Enhanced: delete, get, log_activity, list_activities.
|