server-memory-enhanced 0.1.0 → 0.2.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/index.js +60 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -606,6 +606,44 @@ export class KnowledgeGraphManager {
|
|
|
606
606
|
relations: contextRelations
|
|
607
607
|
};
|
|
608
608
|
}
|
|
609
|
+
// Enhancement 10: List conversations (agent threads)
|
|
610
|
+
async listConversations() {
|
|
611
|
+
const graph = await this.loadGraph();
|
|
612
|
+
// Group data by agent thread
|
|
613
|
+
const threadMap = new Map();
|
|
614
|
+
// Collect entities by thread
|
|
615
|
+
for (const entity of graph.entities) {
|
|
616
|
+
if (!threadMap.has(entity.agentThreadId)) {
|
|
617
|
+
threadMap.set(entity.agentThreadId, { entities: [], relations: [], timestamps: [] });
|
|
618
|
+
}
|
|
619
|
+
const threadData = threadMap.get(entity.agentThreadId);
|
|
620
|
+
threadData.entities.push(entity);
|
|
621
|
+
threadData.timestamps.push(entity.timestamp);
|
|
622
|
+
}
|
|
623
|
+
// Collect relations by thread
|
|
624
|
+
for (const relation of graph.relations) {
|
|
625
|
+
if (!threadMap.has(relation.agentThreadId)) {
|
|
626
|
+
threadMap.set(relation.agentThreadId, { entities: [], relations: [], timestamps: [] });
|
|
627
|
+
}
|
|
628
|
+
const threadData = threadMap.get(relation.agentThreadId);
|
|
629
|
+
threadData.relations.push(relation);
|
|
630
|
+
threadData.timestamps.push(relation.timestamp);
|
|
631
|
+
}
|
|
632
|
+
// Build conversation summaries
|
|
633
|
+
const conversations = Array.from(threadMap.entries()).map(([agentThreadId, data]) => {
|
|
634
|
+
const timestamps = data.timestamps.sort((a, b) => a.localeCompare(b));
|
|
635
|
+
return {
|
|
636
|
+
agentThreadId,
|
|
637
|
+
entityCount: data.entities.length,
|
|
638
|
+
relationCount: data.relations.length,
|
|
639
|
+
firstCreated: timestamps[0] || '',
|
|
640
|
+
lastUpdated: timestamps[timestamps.length - 1] || ''
|
|
641
|
+
};
|
|
642
|
+
});
|
|
643
|
+
// Sort by last updated (most recent first)
|
|
644
|
+
conversations.sort((a, b) => b.lastUpdated.localeCompare(a.lastUpdated));
|
|
645
|
+
return { conversations };
|
|
646
|
+
}
|
|
609
647
|
}
|
|
610
648
|
let knowledgeGraphManager;
|
|
611
649
|
// Zod schemas for enhanced entities and relations
|
|
@@ -630,7 +668,7 @@ const RelationSchema = z.object({
|
|
|
630
668
|
// The server instance and tools exposed to Claude
|
|
631
669
|
const server = new McpServer({
|
|
632
670
|
name: "memory-enhanced-server",
|
|
633
|
-
version: "0.
|
|
671
|
+
version: "0.2.0",
|
|
634
672
|
});
|
|
635
673
|
// Register create_entities tool
|
|
636
674
|
server.registerTool("create_entities", {
|
|
@@ -1007,6 +1045,27 @@ server.registerTool("get_context", {
|
|
|
1007
1045
|
structuredContent: { ...context }
|
|
1008
1046
|
};
|
|
1009
1047
|
});
|
|
1048
|
+
// Register list_conversations tool
|
|
1049
|
+
server.registerTool("list_conversations", {
|
|
1050
|
+
title: "List Conversations",
|
|
1051
|
+
description: "List all available agent threads (conversations) with their metadata including entity counts, relation counts, and activity timestamps",
|
|
1052
|
+
inputSchema: {},
|
|
1053
|
+
outputSchema: {
|
|
1054
|
+
conversations: z.array(z.object({
|
|
1055
|
+
agentThreadId: z.string(),
|
|
1056
|
+
entityCount: z.number(),
|
|
1057
|
+
relationCount: z.number(),
|
|
1058
|
+
firstCreated: z.string(),
|
|
1059
|
+
lastUpdated: z.string()
|
|
1060
|
+
}))
|
|
1061
|
+
}
|
|
1062
|
+
}, async () => {
|
|
1063
|
+
const result = await knowledgeGraphManager.listConversations();
|
|
1064
|
+
return {
|
|
1065
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
1066
|
+
structuredContent: result
|
|
1067
|
+
};
|
|
1068
|
+
});
|
|
1010
1069
|
async function main() {
|
|
1011
1070
|
// Initialize memory directory path
|
|
1012
1071
|
MEMORY_DIR_PATH = await ensureMemoryDirectory();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "server-memory-enhanced",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Enhanced MCP server for memory with agent threading, timestamps, and confidence scoring",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"mcpName": "io.github.modelcontextprotocol/server-memory-enhanced",
|