@xache/mcp-server 0.7.0 → 0.8.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 +215 -0
- package/package.json +2 -2
- package/src/index.ts +68 -0
package/dist/index.js
CHANGED
|
@@ -647,6 +647,127 @@ const TOOLS = [
|
|
|
647
647
|
required: ['name'],
|
|
648
648
|
},
|
|
649
649
|
},
|
|
650
|
+
// =========================================================================
|
|
651
|
+
// Memory Probe (Cognitive Fingerprints)
|
|
652
|
+
// =========================================================================
|
|
653
|
+
{
|
|
654
|
+
name: 'xache_memory_probe',
|
|
655
|
+
description: 'Search your memories by topic using zero-knowledge semantic matching. Uses cognitive fingerprints to find relevant memories without knowing exact storage keys. All fingerprint computation is client-side — the server never sees plaintext.',
|
|
656
|
+
inputSchema: {
|
|
657
|
+
type: 'object',
|
|
658
|
+
properties: {
|
|
659
|
+
query: {
|
|
660
|
+
type: 'string',
|
|
661
|
+
description: 'What to search for in your memories',
|
|
662
|
+
},
|
|
663
|
+
category: {
|
|
664
|
+
type: 'string',
|
|
665
|
+
enum: [
|
|
666
|
+
'preference', 'fact', 'event', 'procedure', 'relationship',
|
|
667
|
+
'observation', 'decision', 'goal', 'constraint', 'reference',
|
|
668
|
+
'summary', 'handoff', 'pattern', 'feedback', 'unknown',
|
|
669
|
+
],
|
|
670
|
+
description: 'Optional cognitive category filter',
|
|
671
|
+
},
|
|
672
|
+
limit: {
|
|
673
|
+
type: 'number',
|
|
674
|
+
description: 'Maximum number of results (default: 10, max: 50)',
|
|
675
|
+
},
|
|
676
|
+
},
|
|
677
|
+
required: ['query'],
|
|
678
|
+
},
|
|
679
|
+
},
|
|
680
|
+
// =========================================================================
|
|
681
|
+
// Ephemeral Context Tools
|
|
682
|
+
// =========================================================================
|
|
683
|
+
{
|
|
684
|
+
name: 'xache_ephemeral_create_session',
|
|
685
|
+
description: 'Create a new ephemeral working memory session. Returns a session key for storing temporary data in slots (conversation, facts, tasks, cache, scratch, handoff). Sessions auto-expire after TTL.',
|
|
686
|
+
inputSchema: {
|
|
687
|
+
type: 'object',
|
|
688
|
+
properties: {
|
|
689
|
+
ttlSeconds: {
|
|
690
|
+
type: 'number',
|
|
691
|
+
description: 'Session time-to-live in seconds (default: 3600)',
|
|
692
|
+
},
|
|
693
|
+
maxWindows: {
|
|
694
|
+
type: 'number',
|
|
695
|
+
description: 'Maximum renewal windows (default: 5)',
|
|
696
|
+
},
|
|
697
|
+
},
|
|
698
|
+
required: [],
|
|
699
|
+
},
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
name: 'xache_ephemeral_write_slot',
|
|
703
|
+
description: 'Write data to an ephemeral session slot. Use slots to organize working memory: conversation (dialog history), facts (extracted facts), tasks (current tasks), cache (temporary data), scratch (working notes), handoff (data for next agent).',
|
|
704
|
+
inputSchema: {
|
|
705
|
+
type: 'object',
|
|
706
|
+
properties: {
|
|
707
|
+
sessionKey: {
|
|
708
|
+
type: 'string',
|
|
709
|
+
description: 'The ephemeral session key',
|
|
710
|
+
},
|
|
711
|
+
slot: {
|
|
712
|
+
type: 'string',
|
|
713
|
+
enum: ['conversation', 'facts', 'tasks', 'cache', 'scratch', 'handoff'],
|
|
714
|
+
description: 'Slot name',
|
|
715
|
+
},
|
|
716
|
+
data: {
|
|
717
|
+
type: 'object',
|
|
718
|
+
description: 'Data to write to the slot',
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
required: ['sessionKey', 'slot', 'data'],
|
|
722
|
+
},
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
name: 'xache_ephemeral_read_slot',
|
|
726
|
+
description: 'Read data from an ephemeral session slot.',
|
|
727
|
+
inputSchema: {
|
|
728
|
+
type: 'object',
|
|
729
|
+
properties: {
|
|
730
|
+
sessionKey: {
|
|
731
|
+
type: 'string',
|
|
732
|
+
description: 'The ephemeral session key',
|
|
733
|
+
},
|
|
734
|
+
slot: {
|
|
735
|
+
type: 'string',
|
|
736
|
+
enum: ['conversation', 'facts', 'tasks', 'cache', 'scratch', 'handoff'],
|
|
737
|
+
description: 'Slot name',
|
|
738
|
+
},
|
|
739
|
+
},
|
|
740
|
+
required: ['sessionKey', 'slot'],
|
|
741
|
+
},
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
name: 'xache_ephemeral_promote',
|
|
745
|
+
description: 'Promote an ephemeral session to persistent memory. Extracts valuable data from all slots and stores as permanent memories with cryptographic receipts.',
|
|
746
|
+
inputSchema: {
|
|
747
|
+
type: 'object',
|
|
748
|
+
properties: {
|
|
749
|
+
sessionKey: {
|
|
750
|
+
type: 'string',
|
|
751
|
+
description: 'The ephemeral session key to promote',
|
|
752
|
+
},
|
|
753
|
+
},
|
|
754
|
+
required: ['sessionKey'],
|
|
755
|
+
},
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
name: 'xache_ephemeral_status',
|
|
759
|
+
description: 'Get the status and details of an ephemeral session. Shows active slots, total size, TTL, window count, and cumulative cost.',
|
|
760
|
+
inputSchema: {
|
|
761
|
+
type: 'object',
|
|
762
|
+
properties: {
|
|
763
|
+
sessionKey: {
|
|
764
|
+
type: 'string',
|
|
765
|
+
description: 'The ephemeral session key',
|
|
766
|
+
},
|
|
767
|
+
},
|
|
768
|
+
required: ['sessionKey'],
|
|
769
|
+
},
|
|
770
|
+
},
|
|
650
771
|
];
|
|
651
772
|
// =============================================================================
|
|
652
773
|
// Tool Handlers
|
|
@@ -1190,6 +1311,82 @@ async function handleGraphEntityHistory(client, args) {
|
|
|
1190
1311
|
return output;
|
|
1191
1312
|
}
|
|
1192
1313
|
// =============================================================================
|
|
1314
|
+
// Memory Probe Handler
|
|
1315
|
+
// =============================================================================
|
|
1316
|
+
async function handleMemoryProbe(client, args) {
|
|
1317
|
+
const result = await client.memory.probe({
|
|
1318
|
+
query: args.query,
|
|
1319
|
+
category: args.category,
|
|
1320
|
+
limit: args.limit || 10,
|
|
1321
|
+
});
|
|
1322
|
+
const matches = result.matches || [];
|
|
1323
|
+
if (matches.length === 0) {
|
|
1324
|
+
return 'No matching memories found for this query.';
|
|
1325
|
+
}
|
|
1326
|
+
let output = `Found ${matches.length} matching memories (total: ${result.total}):\n`;
|
|
1327
|
+
matches.forEach((match, i) => {
|
|
1328
|
+
const data = typeof match.data === 'string'
|
|
1329
|
+
? match.data.slice(0, 300)
|
|
1330
|
+
: JSON.stringify(match.data).slice(0, 300);
|
|
1331
|
+
output += `\n${i + 1}. [${match.category}] ${data}`;
|
|
1332
|
+
output += ` (key: ${match.storageKey})`;
|
|
1333
|
+
});
|
|
1334
|
+
return output;
|
|
1335
|
+
}
|
|
1336
|
+
// =============================================================================
|
|
1337
|
+
// Ephemeral Context Handlers
|
|
1338
|
+
// =============================================================================
|
|
1339
|
+
async function handleEphemeralCreateSession(client, args) {
|
|
1340
|
+
const session = await client.ephemeral.createSession({
|
|
1341
|
+
ttlSeconds: args.ttlSeconds,
|
|
1342
|
+
maxWindows: args.maxWindows,
|
|
1343
|
+
});
|
|
1344
|
+
return [
|
|
1345
|
+
`Created ephemeral session.`,
|
|
1346
|
+
`Session Key: ${session.sessionKey}`,
|
|
1347
|
+
`Status: ${session.status}`,
|
|
1348
|
+
`TTL: ${session.ttlSeconds}s`,
|
|
1349
|
+
`Window: ${session.window}/${session.maxWindows}`,
|
|
1350
|
+
`Expires: ${session.expiresAt}`,
|
|
1351
|
+
].join('\n');
|
|
1352
|
+
}
|
|
1353
|
+
async function handleEphemeralWriteSlot(client, args) {
|
|
1354
|
+
await client.ephemeral.writeSlot(args.sessionKey, args.slot, args.data);
|
|
1355
|
+
return `Wrote data to slot "${args.slot}" in session ${args.sessionKey.substring(0, 12)}...`;
|
|
1356
|
+
}
|
|
1357
|
+
async function handleEphemeralReadSlot(client, args) {
|
|
1358
|
+
const data = await client.ephemeral.readSlot(args.sessionKey, args.slot);
|
|
1359
|
+
return `Slot "${args.slot}" data:\n${JSON.stringify(data, null, 2)}`;
|
|
1360
|
+
}
|
|
1361
|
+
async function handleEphemeralPromote(client, args) {
|
|
1362
|
+
const result = await client.ephemeral.promoteSession(args.sessionKey);
|
|
1363
|
+
let output = `Promoted session ${args.sessionKey.substring(0, 12)}...\n`;
|
|
1364
|
+
output += `Memories created: ${result.memoriesCreated}\n`;
|
|
1365
|
+
if (result.memoryIds.length > 0) {
|
|
1366
|
+
output += `Memory IDs: ${result.memoryIds.join(', ')}\n`;
|
|
1367
|
+
}
|
|
1368
|
+
if (result.receiptId) {
|
|
1369
|
+
output += `Receipt: ${result.receiptId}`;
|
|
1370
|
+
}
|
|
1371
|
+
return output;
|
|
1372
|
+
}
|
|
1373
|
+
async function handleEphemeralStatus(client, args) {
|
|
1374
|
+
const session = await client.ephemeral.getSession(args.sessionKey);
|
|
1375
|
+
if (!session) {
|
|
1376
|
+
return `Session ${args.sessionKey.substring(0, 12)}... not found.`;
|
|
1377
|
+
}
|
|
1378
|
+
return [
|
|
1379
|
+
`Session: ${session.sessionKey.substring(0, 12)}...`,
|
|
1380
|
+
`Status: ${session.status}`,
|
|
1381
|
+
`Window: ${session.window}/${session.maxWindows}`,
|
|
1382
|
+
`TTL: ${session.ttlSeconds}s`,
|
|
1383
|
+
`Expires: ${session.expiresAt}`,
|
|
1384
|
+
`Active Slots: ${session.activeSlots.length > 0 ? session.activeSlots.join(', ') : 'none'}`,
|
|
1385
|
+
`Total Size: ${session.totalSize} bytes`,
|
|
1386
|
+
`Cumulative Cost: $${session.cumulativeCost.toFixed(4)}`,
|
|
1387
|
+
].join('\n');
|
|
1388
|
+
}
|
|
1389
|
+
// =============================================================================
|
|
1193
1390
|
// Server Setup
|
|
1194
1391
|
// =============================================================================
|
|
1195
1392
|
async function main() {
|
|
@@ -1273,6 +1470,24 @@ async function main() {
|
|
|
1273
1470
|
case 'xache_graph_entity_history':
|
|
1274
1471
|
result = await handleGraphEntityHistory(client, args);
|
|
1275
1472
|
break;
|
|
1473
|
+
case 'xache_memory_probe':
|
|
1474
|
+
result = await handleMemoryProbe(client, args);
|
|
1475
|
+
break;
|
|
1476
|
+
case 'xache_ephemeral_create_session':
|
|
1477
|
+
result = await handleEphemeralCreateSession(client, args);
|
|
1478
|
+
break;
|
|
1479
|
+
case 'xache_ephemeral_write_slot':
|
|
1480
|
+
result = await handleEphemeralWriteSlot(client, args);
|
|
1481
|
+
break;
|
|
1482
|
+
case 'xache_ephemeral_read_slot':
|
|
1483
|
+
result = await handleEphemeralReadSlot(client, args);
|
|
1484
|
+
break;
|
|
1485
|
+
case 'xache_ephemeral_promote':
|
|
1486
|
+
result = await handleEphemeralPromote(client, args);
|
|
1487
|
+
break;
|
|
1488
|
+
case 'xache_ephemeral_status':
|
|
1489
|
+
result = await handleEphemeralStatus(client, args);
|
|
1490
|
+
break;
|
|
1276
1491
|
default:
|
|
1277
1492
|
throw new Error(`Unknown tool: ${name}`);
|
|
1278
1493
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xache/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "MCP server for Xache Protocol - collective intelligence, verifiable memory, and reputation for AI agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"homepage": "https://xache.xyz",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
35
|
-
"@xache/sdk": "
|
|
35
|
+
"@xache/sdk": "^5.10.0",
|
|
36
36
|
"zod": "^3.22.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
package/src/index.ts
CHANGED
|
@@ -687,6 +687,38 @@ const TOOLS: Tool[] = [
|
|
|
687
687
|
},
|
|
688
688
|
},
|
|
689
689
|
|
|
690
|
+
// =========================================================================
|
|
691
|
+
// Memory Probe (Cognitive Fingerprints)
|
|
692
|
+
// =========================================================================
|
|
693
|
+
{
|
|
694
|
+
name: 'xache_memory_probe',
|
|
695
|
+
description:
|
|
696
|
+
'Search your memories by topic using zero-knowledge semantic matching. Uses cognitive fingerprints to find relevant memories without knowing exact storage keys. All fingerprint computation is client-side — the server never sees plaintext.',
|
|
697
|
+
inputSchema: {
|
|
698
|
+
type: 'object',
|
|
699
|
+
properties: {
|
|
700
|
+
query: {
|
|
701
|
+
type: 'string',
|
|
702
|
+
description: 'What to search for in your memories',
|
|
703
|
+
},
|
|
704
|
+
category: {
|
|
705
|
+
type: 'string',
|
|
706
|
+
enum: [
|
|
707
|
+
'preference', 'fact', 'event', 'procedure', 'relationship',
|
|
708
|
+
'observation', 'decision', 'goal', 'constraint', 'reference',
|
|
709
|
+
'summary', 'handoff', 'pattern', 'feedback', 'unknown',
|
|
710
|
+
],
|
|
711
|
+
description: 'Optional cognitive category filter',
|
|
712
|
+
},
|
|
713
|
+
limit: {
|
|
714
|
+
type: 'number',
|
|
715
|
+
description: 'Maximum number of results (default: 10, max: 50)',
|
|
716
|
+
},
|
|
717
|
+
},
|
|
718
|
+
required: ['query'],
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
|
|
690
722
|
// =========================================================================
|
|
691
723
|
// Ephemeral Context Tools
|
|
692
724
|
// =========================================================================
|
|
@@ -1526,6 +1558,39 @@ async function handleGraphEntityHistory(
|
|
|
1526
1558
|
return output;
|
|
1527
1559
|
}
|
|
1528
1560
|
|
|
1561
|
+
// =============================================================================
|
|
1562
|
+
// Memory Probe Handler
|
|
1563
|
+
// =============================================================================
|
|
1564
|
+
|
|
1565
|
+
async function handleMemoryProbe(
|
|
1566
|
+
client: XacheClient,
|
|
1567
|
+
args: { query: string; category?: string; limit?: number }
|
|
1568
|
+
): Promise<string> {
|
|
1569
|
+
const result = await client.memory.probe({
|
|
1570
|
+
query: args.query,
|
|
1571
|
+
category: args.category as any,
|
|
1572
|
+
limit: args.limit || 10,
|
|
1573
|
+
});
|
|
1574
|
+
|
|
1575
|
+
const matches = result.matches || [];
|
|
1576
|
+
|
|
1577
|
+
if (matches.length === 0) {
|
|
1578
|
+
return 'No matching memories found for this query.';
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
let output = `Found ${matches.length} matching memories (total: ${result.total}):\n`;
|
|
1582
|
+
|
|
1583
|
+
matches.forEach((match: any, i: number) => {
|
|
1584
|
+
const data = typeof match.data === 'string'
|
|
1585
|
+
? match.data.slice(0, 300)
|
|
1586
|
+
: JSON.stringify(match.data).slice(0, 300);
|
|
1587
|
+
output += `\n${i + 1}. [${match.category}] ${data}`;
|
|
1588
|
+
output += ` (key: ${match.storageKey})`;
|
|
1589
|
+
});
|
|
1590
|
+
|
|
1591
|
+
return output;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1529
1594
|
// =============================================================================
|
|
1530
1595
|
// Ephemeral Context Handlers
|
|
1531
1596
|
// =============================================================================
|
|
@@ -1698,6 +1763,9 @@ async function main(): Promise<void> {
|
|
|
1698
1763
|
case 'xache_graph_entity_history':
|
|
1699
1764
|
result = await handleGraphEntityHistory(client, args as any);
|
|
1700
1765
|
break;
|
|
1766
|
+
case 'xache_memory_probe':
|
|
1767
|
+
result = await handleMemoryProbe(client, args as any);
|
|
1768
|
+
break;
|
|
1701
1769
|
case 'xache_ephemeral_create_session':
|
|
1702
1770
|
result = await handleEphemeralCreateSession(client, args as any);
|
|
1703
1771
|
break;
|