vektor-slipstream 1.1.13 → 1.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/examples/example-claude-mcp.js +135 -213
- package/package.json +5 -19
- package/vektor-tui.js +268 -277
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
'use strict';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
|
-
* VEKTOR SLIPSTREAM — Claude Desktop MCP Server v1.
|
|
6
|
-
* Responds to initialize immediately, loads memory lazily
|
|
4
|
+
* VEKTOR SLIPSTREAM — Claude Desktop MCP Server v1.4
|
|
7
5
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Tools:
|
|
7
|
+
* Memory: vektor_recall, vektor_store, vektor_graph, vektor_delta
|
|
8
|
+
* Cloak: cloak_fetch, cloak_render, cloak_diff, cloak_diff_text,
|
|
9
|
+
* cloak_passport, tokens_saved, cloak_fetch_smart,
|
|
10
|
+
* cloak_detect_captcha, cloak_solve_captcha,
|
|
11
|
+
* cloak_identity_create, cloak_identity_use, cloak_identity_list,
|
|
12
|
+
* turbo_quant_stats, turbo_quant_compress
|
|
13
|
+
* Warmup: cloak_warmup_session, cloak_warmup_stats
|
|
14
|
+
* Behav: cloak_inject_behaviour, cloak_behaviour_stats, cloak_load_pattern
|
|
15
|
+
* Pattern: cloak_pattern_stats, cloak_pattern_list, cloak_pattern_prune, cloak_pattern_seed
|
|
10
16
|
*
|
|
11
|
-
*
|
|
12
|
-
* cloak_detect_captcha, cloak_solve_captcha,
|
|
13
|
-
* cloak_identity_create, cloak_identity_use, cloak_identity_list,
|
|
14
|
-
* turbo_quant_stats, turbo_quant_compress
|
|
15
|
-
*
|
|
16
|
-
* v1.3 additions: cloak_warmup_session, cloak_warmup_stats,
|
|
17
|
-
* cloak_inject_behaviour, cloak_behaviour_stats, cloak_load_pattern
|
|
18
|
-
*
|
|
19
|
-
* v1.4 additions: cloak_pattern_stats, cloak_pattern_list, cloak_pattern_prune, cloak_pattern_seed
|
|
17
|
+
* Windows-safe: no shebang line (breaks Windows Node.js when invoked directly)
|
|
20
18
|
*/
|
|
21
19
|
|
|
22
20
|
const path = require('path');
|
|
@@ -25,19 +23,19 @@ const os = require('os');
|
|
|
25
23
|
const IS_MCP = process.argv.includes('--mcp');
|
|
26
24
|
if (!IS_MCP) { require('./example-claude-direct'); return; }
|
|
27
25
|
|
|
28
|
-
// ── Tool definitions
|
|
26
|
+
// ── Tool definitions ───────────────────────────────────────────────────────────
|
|
29
27
|
|
|
30
28
|
const TOOLS = [
|
|
31
29
|
|
|
32
|
-
// ── Memory tools
|
|
30
|
+
// ── Memory tools ──────────────────────────────────────────────────────────────
|
|
33
31
|
{
|
|
34
32
|
name: 'vektor_recall',
|
|
35
33
|
description: 'Search persistent memory. Call before answering anything that might have prior context.',
|
|
36
|
-
|
|
34
|
+
inputSchema: {
|
|
37
35
|
type: 'object',
|
|
38
36
|
properties: {
|
|
39
|
-
query: { type: 'string' },
|
|
40
|
-
top_k: { type: 'integer', default: 5 },
|
|
37
|
+
query: { type: 'string', description: 'What to search for.' },
|
|
38
|
+
top_k: { type: 'integer', description: 'Number of results (default 5).', default: 5 },
|
|
41
39
|
},
|
|
42
40
|
required: ['query'],
|
|
43
41
|
},
|
|
@@ -45,11 +43,11 @@ const TOOLS = [
|
|
|
45
43
|
{
|
|
46
44
|
name: 'vektor_store',
|
|
47
45
|
description: 'Store a fact, preference, or decision in persistent memory.',
|
|
48
|
-
|
|
46
|
+
inputSchema: {
|
|
49
47
|
type: 'object',
|
|
50
48
|
properties: {
|
|
51
|
-
content: { type: 'string' },
|
|
52
|
-
importance: { type: 'number' },
|
|
49
|
+
content: { type: 'string', description: 'What to remember.' },
|
|
50
|
+
importance: { type: 'number', description: 'Importance 1-5 (default 3).', default: 3 },
|
|
53
51
|
},
|
|
54
52
|
required: ['content'],
|
|
55
53
|
},
|
|
@@ -57,11 +55,11 @@ const TOOLS = [
|
|
|
57
55
|
{
|
|
58
56
|
name: 'vektor_graph',
|
|
59
57
|
description: 'Traverse the memory graph from a concept.',
|
|
60
|
-
|
|
58
|
+
inputSchema: {
|
|
61
59
|
type: 'object',
|
|
62
60
|
properties: {
|
|
63
|
-
concept: { type: 'string' },
|
|
64
|
-
hops: { type: 'integer', default: 2 },
|
|
61
|
+
concept: { type: 'string', description: 'Concept to traverse from.' },
|
|
62
|
+
hops: { type: 'integer', description: 'Graph depth (default 2).', default: 2 },
|
|
65
63
|
},
|
|
66
64
|
required: ['concept'],
|
|
67
65
|
},
|
|
@@ -69,21 +67,21 @@ const TOOLS = [
|
|
|
69
67
|
{
|
|
70
68
|
name: 'vektor_delta',
|
|
71
69
|
description: 'See what changed in memory on a topic.',
|
|
72
|
-
|
|
70
|
+
inputSchema: {
|
|
73
71
|
type: 'object',
|
|
74
72
|
properties: {
|
|
75
|
-
topic: { type: 'string' },
|
|
76
|
-
days: { type: 'integer', default: 7 },
|
|
73
|
+
topic: { type: 'string', description: 'Topic to check.' },
|
|
74
|
+
days: { type: 'integer', description: 'How many days back (default 7).', default: 7 },
|
|
77
75
|
},
|
|
78
76
|
required: ['topic'],
|
|
79
77
|
},
|
|
80
78
|
},
|
|
81
79
|
|
|
82
|
-
// ── v1.1 Cloak tools
|
|
80
|
+
// ── v1.1 Cloak tools ──────────────────────────────────────────────────────────
|
|
83
81
|
{
|
|
84
82
|
name: 'cloak_fetch',
|
|
85
83
|
description: 'Fetch a URL using stealth headless browser. Returns clean compressed text. Saves tokens vs raw HTML.',
|
|
86
|
-
|
|
84
|
+
inputSchema: {
|
|
87
85
|
type: 'object',
|
|
88
86
|
properties: {
|
|
89
87
|
url: { type: 'string' },
|
|
@@ -96,7 +94,7 @@ const TOOLS = [
|
|
|
96
94
|
{
|
|
97
95
|
name: 'cloak_render',
|
|
98
96
|
description: 'Render a page and return computed CSS layout, fonts, and gap analysis.',
|
|
99
|
-
|
|
97
|
+
inputSchema: {
|
|
100
98
|
type: 'object',
|
|
101
99
|
properties: {
|
|
102
100
|
url: { type: 'string' },
|
|
@@ -109,18 +107,16 @@ const TOOLS = [
|
|
|
109
107
|
{
|
|
110
108
|
name: 'cloak_diff',
|
|
111
109
|
description: 'Return what semantically changed on a URL since last fetch.',
|
|
112
|
-
|
|
110
|
+
inputSchema: {
|
|
113
111
|
type: 'object',
|
|
114
|
-
properties: {
|
|
115
|
-
url: { type: 'string' },
|
|
116
|
-
},
|
|
112
|
+
properties: { url: { type: 'string' } },
|
|
117
113
|
required: ['url'],
|
|
118
114
|
},
|
|
119
115
|
},
|
|
120
116
|
{
|
|
121
117
|
name: 'cloak_diff_text',
|
|
122
118
|
description: 'Diff two text strings and return a semantic change summary.',
|
|
123
|
-
|
|
119
|
+
inputSchema: {
|
|
124
120
|
type: 'object',
|
|
125
121
|
properties: {
|
|
126
122
|
a: { type: 'string', description: 'Original text' },
|
|
@@ -132,7 +128,7 @@ const TOOLS = [
|
|
|
132
128
|
{
|
|
133
129
|
name: 'cloak_passport',
|
|
134
130
|
description: 'Read/write to AES-256 encrypted credential vault. Omit value to read.',
|
|
135
|
-
|
|
131
|
+
inputSchema: {
|
|
136
132
|
type: 'object',
|
|
137
133
|
properties: {
|
|
138
134
|
key: { type: 'string' },
|
|
@@ -144,7 +140,7 @@ const TOOLS = [
|
|
|
144
140
|
{
|
|
145
141
|
name: 'tokens_saved',
|
|
146
142
|
description: 'Calculate token savings and ROI for a session.',
|
|
147
|
-
|
|
143
|
+
inputSchema: {
|
|
148
144
|
type: 'object',
|
|
149
145
|
properties: {
|
|
150
146
|
raw_tokens: { type: 'number' },
|
|
@@ -157,62 +153,60 @@ const TOOLS = [
|
|
|
157
153
|
},
|
|
158
154
|
},
|
|
159
155
|
|
|
160
|
-
// ── v1.2 Cloak tools
|
|
156
|
+
// ── v1.2 Cloak tools ──────────────────────────────────────────────────────────
|
|
161
157
|
{
|
|
162
158
|
name: 'cloak_fetch_smart',
|
|
163
|
-
description: 'Smart fetch — checks llms.txt first
|
|
164
|
-
|
|
159
|
+
description: 'Smart fetch — checks llms.txt first, falls back to stealth browser.',
|
|
160
|
+
inputSchema: {
|
|
165
161
|
type: 'object',
|
|
166
162
|
properties: {
|
|
167
163
|
url: { type: 'string' },
|
|
168
164
|
force: { type: 'boolean' },
|
|
169
|
-
skipLlmsCheck: { type: 'boolean'
|
|
165
|
+
skipLlmsCheck: { type: 'boolean' },
|
|
170
166
|
},
|
|
171
167
|
required: ['url'],
|
|
172
168
|
},
|
|
173
169
|
},
|
|
174
170
|
{
|
|
175
171
|
name: 'cloak_detect_captcha',
|
|
176
|
-
description: 'Navigate to a URL and detect if a CAPTCHA is present.
|
|
177
|
-
|
|
172
|
+
description: 'Navigate to a URL and detect if a CAPTCHA is present.',
|
|
173
|
+
inputSchema: {
|
|
178
174
|
type: 'object',
|
|
179
|
-
properties: {
|
|
180
|
-
url: { type: 'string' },
|
|
181
|
-
},
|
|
175
|
+
properties: { url: { type: 'string' } },
|
|
182
176
|
required: ['url'],
|
|
183
177
|
},
|
|
184
178
|
},
|
|
185
179
|
{
|
|
186
180
|
name: 'cloak_solve_captcha',
|
|
187
|
-
description: '
|
|
188
|
-
|
|
181
|
+
description: 'Detect and solve any CAPTCHA using vision AI. Injects solution automatically.',
|
|
182
|
+
inputSchema: {
|
|
189
183
|
type: 'object',
|
|
190
184
|
properties: {
|
|
191
185
|
url: { type: 'string' },
|
|
192
|
-
provider: { type: 'string', description: '
|
|
186
|
+
provider: { type: 'string', description: '"claude" (default) or "openai"' },
|
|
193
187
|
},
|
|
194
188
|
required: ['url'],
|
|
195
189
|
},
|
|
196
190
|
},
|
|
197
191
|
{
|
|
198
192
|
name: 'cloak_identity_create',
|
|
199
|
-
description: 'Create a persistent browser identity
|
|
200
|
-
|
|
193
|
+
description: 'Create a persistent browser identity with full fingerprint.',
|
|
194
|
+
inputSchema: {
|
|
201
195
|
type: 'object',
|
|
202
196
|
properties: {
|
|
203
|
-
name: { type: 'string'
|
|
204
|
-
seed: { type: 'string'
|
|
197
|
+
name: { type: 'string' },
|
|
198
|
+
seed: { type: 'string' },
|
|
205
199
|
},
|
|
206
200
|
required: ['name'],
|
|
207
201
|
},
|
|
208
202
|
},
|
|
209
203
|
{
|
|
210
204
|
name: 'cloak_identity_use',
|
|
211
|
-
description: 'Browse a URL using a saved identity. Maintains cookies
|
|
212
|
-
|
|
205
|
+
description: 'Browse a URL using a saved identity. Maintains cookies across sessions.',
|
|
206
|
+
inputSchema: {
|
|
213
207
|
type: 'object',
|
|
214
208
|
properties: {
|
|
215
|
-
name: { type: 'string'
|
|
209
|
+
name: { type: 'string' },
|
|
216
210
|
url: { type: 'string' },
|
|
217
211
|
},
|
|
218
212
|
required: ['name', 'url'],
|
|
@@ -220,86 +214,60 @@ const TOOLS = [
|
|
|
220
214
|
},
|
|
221
215
|
{
|
|
222
216
|
name: 'cloak_identity_list',
|
|
223
|
-
description: 'List all saved browser identities
|
|
224
|
-
|
|
225
|
-
type: 'object',
|
|
226
|
-
properties: {},
|
|
227
|
-
},
|
|
217
|
+
description: 'List all saved browser identities.',
|
|
218
|
+
inputSchema: { type: 'object', properties: {} },
|
|
228
219
|
},
|
|
229
220
|
{
|
|
230
221
|
name: 'turbo_quant_stats',
|
|
231
|
-
description: 'Show TurboQuant 3-bit compression stats
|
|
232
|
-
|
|
233
|
-
type: 'object',
|
|
234
|
-
properties: {},
|
|
235
|
-
},
|
|
222
|
+
description: 'Show TurboQuant 3-bit compression stats.',
|
|
223
|
+
inputSchema: { type: 'object', properties: {} },
|
|
236
224
|
},
|
|
237
225
|
{
|
|
238
226
|
name: 'turbo_quant_compress',
|
|
239
|
-
description: 'Migrate
|
|
240
|
-
|
|
227
|
+
description: 'Migrate memory database to TurboQuant 3-bit compressed storage. ~10x size reduction.',
|
|
228
|
+
inputSchema: {
|
|
241
229
|
type: 'object',
|
|
242
230
|
properties: {
|
|
243
|
-
dbPath: { type: 'string'
|
|
231
|
+
dbPath: { type: 'string' },
|
|
244
232
|
},
|
|
245
233
|
},
|
|
246
234
|
},
|
|
247
235
|
|
|
248
|
-
// ── v1.3
|
|
249
|
-
{
|
|
250
|
-
name: 'cloak_pattern_stats',
|
|
251
|
-
description: 'Show self-improving pattern store stats — tier breakdown, win/loss rates, total sessions recorded.',
|
|
252
|
-
input_schema: { type: 'object', properties: {} },
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
name: 'cloak_pattern_list',
|
|
256
|
-
description: 'List all behaviour patterns in the store with score, tier, wins, and losses.',
|
|
257
|
-
input_schema: {
|
|
258
|
-
type: 'object',
|
|
259
|
-
properties: {
|
|
260
|
-
tier: { type: 'string', enum: ['elite', 'active', 'probation'], description: 'Filter by tier (optional)' },
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
name: 'cloak_pattern_prune',
|
|
266
|
-
description: 'Force prune the pattern store. Removes stale, low-scoring, and aged-out patterns.',
|
|
267
|
-
input_schema: { type: 'object', properties: {} },
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
name: 'cloak_pattern_seed',
|
|
271
|
-
description: 'Seed the store with built-in patterns (only runs if store is empty).',
|
|
272
|
-
input_schema: { type: 'object', properties: {} },
|
|
273
|
-
},
|
|
236
|
+
// ── v1.3 Warmup & Behaviour tools ─────────────────────────────────────────────
|
|
274
237
|
{
|
|
275
238
|
name: 'cloak_warmup_session',
|
|
276
|
-
description: 'Run a
|
|
277
|
-
|
|
239
|
+
description: 'Run a session warmup before navigating to a bot-protected URL. Primes reCAPTCHA trust score.',
|
|
240
|
+
inputSchema: {
|
|
278
241
|
type: 'object',
|
|
279
242
|
properties: {
|
|
280
|
-
targetUrl: { type: 'string'
|
|
281
|
-
identityName: { type: 'string'
|
|
282
|
-
sites: { type: 'integer',
|
|
283
|
-
dwellMs: { type: 'integer',
|
|
284
|
-
primeGoogle: { type: 'boolean',
|
|
285
|
-
visitRoot: { type: 'boolean',
|
|
286
|
-
customSites: { type: 'array', items: { type: 'string' }
|
|
243
|
+
targetUrl: { type: 'string' },
|
|
244
|
+
identityName: { type: 'string' },
|
|
245
|
+
sites: { type: 'integer', default: 3 },
|
|
246
|
+
dwellMs: { type: 'integer', default: 2500 },
|
|
247
|
+
primeGoogle: { type: 'boolean', default: true },
|
|
248
|
+
visitRoot: { type: 'boolean', default: true },
|
|
249
|
+
customSites: { type: 'array', items: { type: 'string' } },
|
|
287
250
|
},
|
|
288
251
|
required: ['targetUrl'],
|
|
289
252
|
},
|
|
290
253
|
},
|
|
254
|
+
{
|
|
255
|
+
name: 'cloak_warmup_stats',
|
|
256
|
+
description: 'Show warmup strategy details — trust signals, referrer chains, timing.',
|
|
257
|
+
inputSchema: { type: 'object', properties: {} },
|
|
258
|
+
},
|
|
291
259
|
{
|
|
292
260
|
name: 'cloak_inject_behaviour',
|
|
293
|
-
description: 'Inject human-realistic mouse/scroll behaviour into a browser session.
|
|
294
|
-
|
|
261
|
+
description: 'Inject human-realistic mouse/scroll behaviour into a browser session.',
|
|
262
|
+
inputSchema: {
|
|
295
263
|
type: 'object',
|
|
296
264
|
properties: {
|
|
297
265
|
url: { type: 'string' },
|
|
298
266
|
category: { type: 'string', enum: ['reading', 'form', 'shopping', 'login', 'idle'] },
|
|
299
|
-
patternName: { type: 'string'
|
|
300
|
-
speedFactor: { type: 'number'
|
|
301
|
-
synthetic: { type: 'boolean'
|
|
302
|
-
durationMs: { type: 'integer'
|
|
267
|
+
patternName: { type: 'string' },
|
|
268
|
+
speedFactor: { type: 'number' },
|
|
269
|
+
synthetic: { type: 'boolean' },
|
|
270
|
+
durationMs: { type: 'integer' },
|
|
303
271
|
},
|
|
304
272
|
required: ['url'],
|
|
305
273
|
},
|
|
@@ -307,29 +275,48 @@ const TOOLS = [
|
|
|
307
275
|
{
|
|
308
276
|
name: 'cloak_behaviour_stats',
|
|
309
277
|
description: 'List available behaviour patterns and categories.',
|
|
310
|
-
|
|
278
|
+
inputSchema: { type: 'object', properties: {} },
|
|
311
279
|
},
|
|
312
280
|
{
|
|
313
281
|
name: 'cloak_load_pattern',
|
|
314
282
|
description: 'Load a custom behaviour pattern recorded with cloak-recorder-snippet.js.',
|
|
315
|
-
|
|
283
|
+
inputSchema: {
|
|
316
284
|
type: 'object',
|
|
317
285
|
properties: {
|
|
318
286
|
name: { type: 'string' },
|
|
319
287
|
pattern: { type: 'string', description: 'JSON string from recorder' },
|
|
320
|
-
save: { type: 'boolean'
|
|
288
|
+
save: { type: 'boolean' },
|
|
321
289
|
},
|
|
322
290
|
required: ['name', 'pattern'],
|
|
323
291
|
},
|
|
324
292
|
},
|
|
293
|
+
|
|
294
|
+
// ── v1.4 Pattern store tools ──────────────────────────────────────────────────
|
|
325
295
|
{
|
|
326
|
-
name: '
|
|
327
|
-
description: 'Show
|
|
328
|
-
|
|
296
|
+
name: 'cloak_pattern_stats',
|
|
297
|
+
description: 'Show self-improving pattern store stats — tier breakdown, win/loss rates.',
|
|
298
|
+
inputSchema: { type: 'object', properties: {} },
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
name: 'cloak_pattern_list',
|
|
302
|
+
description: 'List all behaviour patterns with score, tier, wins, and losses.',
|
|
303
|
+
inputSchema: {
|
|
329
304
|
type: 'object',
|
|
330
|
-
properties: {
|
|
305
|
+
properties: {
|
|
306
|
+
tier: { type: 'string', enum: ['elite', 'active', 'probation'] },
|
|
307
|
+
},
|
|
331
308
|
},
|
|
332
309
|
},
|
|
310
|
+
{
|
|
311
|
+
name: 'cloak_pattern_prune',
|
|
312
|
+
description: 'Force prune the pattern store — removes stale and low-scoring patterns.',
|
|
313
|
+
inputSchema: { type: 'object', properties: {} },
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: 'cloak_pattern_seed',
|
|
317
|
+
description: 'Seed the store with built-in patterns (only runs if store is empty).',
|
|
318
|
+
inputSchema: { type: 'object', properties: {} },
|
|
319
|
+
},
|
|
333
320
|
];
|
|
334
321
|
|
|
335
322
|
// ── Lazy loaders ──────────────────────────────────────────────────────────────
|
|
@@ -356,12 +343,12 @@ function getCloak() {
|
|
|
356
343
|
}
|
|
357
344
|
|
|
358
345
|
let _warmup = null;
|
|
359
|
-
let _behaviour = null;
|
|
360
346
|
function getWarmup() {
|
|
361
347
|
if (!_warmup) _warmup = require('vektor-slipstream/cloak-warmup');
|
|
362
348
|
return _warmup;
|
|
363
349
|
}
|
|
364
350
|
|
|
351
|
+
let _behaviour = null;
|
|
365
352
|
function getBehaviour() {
|
|
366
353
|
if (!_behaviour) _behaviour = require('vektor-slipstream/cloak-behaviour');
|
|
367
354
|
return _behaviour;
|
|
@@ -373,19 +360,11 @@ function getPatternStore() {
|
|
|
373
360
|
return _patternStore;
|
|
374
361
|
}
|
|
375
362
|
|
|
376
|
-
let _autoRecorder = null;
|
|
377
|
-
function getAutoRecorder() {
|
|
378
|
-
if (!_autoRecorder) _autoRecorder = require('vektor-slipstream/cloak-recorder-auto');
|
|
379
|
-
return _autoRecorder;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
363
|
// ── Tool runner ───────────────────────────────────────────────────────────────
|
|
383
364
|
|
|
384
365
|
async function runTool(name, input) {
|
|
385
366
|
switch (name) {
|
|
386
367
|
|
|
387
|
-
// ── Memory tools ───────────────────────────────────────────────────────────
|
|
388
|
-
|
|
389
368
|
case 'vektor_recall': {
|
|
390
369
|
const mem = await getMemory();
|
|
391
370
|
const results = await mem.recall(input.query, input.top_k || 5);
|
|
@@ -394,7 +373,7 @@ async function runTool(name, input) {
|
|
|
394
373
|
|
|
395
374
|
case 'vektor_store': {
|
|
396
375
|
const mem = await getMemory();
|
|
397
|
-
const { id } = await mem.remember(input.content, { importance: input.importance ||
|
|
376
|
+
const { id } = await mem.remember(input.content, { importance: input.importance || 3 });
|
|
398
377
|
return { stored: true, id, content: input.content };
|
|
399
378
|
}
|
|
400
379
|
|
|
@@ -410,8 +389,6 @@ async function runTool(name, input) {
|
|
|
410
389
|
return { topic: input.topic, changes: changes.slice(0, 10) };
|
|
411
390
|
}
|
|
412
391
|
|
|
413
|
-
// ── v1.1 Cloak tools ───────────────────────────────────────────────────────
|
|
414
|
-
|
|
415
392
|
case 'cloak_fetch': {
|
|
416
393
|
const r = await getCloak().cloak_fetch(input.url, { force: input.force, limit: input.limit });
|
|
417
394
|
return { text: r.text, tokens_saved: r.tokensSaved, from_cache: r.fromCache };
|
|
@@ -443,21 +420,11 @@ async function runTool(name, input) {
|
|
|
443
420
|
});
|
|
444
421
|
}
|
|
445
422
|
|
|
446
|
-
// ── v1.2 Cloak tools ───────────────────────────────────────────────────────
|
|
447
|
-
|
|
448
423
|
case 'cloak_fetch_smart': {
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
force: input.force,
|
|
452
|
-
skipLlmsCheck: input.skipLlmsCheck,
|
|
424
|
+
const result = await getCloak().cloak_fetch_smart(input.url, {
|
|
425
|
+
force: input.force, skipLlmsCheck: input.skipLlmsCheck,
|
|
453
426
|
});
|
|
454
|
-
return {
|
|
455
|
-
text: result.text,
|
|
456
|
-
tokens_saved: result.tokensSaved,
|
|
457
|
-
from_cache: result.fromCache,
|
|
458
|
-
source: result.source,
|
|
459
|
-
llms_friendly: result.llmsFriendly,
|
|
460
|
-
};
|
|
427
|
+
return { text: result.text, tokens_saved: result.tokensSaved, from_cache: result.fromCache, source: result.source, llms_friendly: result.llmsFriendly };
|
|
461
428
|
}
|
|
462
429
|
|
|
463
430
|
case 'cloak_detect_captcha': {
|
|
@@ -484,9 +451,9 @@ async function runTool(name, input) {
|
|
|
484
451
|
const page = await browser.newPage();
|
|
485
452
|
await page.goto(input.url, { waitUntil: 'domcontentloaded', timeout: 20000 });
|
|
486
453
|
const detected = await captcha.detectCaptcha(page);
|
|
487
|
-
if (!detected) return { solved: false, reason: 'No CAPTCHA detected
|
|
454
|
+
if (!detected) return { solved: false, reason: 'No CAPTCHA detected' };
|
|
488
455
|
const token = await captcha.solveCaptcha(page, detected, {
|
|
489
|
-
provider:
|
|
456
|
+
provider: input.provider || 'claude',
|
|
490
457
|
anthropicKey: process.env.ANTHROPIC_API_KEY,
|
|
491
458
|
});
|
|
492
459
|
if (token) {
|
|
@@ -510,15 +477,13 @@ async function runTool(name, input) {
|
|
|
510
477
|
const { CloakIdentity } = getCloak();
|
|
511
478
|
const { chromium } = require('playwright');
|
|
512
479
|
const id = CloakIdentity.load(input.name);
|
|
513
|
-
if (!id) return { error: `Identity "${input.name}" not found. Create
|
|
480
|
+
if (!id) return { error: `Identity "${input.name}" not found. Create with cloak_identity_create first.` };
|
|
514
481
|
let browser;
|
|
515
482
|
try {
|
|
516
483
|
browser = await chromium.launch({ headless: true });
|
|
517
484
|
const context = await browser.newContext({
|
|
518
|
-
viewport:
|
|
519
|
-
|
|
520
|
-
timezoneId: id.profile.timezone,
|
|
521
|
-
locale: id.profile.language,
|
|
485
|
+
viewport: id.profile.viewport, userAgent: id.profile.userAgent,
|
|
486
|
+
timezoneId: id.profile.timezone, locale: id.profile.language,
|
|
522
487
|
});
|
|
523
488
|
await id.applyToContext(context);
|
|
524
489
|
const page = await context.newPage();
|
|
@@ -538,19 +503,16 @@ async function runTool(name, input) {
|
|
|
538
503
|
|
|
539
504
|
case 'cloak_identity_list': {
|
|
540
505
|
const { CloakIdentity } = getCloak();
|
|
541
|
-
|
|
542
|
-
return names.map(n => CloakIdentity.load(n)?.summary).filter(Boolean);
|
|
506
|
+
return CloakIdentity.list().map(n => CloakIdentity.load(n)?.summary).filter(Boolean);
|
|
543
507
|
}
|
|
544
508
|
|
|
545
509
|
case 'turbo_quant_stats': {
|
|
546
|
-
|
|
547
|
-
return turboQuant.compressionStats(384);
|
|
510
|
+
return getCloak().turboQuant.compressionStats(384);
|
|
548
511
|
}
|
|
549
512
|
|
|
550
513
|
case 'turbo_quant_compress': {
|
|
551
514
|
const { turboQuant } = getCloak();
|
|
552
|
-
const dbPath = input.dbPath ||
|
|
553
|
-
process.env.VEKTOR_DB_PATH ||
|
|
515
|
+
const dbPath = input.dbPath || process.env.VEKTOR_DB_PATH ||
|
|
554
516
|
path.join(os.homedir(), 'vektor-slipstream-memory.db');
|
|
555
517
|
const Database = require('better-sqlite3');
|
|
556
518
|
const db = new Database(dbPath);
|
|
@@ -559,12 +521,8 @@ async function runTool(name, input) {
|
|
|
559
521
|
return { ...result, dbPath };
|
|
560
522
|
}
|
|
561
523
|
|
|
562
|
-
// ── v1.3 Cloak tools ───────────────────────────────────────────────────────
|
|
563
|
-
|
|
564
524
|
case 'cloak_warmup_session': {
|
|
565
525
|
const { quickWarmup } = getWarmup();
|
|
566
|
-
|
|
567
|
-
// Load identity profile if one was named
|
|
568
526
|
let identityProfile = null;
|
|
569
527
|
if (input.identityName) {
|
|
570
528
|
try {
|
|
@@ -573,49 +531,32 @@ async function runTool(name, input) {
|
|
|
573
531
|
if (id) identityProfile = id.profile;
|
|
574
532
|
} catch (_) {}
|
|
575
533
|
}
|
|
576
|
-
|
|
577
534
|
return await quickWarmup(input.targetUrl, identityProfile, {
|
|
578
|
-
sites:
|
|
579
|
-
|
|
580
|
-
primeGoogle: input.primeGoogle ?? true,
|
|
581
|
-
visitRoot: input.visitRoot ?? true,
|
|
535
|
+
sites: input.sites ?? 3, dwellMs: input.dwellMs ?? 2500,
|
|
536
|
+
primeGoogle: input.primeGoogle ?? true, visitRoot: input.visitRoot ?? true,
|
|
582
537
|
customSites: input.customSites || null,
|
|
583
538
|
});
|
|
584
539
|
}
|
|
585
540
|
|
|
586
541
|
case 'cloak_warmup_stats': {
|
|
587
|
-
|
|
588
|
-
return warmupStats();
|
|
542
|
+
return getWarmup().warmupStats();
|
|
589
543
|
}
|
|
590
544
|
|
|
591
|
-
|
|
592
|
-
// ── v1.4 Behaviour tools ───────────────────────────────────────────────────
|
|
593
|
-
|
|
594
545
|
case 'cloak_inject_behaviour': {
|
|
595
546
|
const { injectBehaviour, replayPattern, syntheticBrowse } = getBehaviour();
|
|
596
547
|
const { chromium } = require('playwright');
|
|
597
548
|
let browser;
|
|
598
549
|
try {
|
|
599
550
|
browser = await chromium.launch({ headless: true });
|
|
600
|
-
const
|
|
601
|
-
const page = await context.newPage();
|
|
551
|
+
const page = await (await browser.newContext()).newPage();
|
|
602
552
|
await page.goto(input.url, { waitUntil: 'domcontentloaded', timeout: 30000 });
|
|
603
|
-
|
|
604
553
|
let result;
|
|
605
554
|
if (input.synthetic) {
|
|
606
|
-
result = await syntheticBrowse(page, {
|
|
607
|
-
durationMs: input.durationMs ?? 5000,
|
|
608
|
-
scrollDepth: 0.6,
|
|
609
|
-
pauseCount: 3,
|
|
610
|
-
});
|
|
555
|
+
result = await syntheticBrowse(page, { durationMs: input.durationMs ?? 5000, scrollDepth: 0.6, pauseCount: 3 });
|
|
611
556
|
} else if (input.patternName) {
|
|
612
|
-
result = await replayPattern(page, input.patternName, {
|
|
613
|
-
speedFactor: input.speedFactor ?? 1.0,
|
|
614
|
-
});
|
|
557
|
+
result = await replayPattern(page, input.patternName, { speedFactor: input.speedFactor ?? 1.0 });
|
|
615
558
|
} else {
|
|
616
|
-
result = await injectBehaviour(page, input.category || 'reading', {
|
|
617
|
-
speedFactor: input.speedFactor ?? 1.0,
|
|
618
|
-
});
|
|
559
|
+
result = await injectBehaviour(page, input.category || 'reading', { speedFactor: input.speedFactor ?? 1.0 });
|
|
619
560
|
}
|
|
620
561
|
return { injected: true, url: input.url, ...result };
|
|
621
562
|
} finally {
|
|
@@ -624,26 +565,18 @@ async function runTool(name, input) {
|
|
|
624
565
|
}
|
|
625
566
|
|
|
626
567
|
case 'cloak_behaviour_stats': {
|
|
627
|
-
|
|
628
|
-
return behaviourStats();
|
|
568
|
+
return getBehaviour().behaviourStats();
|
|
629
569
|
}
|
|
630
570
|
|
|
631
571
|
case 'cloak_load_pattern': {
|
|
632
572
|
const { loadCustomPattern, saveCustomPattern } = getBehaviour();
|
|
633
573
|
let data;
|
|
634
|
-
try { data = JSON.parse(input.pattern); } catch (e) {
|
|
635
|
-
return { error: 'Invalid JSON: ' + e.message };
|
|
636
|
-
}
|
|
574
|
+
try { data = JSON.parse(input.pattern); } catch (e) { return { error: 'Invalid JSON: ' + e.message }; }
|
|
637
575
|
const result = loadCustomPattern(input.name, data);
|
|
638
|
-
if (input.save !== false) {
|
|
639
|
-
try { saveCustomPattern(input.name); } catch (_) {}
|
|
640
|
-
}
|
|
576
|
+
if (input.save !== false) { try { saveCustomPattern(input.name); } catch (_) {} }
|
|
641
577
|
return result;
|
|
642
578
|
}
|
|
643
579
|
|
|
644
|
-
|
|
645
|
-
// ── v1.4 Pattern store tools ───────────────────────────────────────────────
|
|
646
|
-
|
|
647
580
|
case 'cloak_pattern_stats': {
|
|
648
581
|
const ps = getPatternStore();
|
|
649
582
|
ps.seedBuiltins();
|
|
@@ -651,18 +584,15 @@ async function runTool(name, input) {
|
|
|
651
584
|
}
|
|
652
585
|
|
|
653
586
|
case 'cloak_pattern_list': {
|
|
654
|
-
|
|
655
|
-
return ps.listPatterns(input.tier || null);
|
|
587
|
+
return getPatternStore().listPatterns(input.tier || null);
|
|
656
588
|
}
|
|
657
589
|
|
|
658
590
|
case 'cloak_pattern_prune': {
|
|
659
|
-
|
|
660
|
-
return ps.pruneNow();
|
|
591
|
+
return getPatternStore().pruneNow();
|
|
661
592
|
}
|
|
662
593
|
|
|
663
594
|
case 'cloak_pattern_seed': {
|
|
664
|
-
|
|
665
|
-
return ps.seedBuiltins();
|
|
595
|
+
return getPatternStore().seedBuiltins();
|
|
666
596
|
}
|
|
667
597
|
|
|
668
598
|
default:
|
|
@@ -675,9 +605,7 @@ async function runTool(name, input) {
|
|
|
675
605
|
process.stdin.setEncoding('utf8');
|
|
676
606
|
let buf = '';
|
|
677
607
|
|
|
678
|
-
function send(obj) {
|
|
679
|
-
process.stdout.write(JSON.stringify(obj) + '\n');
|
|
680
|
-
}
|
|
608
|
+
function send(obj) { process.stdout.write(JSON.stringify(obj) + '\n'); }
|
|
681
609
|
|
|
682
610
|
process.stdin.on('data', async chunk => {
|
|
683
611
|
buf += chunk;
|
|
@@ -687,11 +615,10 @@ process.stdin.on('data', async chunk => {
|
|
|
687
615
|
for (const line of lines) {
|
|
688
616
|
if (!line.trim()) continue;
|
|
689
617
|
let req;
|
|
690
|
-
try { req = JSON.parse(line); } catch
|
|
618
|
+
try { req = JSON.parse(line); } catch {
|
|
691
619
|
send({ jsonrpc: '2.0', id: null, error: { code: -32700, message: 'Parse error' } });
|
|
692
620
|
continue;
|
|
693
621
|
}
|
|
694
|
-
|
|
695
622
|
if (!req || typeof req.method !== 'string') continue;
|
|
696
623
|
if (req.method.startsWith('notifications/')) continue;
|
|
697
624
|
if (!('id' in req)) continue;
|
|
@@ -700,18 +627,16 @@ process.stdin.on('data', async chunk => {
|
|
|
700
627
|
if (req.method === 'initialize') {
|
|
701
628
|
send({ jsonrpc: '2.0', id: req.id, result: {
|
|
702
629
|
protocolVersion: '2025-11-25',
|
|
703
|
-
serverInfo: { name: 'vektor-slipstream', version: '1.
|
|
630
|
+
serverInfo: { name: 'vektor-slipstream', version: '1.2.0' },
|
|
704
631
|
capabilities: { tools: {} },
|
|
705
632
|
}});
|
|
706
633
|
getMemory().catch(e => process.stderr.write('[vektor-mcp] Memory init: ' + e.message + '\n'));
|
|
707
634
|
continue;
|
|
708
635
|
}
|
|
709
|
-
|
|
710
636
|
if (req.method === 'tools/list') {
|
|
711
637
|
send({ jsonrpc: '2.0', id: req.id, result: { tools: TOOLS } });
|
|
712
638
|
continue;
|
|
713
639
|
}
|
|
714
|
-
|
|
715
640
|
if (req.method === 'tools/call') {
|
|
716
641
|
const { name, arguments: args } = req.params;
|
|
717
642
|
const result = await runTool(name, args || {});
|
|
@@ -720,7 +645,6 @@ process.stdin.on('data', async chunk => {
|
|
|
720
645
|
}});
|
|
721
646
|
continue;
|
|
722
647
|
}
|
|
723
|
-
|
|
724
648
|
send({ jsonrpc: '2.0', id: req.id, error: { code: -32601, message: 'Method not found' } });
|
|
725
649
|
} catch (e) {
|
|
726
650
|
process.stderr.write('[vektor-mcp] Error: ' + e.message + '\n');
|
|
@@ -729,6 +653,4 @@ process.stdin.on('data', async chunk => {
|
|
|
729
653
|
}
|
|
730
654
|
});
|
|
731
655
|
|
|
732
|
-
process.stdin.resume();
|
|
733
|
-
|
|
734
|
-
|
|
656
|
+
process.stdin.resume();
|