@cachly-dev/mcp-server 0.1.0 → 0.5.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/CHANGELOG.md +22 -2
- package/README.md +50 -83
- package/dist/index.d.ts +30 -1
- package/dist/index.js +1067 -174
- package/dist/index.js.map +1 -1
- package/dist/search.test.d.ts +1 -0
- package/dist/search.test.js +238 -0
- package/dist/search.test.js.map +1 -0
- package/package.json +2 -3
- package/src/index.ts +1167 -191
- package/src/search.test.ts +282 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
# Changelog – cachly SDK (mcp)
|
|
2
2
|
|
|
3
3
|
**Language:** MCP (Model Context Protocol)
|
|
4
|
-
**Package:** `@cachly-dev/mcp` on **npm**
|
|
4
|
+
**Package:** `@cachly-dev/mcp-server` on **npm**
|
|
5
5
|
|
|
6
6
|
> Full cross-SDK release notes: [../CHANGELOG.md](../CHANGELOG.md)
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
## [0.2.0] – 2026-04-
|
|
10
|
+
## [0.2.0] – 2026-04-17
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`setup` command** — interactive zero-arg CLI wizard (`npx @cachly-dev/mcp-server setup`):
|
|
15
|
+
- Reads `CACHLY_JWT` from env or prompts interactively via readline
|
|
16
|
+
- Fetches instances from API; presents list when multiple exist
|
|
17
|
+
- Auto-detects installed editors (Cursor, Windsurf, VS Code, Continue.dev) by checking for their config directories
|
|
18
|
+
- Writes the correct MCP config file for each detected editor in one step
|
|
19
|
+
- Always writes/updates `CLAUDE.md` (idempotent via `<!-- cachly-brain-start/end -->` markers)
|
|
20
|
+
- **`init` command** now idempotent — re-running `npx @cachly-dev/mcp-server init` updates the brain block in `CLAUDE.md` instead of appending a duplicate
|
|
21
|
+
- Shared helpers: `buildMcpConfig()`, `buildClaudeMdBlock()`, `writeClaudeMd()` — used by both `setup` and `init`
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
- `init` no longer duplicates the brain block in `CLAUDE.md` when run multiple times
|
|
26
|
+
- Correct package name `@cachly-dev/mcp-server` used consistently (was `@cachly-dev/mcp` in generated configs)
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## [0.1.1] – 2026-04-07
|
|
11
31
|
|
|
12
32
|
### Fixed
|
|
13
33
|
|
package/README.md
CHANGED
|
@@ -2,49 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
> Manage your [cachly.dev](https://cachly.dev) cache instances directly from **GitHub Copilot, Claude, Cursor, Windsurf** and any other MCP-compatible AI assistant.
|
|
4
4
|
|
|
5
|
-
## 🚀
|
|
5
|
+
## 🚀 Zero-Touch Setup — One Command
|
|
6
6
|
|
|
7
|
-
Stop your AI from re-reading your entire codebase every time. One command enables **context memory
|
|
7
|
+
Stop your AI from re-reading your entire codebase every time. One command enables **context memory** and configures all your editors automatically:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
|
|
11
|
-
# 2. Copy your JWT token from Settings
|
|
12
|
-
# 3. Add to .vscode/mcp.json:
|
|
10
|
+
CACHLY_JWT=your-jwt npx @cachly-dev/mcp-server setup
|
|
13
11
|
```
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"args": ["-y", "@cachly-dev/mcp-server"],
|
|
22
|
-
"env": {
|
|
23
|
-
"CACHLY_JWT": "your-jwt-token-here"
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
```
|
|
13
|
+
The interactive wizard will:
|
|
14
|
+
1. Authenticate with your cachly account (or prompt for JWT)
|
|
15
|
+
2. Let you pick which cache instance to use as your AI Brain
|
|
16
|
+
3. **Auto-detect** Cursor, Windsurf, VS Code, Claude Code, and Continue.dev
|
|
17
|
+
4. Write the correct MCP config for every detected editor
|
|
18
|
+
5. Create/update `CLAUDE.md` (idempotent — safe to re-run)
|
|
29
19
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```markdown
|
|
33
|
-
## Cachly AI Brain
|
|
34
|
-
|
|
35
|
-
At the START of every session — single call:
|
|
36
|
-
session_start(instance_id = "<your-instance-id>", focus = "<what you're working on>")
|
|
20
|
+
**Result:** 60% fewer file reads, instant context across sessions, zero re-discovery.
|
|
37
21
|
|
|
38
|
-
|
|
39
|
-
session_end(instance_id = "<your-instance-id>", summary = "...", files_changed = [...])
|
|
22
|
+
### Non-interactive (CI / scripted setup)
|
|
40
23
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
24
|
+
```bash
|
|
25
|
+
CACHLY_JWT=your-jwt npx @cachly-dev/mcp-server init \
|
|
26
|
+
--instance-id your-instance-id \
|
|
27
|
+
--editor vscode
|
|
44
28
|
```
|
|
45
29
|
|
|
46
|
-
**Result:** 60% fewer file reads, instant context across sessions, zero re-discovery.
|
|
47
|
-
|
|
48
30
|
## What you can do
|
|
49
31
|
|
|
50
32
|
Once connected, just talk to your AI assistant:
|
|
@@ -68,7 +50,7 @@ Once connected, just talk to your AI assistant:
|
|
|
68
50
|
| **`recall_best_solution`** | Retrieve the best known solution for a topic (increments recall count). |
|
|
69
51
|
| **`remember_context`** | Cache any analysis or architecture finding for future sessions. |
|
|
70
52
|
| **`recall_context`** | Retrieve cached context by exact key (supports glob: `"file:*"`). |
|
|
71
|
-
| **`smart_recall`** |
|
|
53
|
+
| **`smart_recall`** | BM25+ keyword search across all cached context. Works **without any embedding provider**. Optionally adds semantic vector search if an API key is configured. |
|
|
72
54
|
| **`list_remembered`** | List all cached context entries. |
|
|
73
55
|
| **`forget_context`** | Delete stale context. |
|
|
74
56
|
|
|
@@ -105,73 +87,74 @@ Once connected, just talk to your AI assistant:
|
|
|
105
87
|
|
|
106
88
|
## Setup
|
|
107
89
|
|
|
108
|
-
###
|
|
90
|
+
### Recommended: Zero-Touch via npx
|
|
109
91
|
|
|
110
92
|
```bash
|
|
111
|
-
|
|
112
|
-
npm run build
|
|
93
|
+
CACHLY_JWT=your-jwt npx @cachly-dev/mcp-server setup
|
|
113
94
|
```
|
|
114
95
|
|
|
115
|
-
|
|
96
|
+
No install, no build step. The wizard auto-detects your editors and writes all config files.
|
|
116
97
|
|
|
117
|
-
|
|
98
|
+
### Manual configuration
|
|
118
99
|
|
|
119
|
-
|
|
100
|
+
Get your JWT token at **[cachly.dev/settings](https://cachly.dev/settings)** → API Tokens.
|
|
120
101
|
|
|
121
|
-
####
|
|
122
|
-
|
|
123
|
-
Add to `.vscode/mcp.json` in your project (or global user settings):
|
|
102
|
+
#### Claude Code / Claude Desktop
|
|
124
103
|
|
|
125
104
|
```json
|
|
126
105
|
{
|
|
127
|
-
"
|
|
106
|
+
"mcpServers": {
|
|
128
107
|
"cachly": {
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"env": {
|
|
133
|
-
"CACHLY_JWT": "your-jwt-token-here",
|
|
134
|
-
"CACHLY_API_URL": "https://api.cachly.dev"
|
|
135
|
-
}
|
|
108
|
+
"command": "npx",
|
|
109
|
+
"args": ["-y", "@cachly-dev/mcp-server"],
|
|
110
|
+
"env": { "CACHLY_JWT": "your-jwt-token-here" }
|
|
136
111
|
}
|
|
137
112
|
}
|
|
138
113
|
}
|
|
139
114
|
```
|
|
140
115
|
|
|
141
|
-
|
|
116
|
+
- **Claude Code:** add to `.claude/mcp.json` in your project
|
|
117
|
+
- **Claude Desktop (macOS):** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
142
118
|
|
|
143
|
-
####
|
|
119
|
+
#### GitHub Copilot (VS Code)
|
|
144
120
|
|
|
145
|
-
Add to
|
|
121
|
+
Add to `.vscode/mcp.json`:
|
|
146
122
|
|
|
147
123
|
```json
|
|
148
124
|
{
|
|
149
|
-
"
|
|
125
|
+
"servers": {
|
|
150
126
|
"cachly": {
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
|
|
155
|
-
}
|
|
127
|
+
"type": "stdio",
|
|
128
|
+
"command": "npx",
|
|
129
|
+
"args": ["-y", "@cachly-dev/mcp-server"],
|
|
130
|
+
"env": { "CACHLY_JWT": "your-jwt-token-here" }
|
|
156
131
|
}
|
|
157
132
|
}
|
|
158
133
|
}
|
|
159
134
|
```
|
|
160
135
|
|
|
161
|
-
|
|
136
|
+
Then: **Ctrl/Cmd+Shift+P → "MCP: List Servers"** → start `cachly`.
|
|
162
137
|
|
|
163
|
-
|
|
138
|
+
#### Cursor
|
|
164
139
|
|
|
165
|
-
|
|
140
|
+
Add to `.cursor/mcp.json`:
|
|
166
141
|
|
|
167
142
|
```json
|
|
168
143
|
{
|
|
169
|
-
"
|
|
170
|
-
|
|
171
|
-
|
|
144
|
+
"mcpServers": {
|
|
145
|
+
"cachly": {
|
|
146
|
+
"command": "npx",
|
|
147
|
+
"args": ["-y", "@cachly-dev/mcp-server"],
|
|
148
|
+
"env": { "CACHLY_JWT": "your-jwt-token-here" }
|
|
149
|
+
}
|
|
150
|
+
}
|
|
172
151
|
}
|
|
173
152
|
```
|
|
174
153
|
|
|
154
|
+
#### Windsurf / Continue.dev
|
|
155
|
+
|
|
156
|
+
Same `stdio`/`mcpServers` format — add to their respective MCP config file.
|
|
157
|
+
|
|
175
158
|
## Environment Variables
|
|
176
159
|
|
|
177
160
|
| Variable | Required | Default | Description |
|
|
@@ -242,23 +225,7 @@ AI: [calls smart_recall("auth")]
|
|
|
242
225
|
(No file reading needed — instant answer!)
|
|
243
226
|
```
|
|
244
227
|
|
|
245
|
-
**
|
|
246
|
-
|
|
247
|
-
1. Add to `.github/copilot-instructions.md` (or `CLAUDE.md` for Claude Code):
|
|
248
|
-
```markdown
|
|
249
|
-
## Cachly AI Brain
|
|
250
|
-
|
|
251
|
-
At the START of every session:
|
|
252
|
-
session_start(instance_id = "<id>", focus = "<what you plan to work on>")
|
|
253
|
-
|
|
254
|
-
At the END of every session:
|
|
255
|
-
session_end(instance_id = "<id>", summary = "...", files_changed = [...])
|
|
256
|
-
|
|
257
|
-
After any bug fix: learn_from_attempts(instance_id = "<id>", topic = "category:keyword",
|
|
258
|
-
outcome = "success", what_worked = "...", severity = "major")
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
2. From now on: your AI calls `session_start` first and never re-reads what it already knows.
|
|
228
|
+
The `setup` wizard (see top of this README) writes the session instructions automatically into your `CLAUDE.md` / `.github/copilot-instructions.md` — **no manual editing needed.** Just run `npx @cachly-dev/mcp-server setup` once and your AI assistant calls `session_start` at the start of every session automatically.
|
|
262
229
|
|
|
263
230
|
### 1. AI-Assisted Development — "Which caches am I using?"
|
|
264
231
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Stopwords — filtered out during tokenization.
|
|
4
|
+
* Covers: English, German, French, Spanish, Italian, Portuguese.
|
|
5
|
+
* Keeps the index small and scores meaningful.
|
|
6
|
+
*/
|
|
7
|
+
declare const STOPWORDS: Set<string>;
|
|
8
|
+
/** Tokenize text into meaningful keywords. Handles unicode (accented chars). */
|
|
9
|
+
declare function tokenize(text: string): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Split a multi-topic query into sub-queries.
|
|
12
|
+
* Detects numbered lists, semicolons, "and also", line breaks, etc.
|
|
13
|
+
*
|
|
14
|
+
* Example: "deploy API fix routing and also check auth" →
|
|
15
|
+
* ["deploy API fix routing", "check auth"]
|
|
16
|
+
*
|
|
17
|
+
* Example: "1. deploy 2. fix routing 3. auth" →
|
|
18
|
+
* ["deploy", "fix routing", "auth"]
|
|
19
|
+
*/
|
|
20
|
+
declare function splitMultiQuery(query: string): string[];
|
|
21
|
+
/**
|
|
22
|
+
* Levenshtein distance — edit distance between two strings.
|
|
23
|
+
* Used for typo-tolerant fuzzy matching (distance ≤ 2 = match).
|
|
24
|
+
* O(n*m) but strings are short (tokens), so this is fast.
|
|
25
|
+
*/
|
|
26
|
+
declare function levenshtein(a: string, b: string): number;
|
|
27
|
+
/** Extract a timestamp from JSON content (looks for "ts" or "created" fields). */
|
|
28
|
+
declare function extractTimestamp(content: string): number | undefined;
|
|
29
|
+
/** Recency multiplier: 1.0 for now, 0.5 after half-life days, exponential decay. */
|
|
30
|
+
declare function recencyBoost(timestampMs: number | undefined): number;
|
|
31
|
+
export { tokenize, splitMultiQuery, levenshtein, recencyBoost, extractTimestamp, STOPWORDS };
|