@cachly-dev/mcp-server 0.5.60 → 0.6.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 CHANGED
@@ -1,11 +1,12 @@
1
- # 🧠 cachly AI Brain — MCP Server
1
+ # cachly — The World's First Cognitive Cache
2
2
 
3
- > **Persistent memory for Claude Code, Cursor, GitHub Copilot, Windsurf, Cline & Zed.**
4
- > Your AI remembers every lesson, every fix, every architecture decision — forever.
3
+ > **A cache that thinks.**
4
+ > Not just managed Redis. The universal AI memory layer — persistent, self-managing, cross-model.
5
+ > One command. Your AI never forgets again.
5
6
 
6
7
  <p align="center">
7
- <a href="https://github.com/cachly-dev/mcp-server/stargazers">
8
- <img src="https://img.shields.io/github/stars/cachly-dev/mcp-server?style=social" alt="GitHub Stars" />
8
+ <a href="https://github.com/cachly-dev/cachly-mcp/stargazers">
9
+ <img src="https://img.shields.io/github/stars/cachly-dev/cachly-mcp?style=social" alt="GitHub Stars" />
9
10
  </a>
10
11
  &nbsp;
11
12
  <a href="https://www.npmjs.com/package/@cachly-dev/mcp-server">
@@ -23,204 +24,256 @@
23
24
  <a href="https://cachly.dev/legal">
24
25
  <img src="https://img.shields.io/badge/GDPR-EU%20only-green" alt="GDPR: EU only" />
25
26
  </a>
26
- &nbsp;
27
- <img src="https://img.shields.io/badge/License-Apache--2.0-yellow" alt="License: Apache-2.0" />
28
27
  </p>
29
28
 
30
29
  ---
31
30
 
32
- ## The Problem
31
+ ## What is a Cognitive Cache?
32
+
33
+ Every cache stores data. cachly stores **meaning**.
34
+
35
+ Five capabilities no other cache — or AI memory tool — has ever had:
33
36
 
34
- Every morning, you open your AI coding assistant. It doesn't remember yesterday.
35
- You explain your architecture. You explain the deployment process. You explain the bug you fixed last week.
37
+ | Capability | What it does |
38
+ |-----------|-------------|
39
+ | **`memory_consolidate`** | Distill the entire knowledge base: detect contradictions, merge duplicates, prune stale memories — like garbage collection for your AI's brain |
40
+ | **`brain_diff`** | Git-style diff for AI knowledge — shows exactly what was learned, forgotten, or updated across sessions |
41
+ | **`causal_trace`** | Root cause analysis through memory — given a problem, traces backwards through the knowledge graph to find what caused it |
42
+ | **`knowledge_decay`** | Temporal confidence scoring — every memory gets a freshness score that decays with time and rebounds with each recall |
43
+ | **`autopilot`** | Zero-config AI memory — generates a CLAUDE.md that makes any AI manage its own brain automatically, forever |
36
44
 
37
- **The average developer wastes 45 minutes/day re-establishing context.** That's €15,000+ in lost productivity per engineer per year.
45
+ This is not a tool you use. This is infrastructure that makes AI genuinely intelligent over time.
46
+
47
+ ---
38
48
 
39
- ## The Fix — One Command
49
+ ## One command. Permanent memory. No copy-paste.
40
50
 
41
51
  ```bash
42
52
  npx @cachly-dev/mcp-server@latest setup
43
53
  ```
44
54
 
45
- The interactive wizard:
46
- 1. Signs you in (free, no credit card required)
47
- 2. Picks or creates your AI Brain instance
48
- 3. **Auto-detects** Cursor, Windsurf, VS Code, Claude Code, Continue.dev, **Cline & Zed**
49
- 4. Writes the correct MCP config for every detected editor
50
- 5. Creates `CLAUDE.md` with memory rules pre-filled
51
- 6. Shows your Brain Health snapshot right in the terminal
55
+ Browser opens → sign in → Brain provisioned → every editor configured automatically.
56
+ No dashboard visit. No API keys to copy. No instance IDs to manage.
52
57
 
53
- **Index your project** into the Brain for instant semantic search:
54
- ```bash
55
- npx @cachly-dev/mcp-server@latest index .
58
+ ---
59
+
60
+ ## What it looks like
61
+
62
+ Every session starts with this instead of a blank slate:
63
+
64
+ ```
65
+ 🧠 Session Briefing
66
+
67
+ 📅 Last session (2h ago): Fixed auth redirect loop in Next.js middleware
68
+ Duration: 47 min · Files: middleware.ts, auth.config.ts, .env.local
69
+
70
+ 📊 Brain: 23 lessons · 5 context entries · 38 recalls · ~9.5h saved
71
+
72
+ 🎯 Relevant for "auth":
73
+ ✅ next:middleware-auth — matcher must exclude /_next/static paths (negative lookahead)
74
+ ✅ keycloak:refresh-token — use httpOnly cookie, not localStorage — Safari blocks third-party
75
+ ❌ oauth:pkce — PKCE + CORS broken in Safari 16.3, still unresolved
76
+
77
+ 🕐 Recent lessons:
78
+ ✅ redis:pipeline-batching — pipeline() for N writes, 10× faster than sequential
79
+ ✅ deploy:healthcheck — readinessProbe.failureThreshold must be ≥ 10 on cold starts
80
+ ✅ typescript:strictNullChecks — enable in tsconfig, catches 30% of runtime errors at compile time
56
81
  ```
57
82
 
58
- **Result:** Your AI remembers everything. Always.
83
+ Your AI arrives pre-briefed. No repeating yourself. No re-explaining the architecture.
59
84
 
60
85
  ---
61
86
 
62
- ## Quick Start (Manual)
87
+ ## The Cognitive Cache in Action
63
88
 
64
- **Step 1 — Get your free credentials** at [cachly.dev](https://cachly.dev) (25 MB free, forever, no credit card).
89
+ ### Root Cause Analysis Through Memory
65
90
 
66
- **Step 2 — Add to your editor's MCP config:**
91
+ ```
92
+ causal_trace(problem="auth fails after namespace restart")
67
93
 
68
- <details>
69
- <summary><b>Claude Code</b> (<code>~/.claude/mcp.json</code> or <code>.mcp.json</code>)</summary>
94
+ 🔍 Causal Trace — "auth fails after namespace restart"
70
95
 
71
- ```json
72
- {
73
- "mcpServers": {
74
- "cachly": {
75
- "type": "stdio",
76
- "command": "npx",
77
- "args": ["-y", "@cachly-dev/mcp-server@latest"],
78
- "env": {
79
- "CACHLY_JWT": "your-jwt-token",
80
- "CACHLY_INSTANCE_ID": "your-instance-id"
81
- }
82
- }
83
- }
84
- }
96
+ Found 7 related memories (3 failures · 1 partial · 2 fixes)
97
+
98
+ ❌ Root causes / similar failures:
99
+ 1. [12.03.2025] 🔴 `k8s:namespace-terminating` (relevance 9/10)
100
+ ↳ Cannot create resources in Terminating namespace — must wait for full deletion
101
+ 2. [08.02.2025] 🟡 `keycloak:jwks-cache-race` (relevance 6/10)
102
+ ↳ Concurrent JWKS map access panics under load — needs RWMutex
103
+
104
+ ✅ What solved similar problems:
105
+ • `k8s:namespace-wait` — PollUntilContextTimeout 3min loop until NotFound
106
+ • `auth:jwks-singleton` — double-checked locking pattern, init once on startup
107
+
108
+ 🧩 Likely causal chain:
109
+ `k8s:namespace-terminating`
110
+ ↓ led to `keycloak:jwks-cache-race`
111
+ ↓ current symptom: auth fails after namespace restart
112
+
113
+ 🎯 Recommended fix: apply `k8s:namespace-wait` solution
85
114
  ```
86
- </details>
87
115
 
88
- <details>
89
- <summary><b>Cursor / Windsurf / VS Code</b> (<code>.cursor/mcp.json</code> / <code>.mcp.json</code>)</summary>
116
+ ### Knowledge Decay — Trust What's Still True
90
117
 
91
- ```json
92
- {
93
- "servers": {
94
- "cachly": {
95
- "type": "stdio",
96
- "command": "npx",
97
- "args": ["-y", "@cachly-dev/mcp-server@latest"],
98
- "env": {
99
- "CACHLY_JWT": "your-jwt-token",
100
- "CACHLY_INSTANCE_ID": "your-instance-id"
101
- }
102
- }
103
- }
104
- }
105
118
  ```
106
- </details>
119
+ knowledge_decay(threshold_days=30)
107
120
 
108
- **Step 3 — Add to `CLAUDE.md` / `.github/copilot-instructions.md`:**
121
+ ⏱️ Knowledge Decay Analysis
122
+
123
+ 🧠 31 total memories · 24 healthy (avg 88% confidence) · 7 decaying
124
+
125
+ ⚠️ 7 memories need re-verification:
126
+
127
+ ██████████ 100% — `auth:jwt-refresh` (3d old · recalled 5×)
128
+ ████████░░ 80% 🟡 `k8s:resource-limits` (45d old · recalled 1×)
129
+ █████░░░░░ 52% `deploy:docker-compose` (78d old · recalled 0×)
130
+ ███░░░░░░░ 31% 🔴 `stripe:webhook-secret` (112d old · recalled 0×)
131
+ ██░░░░░░░░ 22% `react:concurrent-mode` (140d old · recalled 0×)
132
+
133
+ 💡 Re-validate top decaying memories before critical tasks.
134
+ ```
135
+
136
+ ### Brain Diff — See What You've Learned
137
+
138
+ ```
139
+ brain_diff(since_sessions=5)
140
+
141
+ 📊 Brain Diff — knowledge delta over last 5 sessions
142
+
143
+ 🧠 Total: 31 lessons · +12 new · 19 pre-existing
144
+
145
+ 📅 Sessions covered:
146
+ • 04.05.2026 (23m) — Fixed auth redirect loop + pushed to main
147
+ • 03.05.2026 (61m) — K8s provisioner: namespace termination wait
148
+ • 02.05.2026 (34m) — Token refresh + JWKS race condition
149
+
150
+ ➕ 12 new lessons learned:
151
+ ✅ 🔴 `auth:token-refresh` — Store refresh token in JWT callback, refresh at <60s TTL
152
+ ✅ 🟡 `k8s:namespace-terminating` — Wait 3min via PollUntilContextTimeout before recreate
153
+ ✅ 🟡 `api:status-codes` — Always 201 for paid tier; checkout_url in body is the signal
154
+ ❌ `stripe:402-redirect` — 402 blocks fetch(), use 201 + JSON body for checkout flow
155
+ …and 8 more
156
+
157
+ 📚 19 lessons unchanged (stable knowledge base)
158
+ ```
159
+
160
+ ### Autopilot — Zero-Config Forever Memory
109
161
 
110
- ```markdown
111
- ## AI Brain Rules (cachly)
112
- - Call session_start BEFORE reading any files or making changes
113
- - Call learn_from_attempts AFTER every fix, deploy, or discovery
114
- - Call session_end when closing the window
115
162
  ```
163
+ autopilot(instance_id="...", project_dir="/home/you/myproject", write=true)
164
+
165
+ 🤖 cachly Autopilot — zero-config AI memory for myproject
166
+
167
+ Brain: 31 lessons stored · Instance: `a1b2c3d4…`
168
+
169
+ ✅ Written to:
170
+ • /home/you/myproject/CLAUDE.md
171
+ • /home/you/myproject/.github/copilot-instructions.md
172
+
173
+ 🎯 Autopilot is live. This AI — and any other AI on this project —
174
+ will now manage memory automatically.
175
+ ```
176
+
177
+ From that point on: no manual `session_start`, no manual `learn_from_attempts`, no manual `session_end`. The AI does it all, every time, forever.
116
178
 
117
179
  ---
118
180
 
119
- ## With vs. Without cachly
181
+ ## Before vs. After
120
182
 
121
183
  | Situation | Without cachly | With cachly |
122
184
  |-----------|----------------|-------------|
123
- | Session start | "What's your architecture?" | "Ready. 23 lessons, last session: deployed API." |
124
- | Known bug hits again | Re-researches from scratch | "You fixed this on March 12, here's the exact command" |
125
- | After holiday / team handoff | Context dead | Fully briefed in < 10 seconds |
126
- | Repeated LLM patterns | Pays for each re-discovery | Cached by meaning, ~1,200 tokens saved per hit |
127
- | New team member | Weeks to onboard | `session_start` gives full context instantly |
185
+ | Session start | "What's your architecture?" | Briefed in 2s — lessons, last session, open failures |
186
+ | Bug hits again | Re-researches from scratch (20–40 min) | "You fixed this on March 12, exact command: `kubectl rollout restart`" |
187
+ | "Why is X broken?" | Manual investigation from scratch | `causal_trace` traces root cause through memory in seconds |
188
+ | "Can I trust this lesson?" | No way to know | `knowledge_decay` shows confidence % per memory |
189
+ | After holiday | Context completely dead | Full context restored, team lessons visible |
190
+ | New team member | Weeks to onboard | `session_start` gives full codebase context instantly |
191
+ | Model switch | Start over with new AI | Brain is model-agnostic — Claude, GPT-4, Gemini, all share one brain |
192
+ | Context limit | Lose everything | `compact_recover` restores checkpoint + lessons in one call |
128
193
 
129
194
  ---
130
195
 
131
- ## 51 MCP Tools
132
-
133
- ### 🧠 Session & Memory (most used)
196
+ ## Bootstrap from Git History
134
197
 
135
- | Tool | What it does |
136
- |------|-------------|
137
- | **`session_start`** | Full briefing: last session summary, open failures, recent lessons, brain health |
138
- | **`session_end`** | Save what you built, auto-extract lessons from summary + ambient git log |
139
- | **`session_handoff`** | Hand off remaining tasks to next window, with context |
140
- | **`auto_learn_session`** | Batch-learn from a list of observations |
141
- | **`sync_file_changes`** | Sync changed files into brain index |
142
- | **`learn_from_attempts`** | Store structured lessons after any fix, deploy, or discovery |
143
- | **`recall_best_solution`** | Best known solution for a topic — with success/failure history |
144
- | **`recall_at`** | Recall a lesson at a specific point in time |
145
- | **`remember_context`** | Cache architecture findings, decisions, file summaries |
146
- | **`recall_context`** | Get exact context by key (supports glob) |
147
- | **`list_remembered`** | See all cached context entries |
148
- | **`forget_context`** | Remove stale context |
149
- | **`smart_recall`** | BM25+ full-text search across all brain data — multilingual: EN, DE, FR, ES, IT, PT, ZH, JA, KO, **AR, HE** |
150
- | **`setup_ai_memory`** | Interactive wizard to configure AI memory |
151
-
152
- ### 🌍 Multilingual Brain — Search in Any Language
153
-
154
- The Brain's search engine understands **11 languages natively** — no configuration required.
155
-
156
- | Script | Languages | Tokenization |
157
- |--------|-----------|-------------|
158
- | Latin | EN, DE, FR, ES, IT, PT | Whitespace + stopwords |
159
- | CJK | Chinese (ZH), Japanese (JA), Korean (KO) | Character bigrams |
160
- | RTL | Arabic (AR), Hebrew (HE) | Word tokenization + light stemming |
161
-
162
- **Romanization matching** — store lessons in Japanese, search in romaji:
163
- ```
164
- smart_recall("kontena") → finds コンテナ docs
165
- smart_recall("depuroi") → finds デプロイ docs
198
+ ```bash
199
+ npx @cachly-dev/mcp-server@latest learn
166
200
  ```
167
201
 
168
- **Cross-language retrieval** — 130+ tech term synonyms EN↔JA↔ZH↔KO↔AR↔HE:
202
+ **One command. 2 years of team knowledge. 30 seconds.**
203
+
204
+ `brain_from_git` reads your git log and extracts lessons automatically:
205
+
169
206
  ```
170
- smart_recall("deploy") → finds デプロイ, 部署, 배포, نشر, פריסה
171
- smart_recall("デプロイ") → finds "deploy", "deployment"
172
- smart_recall("خطأ") → finds "error", エラー, 错误
207
+ 🧠 Brain bootstrapped from git history
208
+
209
+ 📊 Scanned: 342 commits over last 180 days
210
+ ✅ Success lessons: 28 ❌ Failure/revert lessons: 9
211
+ 📁 Hotspot files tracked: 12
212
+ 💾 Total stored: 31 new lessons
213
+
214
+ Top lessons extracted:
215
+ ✅🟡 `auth:jwt-refresh-token` — Use httpOnly cookie, not localStorage — Safari blocks third-party
216
+ ❌🔴 `deploy:docker-compose-detach` — Reverted: "docker compose up without -d blocks SSH terminal"
217
+ ✅🟡 `redis:connection-pool-timeout` — connectTimeout:5000 + retryStrategy:null prevents hangs
218
+ ❌🔴 `auth:pkce-safari-16` — PKCE flow broken Safari 16.3, still unresolved
173
219
  ```
174
220
 
175
- ### 💡 Legendary Brain Features
221
+ ---
176
222
 
177
- | Feature | How it works |
178
- |---------|-------------|
179
- | **Team Telepathy** | Multi-dev Brain: the `author` param on `learn_from_attempts` shares fixes across the whole team. Every `session_start` shows colleagues' lessons. |
180
- | **Ambient Git Learning** | Pass `workspace_path` to `session_end` — it auto-reads `git log`, stores recent commits as Brain lessons. Zero extra calls. |
181
- | **Memory Crystals** | `memory_crystalize` distills all lessons into a compact Crystal injected at every `session_start`. AI arrives pre-loaded with team knowledge. |
182
- | **IQ Boost** | `brain_doctor` reports `iq_boost_pct` — how much smarter your AI gets vs. baseline from cached lessons. |
223
+ ## Full Tool Reference
183
224
 
184
- ### ⚙️ Instance Management
225
+ ### Cognitive Cache (v0.6 — new)
185
226
 
186
227
  | Tool | What it does |
187
228
  |------|-------------|
188
- | `list_instances` | List all your cache instances |
189
- | `create_instance` | Spin up a new instance (free or paid) |
190
- | `get_connection_string` | Get the `redis://` URL for your app |
191
- | `delete_instance` | Remove an instance |
192
- | `get_real_time_stats` | Memory, hit rate, ops/sec |
229
+ | **`memory_consolidate`** | Distill knowledge base: detect contradictions, merge duplicates, prune stale. Knowledge health score 0–100. |
230
+ | **`brain_diff`** | Git-style diff for AI knowledge — what was learned, updated, or went stale since N sessions |
231
+ | **`causal_trace`** | Root cause analysis: given a problem, traces backwards through memory to find cause + recommended fix |
232
+ | **`knowledge_decay`** | Temporal confidence per memory — decay by age, recover by recall frequency |
233
+ | **`autopilot`** | Generates and optionally writes CLAUDE.md that makes any AI fully self-managing |
193
234
 
194
- ### 🗄️ Cache Operations
235
+ ### Session & Memory
195
236
 
196
237
  | Tool | What it does |
197
238
  |------|-------------|
198
- | `cache_get` / `cache_set` / `cache_delete` | Standard cache operations |
199
- | `cache_mget` / `cache_mset` | Bulk pipeline (single round-trip) |
200
- | `cache_lock_acquire` / `cache_lock_release` | Distributed Redlock-lite |
201
- | `cache_stream_set` / `cache_stream_get` | LLM token stream caching |
202
-
203
- ### 🔍 Semantic Cache
239
+ | **`session_start`** | Full briefing: last session, open TODOs, checkpoint, lessons, brain stats |
240
+ | **`session_end`** | Save session + auto-refresh CLAUDE.md with top lessons inline |
241
+ | **`session_ping`** | Cross-provider checkpoint — switch Claude↔Copilot↔Cursor seamlessly |
242
+ | **`compact_recover`** | One call after context compaction — restores checkpoint + TODOs + critical lessons |
243
+ | **`brain_from_git`** | Bootstrap brain from git history — no manual lesson writing required |
244
+ | **`learn_from_attempts`** | Store lessons after any fix, deploy, or discovery |
245
+ | **`recall_best_solution`** | Best known fix for a topic — with full success/failure history |
246
+ | **`smart_recall`** | Full-text search across all brain data (BM25+) |
247
+ | **`todo_add`** / **`todo_done`** | Persistent TODOs — survive sessions, compaction, provider switches |
248
+ | **`refresh_claude_md`** | Embed top lessons inline in CLAUDE.md — ambient brain without tool calls |
249
+ | **`remember_context`** / **`recall_context`** | Save/restore architecture findings, file summaries, ADRs |
250
+ | **`auto_learn_session`** | Batch-store multiple observations at session end |
251
+ | **`sync_file_changes`** | Track file change history, surface related lessons per file |
252
+
253
+ ### Team Brain
204
254
 
205
255
  | Tool | What it does |
206
256
  |------|-------------|
207
- | `semantic_search` | Find cached entries by meaning (pgvector HNSW, EU-hosted) |
208
- | `semantic_warmup` | Pre-warm cache with prompt/response pairs |
209
- | `detect_namespace` | Auto-classify prompt into code/qa/summary/translation/creative |
257
+ | **`team_learn`** / **`team_recall`** | Share lessons across the whole team on a shared instance |
258
+ | **`invite_link`** | Generate `npx ... join <token>` — teammate connects in one command |
259
+ | **`global_learn`** / **`global_recall`** | Cross-project global knowledge base |
260
+ | **`publish_lesson`** / **`import_public_brain`** | Share knowledge with the community |
261
+ | **`brain_stats`** | Dashboard: lessons, recalls, time saved, top topics, team authors |
262
+ | **`export_brain`** | Full Markdown export — share, archive, or import |
263
+ | **`brain_doctor`** | Health check: lesson quality, open failures, recommendations |
210
264
 
211
- ### 👥 Team Brain
265
+ ### Cache & Infrastructure
212
266
 
213
267
  | Tool | What it does |
214
268
  |------|-------------|
215
- | `team_learn` / `team_recall` | Share lessons across the team |
216
- | `team_synthesize` | Consolidate multiple lessons into one authoritative version |
217
- | `memory_crystalize` | Distill all lessons into a Crystal snapshot for instant team context |
218
- | `brain_doctor` | Health check: lesson count, IQ boost %, open failures, quality score |
219
- | `global_learn` / `global_recall` | Cross-project universal lessons |
220
- | `publish_lesson` / `import_public_brain` | Share/import community knowledge |
221
- | `trace_dependency` | Causal chain — find lessons affected by a dependency change |
222
- | `list_orgs` / `create_org` | Manage team organizations |
223
- | `invite_member` / `get_org_plan` | Invite a developer to your org by email |
269
+ | `cache_get` / `cache_set` / `cache_delete` | Standard Redis/Valkey operations |
270
+ | `cache_mget` / `cache_mset` | Bulk pipeline (single round-trip) |
271
+ | `cache_stats` | Memory, hit rate, ops/sec, keyspace info |
272
+ | `semantic_search` | Find cached entries by meaning (vector search, EU-hosted) |
273
+ | `cache_warmup` | Pre-warm cache from file or URL list |
274
+ | `cache_lock_acquire` / `cache_lock_release` | Distributed locking |
275
+ | `cache_stream_set` / `cache_stream_get` | Cache streaming LLM responses in chunks |
276
+ | `get_connection_string` | Get the `redis://` URL for your own app |
224
277
 
225
278
  ---
226
279
 
@@ -228,13 +281,82 @@ smart_recall("خطأ") → finds "error", エラー, 错误
228
281
 
229
282
  | Tier | RAM | Price | Best for |
230
283
  |------|-----|-------|----------|
231
- | **Free** | 25 MB | **€0/mo forever** | Dev & side projects |
284
+ | **Free** | 25 MB | **€0/mo forever** | Side projects & solo devs |
232
285
  | **Dev** | 200 MB | €19/mo | Individual developers |
233
- | **Pro** | 900 MB | €49/mo | Teams |
234
- | **Speed** | 900 MB + Dragonfly + Semantic Cache | €79/mo | AI-heavy workloads |
286
+ | **Pro** | 900 MB | €49/mo | Teams (shared brain) |
287
+ | **Speed** | 900 MB + Dragonfly + Semantic | €79/mo | AI-heavy workloads |
235
288
  | **Business** | 7 GB | €199/mo | Scale-ups |
236
289
 
237
- ✅ All plans: **German servers · GDPR-compliant · 99.9% SLA · No credit card for Free tier**
290
+ ✅ All plans: **German servers · GDPR-compliant · 99.9% SLA · no credit card for Free**
291
+
292
+ ---
293
+
294
+ ## Manual Setup
295
+
296
+ <details>
297
+ <summary>Claude Code (<code>~/.claude/mcp.json</code> or <code>.mcp.json</code>)</summary>
298
+
299
+ ```json
300
+ {
301
+ "mcpServers": {
302
+ "cachly": {
303
+ "type": "stdio",
304
+ "command": "npx",
305
+ "args": ["-y", "@cachly-dev/mcp-server@latest"],
306
+ "env": {
307
+ "CACHLY_JWT": "your-api-key",
308
+ "CACHLY_BRAIN_INSTANCE_ID": "your-instance-id"
309
+ }
310
+ }
311
+ }
312
+ }
313
+ ```
314
+ </details>
315
+
316
+ <details>
317
+ <summary>Cursor / Windsurf (<code>.cursor/mcp.json</code> or <code>.mcp.json</code>)</summary>
318
+
319
+ ```json
320
+ {
321
+ "servers": {
322
+ "cachly": {
323
+ "type": "stdio",
324
+ "command": "npx",
325
+ "args": ["-y", "@cachly-dev/mcp-server@latest"],
326
+ "env": {
327
+ "CACHLY_JWT": "your-api-key",
328
+ "CACHLY_BRAIN_INSTANCE_ID": "your-instance-id"
329
+ }
330
+ }
331
+ }
332
+ }
333
+ ```
334
+ </details>
335
+
336
+ <details>
337
+ <summary>Autopilot CLAUDE.md (generated by <code>autopilot</code> tool)</summary>
338
+
339
+ ```markdown
340
+ # My Project — cachly AI Brain (Autopilot)
341
+
342
+ > Brain instance: `your-instance-id` · 31 lessons stored
343
+
344
+ ## Memory Protocol — follow these rules automatically, every session
345
+
346
+ ### SESSION START (before any work)
347
+ mcp__cachly__compact_recover({"instance_id":"..."})
348
+ mcp__cachly__smart_recall({"instance_id":"...","query":"<describe your task>"})
349
+
350
+ ### WHEN SOMETHING WORKS
351
+ mcp__cachly__learn_from_attempts({"instance_id":"...","topic":"<topic>","outcome":"success","what_worked":"<solution>","severity":"major"})
352
+
353
+ ### ROOT CAUSE ANALYSIS
354
+ mcp__cachly__causal_trace({"instance_id":"...","problem":"<symptom>"})
355
+
356
+ ### SESSION END (always)
357
+ mcp__cachly__session_end({"instance_id":"...","summary":"<one sentence>","files_changed":["..."]})
358
+ ```
359
+ </details>
238
360
 
239
361
  ---
240
362
 
@@ -242,30 +364,27 @@ smart_recall("خطأ") → finds "error", エラー, 错误
242
364
 
243
365
  | Variable | Default | Description |
244
366
  |----------|---------|-------------|
245
- | `CACHLY_JWT` | — | **Required.** Your API token from [cachly.dev](https://cachly.dev) |
246
- | `CACHLY_INSTANCE_ID` | — | Default instance UUID (optional if you pass per-call) |
367
+ | `CACHLY_JWT` | — | **Required.** API key or JWT from the setup wizard |
368
+ | `CACHLY_BRAIN_INSTANCE_ID` | — | Default instance UUID — set once, works in all tools |
247
369
  | `CACHLY_API_URL` | `https://api.cachly.dev` | Override for self-hosted |
248
- | `CACHLY_NO_TELEMETRY` | unset | Set to `1` to disable anonymous usage pings |
249
- | `CACHLY_NO_UPDATE_CHECK` | unset | Set to `1` to disable the version-check on startup |
370
+ | `CACHLY_EMBED_PROVIDER` | auto-detect | `openai` \| `gemini` \| `mistral` \| `cohere` \| `ollama` \| `cachly` |
371
+ | `CACHLY_NO_TELEMETRY` | unset | Set to `1` to opt out of anonymous usage pings |
250
372
 
251
373
  ---
252
374
 
253
- ## 🛠️ Ecosystem
375
+ ## Ecosystem
254
376
 
255
377
  | Package | What it does |
256
378
  |---------|-------------|
257
- | **[`@cachly-dev/mcp-server`](https://www.npmjs.com/package/@cachly-dev/mcp-server)** | ← you are here — AI Brain MCP tools for Claude Code, Cursor, Copilot, Windsurf |
258
- | **[`@cachly-dev/openclaw`](https://www.npmjs.com/package/@cachly-dev/openclaw)** | JS/TS SDK — cut LLM costs 60–90% with semantic cache + BM25 in your own app, 3 lines of code |
259
- | **[`@cachly-dev/init`](https://www.npmjs.com/package/@cachly-dev/init)** | One-command setup wizard: auto-detects all your editors and writes the correct MCP config — `npx @cachly-dev/init` |
260
- | **[`@cachly-dev/cli`](https://www.npmjs.com/package/@cachly-dev/cli)** | Terminal CLI — manage instances, cache data, brain lessons: `npm i -g @cachly-dev/cli` |
261
- | **[`@cachly-dev/sdk`](https://www.npmjs.com/package/@cachly-dev/sdk)** | Node.js/TypeScript SDK — use managed Redis, semantic cache & AI memory directly in your app |
379
+ | **[`@cachly-dev/mcp-server`](https://www.npmjs.com/package/@cachly-dev/mcp-server)** | ← you are here — Cognitive Cache MCP for Claude, Cursor, Copilot, Windsurf |
380
+ | **[`cachly-brain` (VS Code)](https://marketplace.visualstudio.com/items?itemName=cachly.cachly-brain)** | VS Code extension — status bar, CodeLens lessons, one-click setup |
381
+ | **[`@cachly-dev/openclaw`](https://www.npmjs.com/package/@cachly-dev/openclaw)** | JS/TS SDK — cut LLM costs 60–90% with semantic cache in your own app |
382
+ | **[`@cachly-dev/sdk`](https://www.npmjs.com/package/@cachly-dev/sdk)** | Node.js SDK — managed Redis, semantic cache & AI memory in your app |
262
383
 
263
384
  ---
264
385
 
265
386
  ## Links
266
387
 
267
388
  - 🌐 [cachly.dev](https://cachly.dev) — Dashboard & free signup
268
- - 📖 [AI Brain docs](https://cachly.dev/docs/ai-memory) — Full documentation
269
- - 💬 [GitHub Issues](https://github.com/cachly-dev/mcp-server/issues) — Bug reports & feature requests
270
- - ⭐ [Star on GitHub](https://github.com/cachly-dev/mcp-server) — If cachly saves you time, a star means a lot!
271
- - 📦 [npm](https://www.npmjs.com/package/@cachly-dev/mcp-server)
389
+ - 📖 [Docs](https://cachly.dev/docs/ai-memory) — Full documentation
390
+ - 💬 [Issues](https://github.com/cachly-dev/cachly-mcp/issues) — Bug reports & feature requests
package/dist/index.d.ts CHANGED
@@ -1,44 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * Stopwords — filtered out during tokenization.
4
- * Covers: English, German, French, Spanish, Italian, Portuguese,
5
- * Chinese (Simplified + Traditional), Japanese, Korean.
4
+ * Covers: English, German, French, Spanish, Italian, Portuguese.
6
5
  * Keeps the index small and scores meaningful.
7
6
  */
8
7
  declare const STOPWORDS: Set<string>;
9
- /**
10
- * Convert a katakana string to Hepburn romaji.
11
- * Handles digraphs, geminate consonants (ッ), and long vowel marks (ー).
12
- */
13
- declare function katakanaToRomaji(kata: string): string;
14
- /**
15
- * Arabic light stemmer — strips definite article and common prefix particles.
16
- * Handles: ال (al-), و (wa-), ب (bi-), ل (li-), ف (fa-), ك (ka-).
17
- * Runs iteratively (max 3 passes) so compound prefixes like فال- are fully
18
- * resolved: فالخطأ → الخطأ → خطأ.
19
- * Only strips when the result is still ≥ 3 chars to avoid over-stemming.
20
- */
21
- declare function arabicLightStem(word: string): string;
22
- declare const CROSS_LINGUAL_MAP: Map<string, string[]>;
23
- /**
24
- * Expand a token to its cross-lingual synonyms.
25
- * Returns synonyms to be added to the token stream (pre-tokenized).
26
- * CJK synonyms are NOT pre-bigram'd here — caller handles that.
27
- */
28
- declare function expandCrossLingual(token: string): string[];
29
- /**
30
- * Tokenize text into meaningful keywords.
31
- * Handles accented Latin, RTL (Arabic, Hebrew), and CJK (Chinese, Japanese, Korean).
32
- *
33
- * Features:
34
- * • CJK → character bigrams
35
- * • Katakana → additionally emits Hepburn romaji tokens (enables romaji queries)
36
- * • Arabic → word tokenization + iterative prefix stemming (ال/و/ب/ل/ف/ك)
37
- * • Hebrew → word tokenization + iterative prefix stemming (ה/ו/ב/ל/מ/כ)
38
- * • Farsi → word tokenization + suffix/prefix stemming (ها/های plural, می prefix)
39
- * • Hindi → Devanagari word tokenization + light suffix stemming
40
- * • All scripts → cross-lingual synonym expansion (EN↔JA↔ZH↔KO↔AR↔HE↔FA↔HI↔DE↔FR↔ES↔IT↔PT)
41
- */
8
+ /** Tokenize text into meaningful keywords. Handles unicode (accented chars). */
42
9
  declare function tokenize(text: string): string[];
43
10
  /**
44
11
  * Split a multi-topic query into sub-queries.
@@ -61,4 +28,4 @@ declare function levenshtein(a: string, b: string): number;
61
28
  declare function extractTimestamp(content: string): number | undefined;
62
29
  /** Recency multiplier: 1.0 for now, 0.5 after half-life days, exponential decay. */
63
30
  declare function recencyBoost(timestampMs: number | undefined): number;
64
- export { tokenize, splitMultiQuery, levenshtein, recencyBoost, extractTimestamp, STOPWORDS, katakanaToRomaji, arabicLightStem, expandCrossLingual, CROSS_LINGUAL_MAP };
31
+ export { tokenize, splitMultiQuery, levenshtein, recencyBoost, extractTimestamp, STOPWORDS };