@cachly-dev/mcp-server 0.7.0 → 0.7.1
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 +48 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +75 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cachly-dev/mcp-server",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"mcpName": "io.github.cachly-dev/mcp-server",
|
|
5
5
|
"description": "AI memory brain for Claude Code, Cursor, Copilot & Windsurf — persistent sessions, lessons learned, semantic search, team brain. 51 MCP tools.",
|
|
6
6
|
"type": "module",
|
package/src/index.ts
CHANGED
|
@@ -55,7 +55,7 @@ import { Redis } from 'ioredis';
|
|
|
55
55
|
const API_URL = process.env.CACHLY_API_URL ?? 'https://api.cachly.dev';
|
|
56
56
|
const JWT = process.env.CACHLY_JWT ?? '';
|
|
57
57
|
const EMBED_MODEL = process.env.CACHLY_EMBED_MODEL ?? '';
|
|
58
|
-
const CURRENT_VERSION = '0.7.
|
|
58
|
+
const CURRENT_VERSION = '0.7.1';
|
|
59
59
|
/**
|
|
60
60
|
* ┌──────────────────────────────────────────────────────────────────────┐
|
|
61
61
|
* │ EMBEDDING PROVIDER — pluggable, client-side first │
|
|
@@ -3519,12 +3519,25 @@ const TOOLS = [
|
|
|
3519
3519
|
inputSchema: {
|
|
3520
3520
|
type: 'object',
|
|
3521
3521
|
properties: {
|
|
3522
|
-
q:
|
|
3523
|
-
|
|
3522
|
+
q: { type: 'string', description: 'Free-text search query (leave empty for most recent lessons)' },
|
|
3523
|
+
category: { type: 'string', description: 'Filter by category prefix: "fix", "deploy", "debug", "infra", "api", "web"' },
|
|
3524
|
+
limit: { type: 'number', description: 'Max results to return (default: 20, max: 50)' },
|
|
3524
3525
|
},
|
|
3525
3526
|
required: [],
|
|
3526
3527
|
},
|
|
3527
3528
|
},
|
|
3529
|
+
{
|
|
3530
|
+
name: 'syndicate_stats',
|
|
3531
|
+
description:
|
|
3532
|
+
'Show the health of the global Knowledge Commons: total lessons, total confirms, ' +
|
|
3533
|
+
'top categories, most-trusted lessons, and growth in the last 7 days. ' +
|
|
3534
|
+
'Use for weekly reviews or to explore what the community knows.',
|
|
3535
|
+
inputSchema: {
|
|
3536
|
+
type: 'object',
|
|
3537
|
+
properties: {},
|
|
3538
|
+
required: [],
|
|
3539
|
+
},
|
|
3540
|
+
},
|
|
3528
3541
|
] as const;
|
|
3529
3542
|
|
|
3530
3543
|
// ── Handlers ──────────────────────────────────────────────────────────────────
|
|
@@ -7623,10 +7636,11 @@ smart_recall(
|
|
|
7623
7636
|
|
|
7624
7637
|
// ── v0.7 Knowledge Syndication: syndicate_search ─────────────────────────
|
|
7625
7638
|
case 'syndicate_search': {
|
|
7626
|
-
const { q = '', limit = 20 } = args as { q?: string; limit?: number };
|
|
7639
|
+
const { q = '', limit = 20, category = '' } = args as { q?: string; limit?: number; category?: string };
|
|
7627
7640
|
|
|
7628
7641
|
const params = new URLSearchParams();
|
|
7629
7642
|
if (q) params.set('q', q);
|
|
7643
|
+
if (category) params.set('category', category);
|
|
7630
7644
|
params.set('limit', String(Math.min(Math.max(1, limit), 50)));
|
|
7631
7645
|
|
|
7632
7646
|
const res = await apiFetch<{ results: Array<{
|
|
@@ -7648,8 +7662,9 @@ smart_recall(
|
|
|
7648
7662
|
return '█'.repeat(filled) + '░'.repeat(10 - filled) + ` ×${n}`;
|
|
7649
7663
|
};
|
|
7650
7664
|
|
|
7665
|
+
const header = [q, category].filter(Boolean).join(' · ');
|
|
7651
7666
|
const lines: string[] = [
|
|
7652
|
-
`## 🌐 Global Knowledge Commons${
|
|
7667
|
+
`## 🌐 Global Knowledge Commons${header ? ` — ${header}` : ' — Recent'}`,
|
|
7653
7668
|
`*${res.count} lesson${res.count === 1 ? '' : 's'} found*`,
|
|
7654
7669
|
``,
|
|
7655
7670
|
];
|
|
@@ -7660,20 +7675,73 @@ smart_recall(
|
|
|
7660
7675
|
`**Trust:** ${confirmBar(lesson.confirm_count)}`,
|
|
7661
7676
|
lesson.what_worked ? `**What worked:** ${lesson.what_worked}` : '',
|
|
7662
7677
|
lesson.what_failed ? `**What failed:** ${lesson.what_failed}` : '',
|
|
7663
|
-
`*Contributed ${new Date(lesson.created_at).toLocaleDateString('de-DE')}
|
|
7678
|
+
`*Contributed ${new Date(lesson.created_at).toLocaleDateString('de-DE')} · ID: \`${lesson.id}\`*`,
|
|
7664
7679
|
``,
|
|
7665
7680
|
);
|
|
7666
7681
|
}
|
|
7667
7682
|
|
|
7668
7683
|
lines.push(
|
|
7669
7684
|
`---`,
|
|
7670
|
-
`**Confirm
|
|
7685
|
+
`**Confirm** (this helped you): \`syndicate(topic="${res.results[0]?.topic ?? '...'}", what_worked="...")\` → auto-deduped, trust +1`,
|
|
7671
7686
|
`**Contribute your own:** \`syndicate(topic="fix:...", what_worked="...")\``,
|
|
7687
|
+
`**Filter by category:** \`syndicate_search(category="fix")\``,
|
|
7672
7688
|
);
|
|
7673
7689
|
|
|
7674
7690
|
return lines.filter(l => l !== '').join('\n');
|
|
7675
7691
|
}
|
|
7676
7692
|
|
|
7693
|
+
// ── v0.7 Knowledge Syndication: syndicate_stats ──────────────────────────
|
|
7694
|
+
case 'syndicate_stats': {
|
|
7695
|
+
const res = await apiFetch<{
|
|
7696
|
+
total_lessons: number;
|
|
7697
|
+
total_confirms: number;
|
|
7698
|
+
added_last_7_days: number;
|
|
7699
|
+
top_categories: Array<{ category: string; count: number }>;
|
|
7700
|
+
most_trusted: Array<{
|
|
7701
|
+
id: string; topic: string; outcome: string;
|
|
7702
|
+
what_worked: string; confirm_count: number; created_at: string;
|
|
7703
|
+
}>;
|
|
7704
|
+
}>('/api/v1/syndication/stats');
|
|
7705
|
+
|
|
7706
|
+
const confirmBar = (n: number) => {
|
|
7707
|
+
const filled = Math.min(10, Math.round(n / 5));
|
|
7708
|
+
return '█'.repeat(filled) + '░'.repeat(10 - filled) + ` ×${n}`;
|
|
7709
|
+
};
|
|
7710
|
+
|
|
7711
|
+
const lines: string[] = [
|
|
7712
|
+
`## 🌐 Global Knowledge Commons — Stats`,
|
|
7713
|
+
``,
|
|
7714
|
+
`| Metric | Value |`,
|
|
7715
|
+
`|---|---|`,
|
|
7716
|
+
`| Total lessons | **${res.total_lessons.toLocaleString()}** |`,
|
|
7717
|
+
`| Total confirms | **${res.total_confirms.toLocaleString()}** |`,
|
|
7718
|
+
`| Added last 7 days | **${res.added_last_7_days}** |`,
|
|
7719
|
+
``,
|
|
7720
|
+
`### Top Categories`,
|
|
7721
|
+
];
|
|
7722
|
+
|
|
7723
|
+
for (const cat of res.top_categories ?? []) {
|
|
7724
|
+
lines.push(`- \`${cat.category}\` — ${cat.count} lesson${cat.count === 1 ? '' : 's'}`);
|
|
7725
|
+
}
|
|
7726
|
+
|
|
7727
|
+
lines.push(``, `### Most Trusted Lessons`);
|
|
7728
|
+
|
|
7729
|
+
for (const lesson of res.most_trusted ?? []) {
|
|
7730
|
+
lines.push(
|
|
7731
|
+
`**\`${lesson.topic}\`** ${confirmBar(lesson.confirm_count)}`,
|
|
7732
|
+
`> ${lesson.what_worked.slice(0, 120)}${lesson.what_worked.length > 120 ? '…' : ''}`,
|
|
7733
|
+
``,
|
|
7734
|
+
);
|
|
7735
|
+
}
|
|
7736
|
+
|
|
7737
|
+
lines.push(
|
|
7738
|
+
`---`,
|
|
7739
|
+
`**Contribute:** \`syndicate(topic="...", what_worked="...")\` | **Search:** \`syndicate_search(q="your problem")\``,
|
|
7740
|
+
);
|
|
7741
|
+
|
|
7742
|
+
return lines.join('\n');
|
|
7743
|
+
}
|
|
7744
|
+
|
|
7677
7745
|
default:
|
|
7678
7746
|
return null;
|
|
7679
7747
|
}
|