toon-memory 3.1.0 → 3.3.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/README.md +140 -5
- package/dist/cli/setup.js +1265 -6
- package/mcp/server.js +44861 -29662
- package/package.json +7 -2
- package/src/cli/constants.ts +4 -0
- package/src/cli/setup.ts +16 -7
- package/src/lib/checkpoint.ts +132 -0
- package/src/lib/graph.ts +16 -0
- package/src/mcp/config.ts +5 -0
- package/src/mcp/prompts.ts +55 -0
- package/src/mcp/resources.ts +21 -2
- package/src/mcp/server.ts +22 -3
- package/src/mcp/session-store.ts +276 -0
- package/src/mcp/tools.ts +31 -1
- package/src/viewer/d3.v7.min.js +2 -0
- package/src/viewer/data.ts +48 -0
- package/src/viewer/html.ts +922 -0
- package/src/viewer/index.ts +76 -0
- package/src/viewer/server.ts +1 -0
- package/src/viewer/types.ts +29 -0
package/src/mcp/tools.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { McpServer } from "@modelcontextprotocol/server"
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
|
|
2
|
+
import { registerAppTool } from "@modelcontextprotocol/ext-apps/server"
|
|
2
3
|
import { z } from "zod"
|
|
3
4
|
import { readFileSync, writeFileSync, existsSync, copyFileSync, mkdirSync, readdirSync } from "fs"
|
|
4
5
|
import { join, basename } from "path"
|
|
@@ -1550,6 +1551,35 @@ server.registerTool(
|
|
|
1550
1551
|
}
|
|
1551
1552
|
)
|
|
1552
1553
|
|
|
1554
|
+
// ── memory_visualize (MCP Apps) ──────────────────────────────────────────────
|
|
1555
|
+
|
|
1556
|
+
registerAppTool(
|
|
1557
|
+
server as unknown as Parameters<typeof registerAppTool>[0],
|
|
1558
|
+
"memory_visualize",
|
|
1559
|
+
{
|
|
1560
|
+
title: "Open Memory Graph Viewer",
|
|
1561
|
+
description: "Open the interactive memory graph viewer (force-directed graph, stats, timeline, detail panel). Renders inline in MCP Apps-compatible hosts.",
|
|
1562
|
+
inputSchema: {
|
|
1563
|
+
query: z.string().optional().default("").describe("Optional search query to highlight entries in the viewer"),
|
|
1564
|
+
},
|
|
1565
|
+
_meta: { ui: { resourceUri: "ui://viewer" } },
|
|
1566
|
+
},
|
|
1567
|
+
async ({ query }) => {
|
|
1568
|
+
const data = readMemory()
|
|
1569
|
+
const entries = parseEntries(data)
|
|
1570
|
+
const total = entries.length
|
|
1571
|
+
const graph = buildGraph(entries)
|
|
1572
|
+
const edgeCount = [...graph.adjacency.values()].reduce((sum, n) => sum + n.length, 0) / 2
|
|
1573
|
+
|
|
1574
|
+
let msg = `🧠 Memory Graph Viewer — ${total} entries, ${edgeCount} edges`
|
|
1575
|
+
if (query) msg += `\n🔍 Focus: "${query}"`
|
|
1576
|
+
|
|
1577
|
+
return {
|
|
1578
|
+
content: [{ type: "text" as const, text: msg }],
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
)
|
|
1582
|
+
|
|
1553
1583
|
} // end registerTools
|
|
1554
1584
|
|
|
1555
1585
|
/** Parse relative time string to milliseconds. */
|