@zilliz/claude-context-mcp 0.1.10 → 0.1.12
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 +32 -1
- package/dist/config.d.ts +8 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +28 -0
- package/dist/config.js.map +1 -1
- package/dist/embedding.d.ts.map +1 -1
- package/dist/embedding.js +4 -3
- package/dist/embedding.js.map +1 -1
- package/dist/handlers.d.ts.map +1 -1
- package/dist/handlers.js +71 -49
- package/dist/handlers.js.map +1 -1
- package/dist/snapshot.d.ts +11 -4
- package/dist/snapshot.d.ts.map +1 -1
- package/dist/snapshot.js +54 -3
- package/dist/snapshot.js.map +1 -1
- package/dist/snapshot.request-options.test.d.ts +2 -0
- package/dist/snapshot.request-options.test.d.ts.map +1 -0
- package/dist/snapshot.request-options.test.js +111 -0
- package/dist/snapshot.request-options.test.js.map +1 -0
- package/dist/splitter.d.ts +6 -0
- package/dist/splitter.d.ts.map +1 -0
- package/dist/splitter.js +16 -0
- package/dist/splitter.js.map +1 -0
- package/dist/sync.d.ts +16 -0
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +112 -2
- package/dist/sync.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -130,6 +130,9 @@ EMBEDDING_MODEL=nomic-embed-text
|
|
|
130
130
|
|
|
131
131
|
# Optional: Specify Ollama host (default: http://127.0.0.1:11434)
|
|
132
132
|
OLLAMA_HOST=http://127.0.0.1:11434
|
|
133
|
+
|
|
134
|
+
# Optional: Override embedding dimension to skip runtime dimension detection
|
|
135
|
+
EMBEDDING_DIMENSION=768
|
|
133
136
|
```
|
|
134
137
|
|
|
135
138
|
**Setup Instructions:**
|
|
@@ -197,6 +200,33 @@ CODE_CHUNKS_COLLECTION_NAME_OVERRIDE=my_project
|
|
|
197
200
|
|
|
198
201
|
The per-codebase `<pathHash>` suffix is preserved even when the override is set, so the same MCP server can still index multiple repos without collapsing them onto one collection. The override value is sanitized to letters, numbers, and underscores, and truncated to keep the full name within Milvus's 255-char limit. If you unset the variable later, Claude Context switches back to the plain `code_chunks_<pathHash>` naming.
|
|
199
202
|
|
|
203
|
+
#### Trigger File Watcher (Optional)
|
|
204
|
+
|
|
205
|
+
In addition to the periodic background sync, the MCP server watches a sentinel file at `~/.context/.sync-trigger` and starts an immediate re-index whenever the file is modified. This lets external tools (Claude Code `PostToolUse` hooks, editor save hooks, CI scripts, etc.) request a sync on demand instead of waiting for the next polling tick.
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Default: watcher enabled. Set to false to disable filesystem watching entirely
|
|
209
|
+
# (useful on read-only filesystems or sandboxed environments).
|
|
210
|
+
CLAUDE_CONTEXT_TRIGGER_WATCHER=true
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Example — Claude Code hook that re-indexes after every Edit/Write:
|
|
214
|
+
|
|
215
|
+
```json
|
|
216
|
+
"hooks": {
|
|
217
|
+
"PostToolUse": [
|
|
218
|
+
{ "matcher": "Edit|Write", "hooks": [
|
|
219
|
+
{ "type": "command", "command": "touch ~/.context/.sync-trigger" }
|
|
220
|
+
]}
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Notes:
|
|
226
|
+
- The trigger fires a debounced re-index (2 s window) so rapid touches collapse to a single sync.
|
|
227
|
+
- Triggered syncs go through the same global cross-process lock as background sync, so when multiple MCP processes share `$HOME` only one process performs the work per trigger.
|
|
228
|
+
- The trigger file's *contents* are ignored — only the modification event matters.
|
|
229
|
+
|
|
200
230
|
## Usage with MCP Clients
|
|
201
231
|
|
|
202
232
|
<details>
|
|
@@ -361,6 +391,7 @@ Pasting the following configuration into your Cursor `~/.cursor/mcp.json` file i
|
|
|
361
391
|
"EMBEDDING_PROVIDER": "Ollama",
|
|
362
392
|
"EMBEDDING_MODEL": "nomic-embed-text",
|
|
363
393
|
"OLLAMA_HOST": "http://127.0.0.1:11434",
|
|
394
|
+
"EMBEDDING_DIMENSION": "768",
|
|
364
395
|
"MILVUS_TOKEN": "your-zilliz-cloud-api-key"
|
|
365
396
|
}
|
|
366
397
|
}
|
|
@@ -471,7 +502,7 @@ Cherry Studio allows for visual MCP server configuration through its settings in
|
|
|
471
502
|
- **Name**: `claude-context`
|
|
472
503
|
- **Type**: `STDIO`
|
|
473
504
|
- **Command**: `npx`
|
|
474
|
-
- **Arguments**: `["@zilliz/claude-context-mcp@latest"]`
|
|
505
|
+
- **Arguments**: `["-y", "@zilliz/claude-context-mcp@latest"]`
|
|
475
506
|
- **Environment Variables**:
|
|
476
507
|
- `OPENAI_API_KEY`: `your-openai-api-key`
|
|
477
508
|
- `MILVUS_TOKEN`: `your-zilliz-cloud-api-key`
|
package/dist/config.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export interface ContextMcpConfig {
|
|
|
11
11
|
openrouterApiKey?: string;
|
|
12
12
|
ollamaModel?: string;
|
|
13
13
|
ollamaHost?: string;
|
|
14
|
+
ollamaDimension?: number;
|
|
14
15
|
milvusAddress?: string;
|
|
15
16
|
milvusToken?: string;
|
|
16
17
|
collectionNameOverride?: string;
|
|
@@ -20,7 +21,13 @@ export interface CodebaseSnapshotV1 {
|
|
|
20
21
|
indexingCodebases: string[] | Record<string, number>;
|
|
21
22
|
lastUpdated: string;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
+
export type RequestSplitterType = 'ast' | 'langchain';
|
|
25
|
+
export interface CodebaseIndexOptions {
|
|
26
|
+
requestSplitter?: RequestSplitterType;
|
|
27
|
+
requestCustomExtensions?: string[];
|
|
28
|
+
requestIgnorePatterns?: string[];
|
|
29
|
+
}
|
|
30
|
+
interface CodebaseInfoBase extends CodebaseIndexOptions {
|
|
24
31
|
lastUpdated: string;
|
|
25
32
|
}
|
|
26
33
|
export interface CodebaseInfoIndexing extends CodebaseInfoBase {
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAEhB,iBAAiB,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC;IAC9E,cAAc,EAAE,MAAM,CAAC;IAEvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAEhB,iBAAiB,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC;IAC9E,cAAc,EAAE,MAAM,CAAC;IAEvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CA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,GAAG,kBAAkB,CAAC;AAGvE,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAenE;AAGD,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAiBrE;AAiBD,wBAAgB,eAAe,IAAI,gBAAgB,CAsClD;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CA0CtE;AAED,wBAAgB,eAAe,IAAI,IAAI,CAwEtC"}
|
package/dist/config.js
CHANGED
|
@@ -35,11 +35,24 @@ export function getEmbeddingModelForProvider(provider) {
|
|
|
35
35
|
return selectedModel;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
+
function getPositiveIntegerFromEnv(name) {
|
|
39
|
+
const rawValue = envManager.get(name);
|
|
40
|
+
if (!rawValue) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
const parsedValue = Number(rawValue);
|
|
44
|
+
if (Number.isInteger(parsedValue) && parsedValue > 0) {
|
|
45
|
+
return parsedValue;
|
|
46
|
+
}
|
|
47
|
+
console.warn(`[DEBUG] ⚠️ Ignoring invalid ${name}: ${rawValue}. Expected a positive integer.`);
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
38
50
|
export function createMcpConfig() {
|
|
39
51
|
// Debug: Print all environment variables related to Context
|
|
40
52
|
console.log(`[DEBUG] 🔍 Environment Variables Debug:`);
|
|
41
53
|
console.log(`[DEBUG] EMBEDDING_PROVIDER: ${envManager.get('EMBEDDING_PROVIDER') || 'NOT SET'}`);
|
|
42
54
|
console.log(`[DEBUG] EMBEDDING_MODEL: ${envManager.get('EMBEDDING_MODEL') || 'NOT SET'}`);
|
|
55
|
+
console.log(`[DEBUG] EMBEDDING_DIMENSION: ${envManager.get('EMBEDDING_DIMENSION') || 'NOT SET'}`);
|
|
43
56
|
console.log(`[DEBUG] OLLAMA_MODEL: ${envManager.get('OLLAMA_MODEL') || 'NOT SET'}`);
|
|
44
57
|
console.log(`[DEBUG] GEMINI_API_KEY: ${envManager.get('GEMINI_API_KEY') ? 'SET (length: ' + envManager.get('GEMINI_API_KEY').length + ')' : 'NOT SET'}`);
|
|
45
58
|
console.log(`[DEBUG] OPENAI_API_KEY: ${envManager.get('OPENAI_API_KEY') ? 'SET (length: ' + envManager.get('OPENAI_API_KEY').length + ')' : 'NOT SET'}`);
|
|
@@ -63,6 +76,7 @@ export function createMcpConfig() {
|
|
|
63
76
|
// Ollama configuration
|
|
64
77
|
ollamaModel: envManager.get('OLLAMA_MODEL'),
|
|
65
78
|
ollamaHost: envManager.get('OLLAMA_HOST'),
|
|
79
|
+
ollamaDimension: getPositiveIntegerFromEnv('EMBEDDING_DIMENSION'),
|
|
66
80
|
// Vector database configuration - address can be auto-resolved from token
|
|
67
81
|
milvusAddress: envManager.get('MILVUS_ADDRESS'), // Optional, can be resolved from token
|
|
68
82
|
milvusToken: envManager.get('MILVUS_TOKEN'),
|
|
@@ -104,6 +118,9 @@ export function logConfigurationSummary(config) {
|
|
|
104
118
|
case 'Ollama':
|
|
105
119
|
console.log(`[MCP] Ollama Host: ${config.ollamaHost || 'http://127.0.0.1:11434'}`);
|
|
106
120
|
console.log(`[MCP] Ollama Model: ${config.embeddingModel}`);
|
|
121
|
+
if (config.ollamaDimension) {
|
|
122
|
+
console.log(`[MCP] Ollama Embedding Dimension: ${config.ollamaDimension}`);
|
|
123
|
+
}
|
|
107
124
|
break;
|
|
108
125
|
}
|
|
109
126
|
console.log(`[MCP] 🔧 Initializing server components...`);
|
|
@@ -124,6 +141,7 @@ Environment Variables:
|
|
|
124
141
|
Embedding Provider Configuration:
|
|
125
142
|
EMBEDDING_PROVIDER Embedding provider: OpenAI, VoyageAI, Gemini, Ollama, OpenRouter (default: OpenAI)
|
|
126
143
|
EMBEDDING_MODEL Embedding model name (works for all providers)
|
|
144
|
+
EMBEDDING_DIMENSION Optional embedding dimension override for Ollama
|
|
127
145
|
|
|
128
146
|
Provider-specific API Keys:
|
|
129
147
|
OPENAI_API_KEY OpenAI API key (required for OpenAI provider)
|
|
@@ -147,6 +165,16 @@ Environment Variables:
|
|
|
147
165
|
The per-codebase pathHash is preserved so multiple
|
|
148
166
|
codebases stay distinct under the same override.
|
|
149
167
|
|
|
168
|
+
Sync Trigger Watcher:
|
|
169
|
+
CLAUDE_CONTEXT_TRIGGER_WATCHER
|
|
170
|
+
Enable/disable the ~/.context/.sync-trigger filesystem
|
|
171
|
+
watcher (default: true). When enabled, touching the
|
|
172
|
+
trigger file kicks off an immediate, debounced re-index.
|
|
173
|
+
Triggered syncs share the same global cross-process
|
|
174
|
+
lock as background sync, so multi-instance setups stay
|
|
175
|
+
coordinated. Set to false to disable filesystem
|
|
176
|
+
watching entirely (read-only / sandboxed environments).
|
|
177
|
+
|
|
150
178
|
Examples:
|
|
151
179
|
# Start MCP server with OpenAI (default) and explicit Milvus address
|
|
152
180
|
OPENAI_API_KEY=sk-xxx MILVUS_ADDRESS=localhost:19530 npx @zilliz/claude-context-mcp@latest
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAkFzD,yDAAyD;AACzD,MAAM,UAAU,0BAA0B,CAAC,QAAgB;IACvD,QAAQ,QAAQ,EAAE,CAAC;QACf,KAAK,QAAQ;YACT,OAAO,wBAAwB,CAAC;QACpC,KAAK,UAAU;YACX,OAAO,eAAe,CAAC;QAC3B,KAAK,QAAQ;YACT,OAAO,sBAAsB,CAAC;QAClC,KAAK,YAAY;YACb,OAAO,+BAA+B,CAAC;QAC3C,KAAK,QAAQ;YACT,OAAO,kBAAkB,CAAC;QAC9B;YACI,OAA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H,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,eAAe,GAAG,iBAAiB,GAAG,eAAe,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../src/embedding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,gBAAgB,GAAG,eAAe,GAAG,iBAAiB,GAAG,eAAe,GAAG,eAAe,CA2EzI;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,eAAe,GAAG,iBAAiB,GAAG,eAAe,GAAG,eAAe,GAAG,IAAI,CAsB3J"}
|
package/dist/embedding.js
CHANGED
|
@@ -57,10 +57,11 @@ export function createEmbeddingInstance(config) {
|
|
|
57
57
|
return openrouterEmbedding;
|
|
58
58
|
case 'Ollama':
|
|
59
59
|
const ollamaHost = config.ollamaHost || 'http://127.0.0.1:11434';
|
|
60
|
-
console.log(`[EMBEDDING] 🔧 Configuring Ollama with model: ${config.embeddingModel}, host: ${ollamaHost}`);
|
|
60
|
+
console.log(`[EMBEDDING] 🔧 Configuring Ollama with model: ${config.embeddingModel}, host: ${ollamaHost}${config.ollamaDimension ? `, dimension: ${config.ollamaDimension}` : ''}`);
|
|
61
61
|
const ollamaEmbedding = new OllamaEmbedding({
|
|
62
62
|
model: config.embeddingModel,
|
|
63
|
-
host: ollamaHost
|
|
63
|
+
host: ollamaHost,
|
|
64
|
+
...(config.ollamaDimension && { dimension: config.ollamaDimension })
|
|
64
65
|
});
|
|
65
66
|
console.log(`[EMBEDDING] ✅ Ollama embedding instance created successfully`);
|
|
66
67
|
return ollamaEmbedding;
|
|
@@ -87,7 +88,7 @@ export function logEmbeddingProviderInfo(config, embedding) {
|
|
|
87
88
|
console.log(`[EMBEDDING] OpenRouter configuration - API Key: ${config.openrouterApiKey ? '✅ Provided' : '❌ Missing'}`);
|
|
88
89
|
break;
|
|
89
90
|
case 'Ollama':
|
|
90
|
-
console.log(`[EMBEDDING] Ollama configuration - Host: ${config.ollamaHost || 'http://127.0.0.1:11434'}, Model: ${config.embeddingModel}`);
|
|
91
|
+
console.log(`[EMBEDDING] Ollama configuration - Host: ${config.ollamaHost || 'http://127.0.0.1:11434'}, Model: ${config.embeddingModel}${config.ollamaDimension ? `, Dimension: ${config.ollamaDimension}` : ''}`);
|
|
91
92
|
break;
|
|
92
93
|
}
|
|
93
94
|
}
|
package/dist/embedding.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding.js","sourceRoot":"","sources":["../src/embedding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAGnH,iEAAiE;AACjE,MAAM,UAAU,uBAAuB,CAAC,MAAwB;IAC5D,OAAO,CAAC,GAAG,CAAC,wBAAwB,MAAM,CAAC,iBAAiB,wBAAwB,CAAC,CAAC;IAEtF,QAAQ,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAC/B,KAAK,QAAQ;YACT,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;gBACvB,OAAO,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;gBAC3E,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;YAChF,CAAC;YACD,OAAO,CAAC,GAAG,CAAC,iDAAiD,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;YACtF,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC;gBACxC,MAAM,EAAE,MAAM,CAAC,YAAY;gBAC3B,KAAK,EAAE,MAAM,CAAC,cAAc;gBAC5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UAAU,IAAI,wBAAwB,YAAY,MAAM,CAAC,cAAc,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,gBAAgB,MAAM,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnN,MAAM;IACd,CAAC;AACL,CAAC"}
|
package/dist/handlers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAA8C,MAAM,6BAA6B,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAKhD,qBAAa,YAAY;IACrB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,aAAa,CAA8D;IACnF,OAAO,CAAC,gBAAgB,CAAS;gBAErB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe;IAO9D;;;;;;;OAOG;YACW,oBAAoB;IAuBlC;;;;;;;;OAQG;IACU,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC;IAqFvD;;;;;;;;;;OAUG;YACW,6BAA6B;IA6J9B,mBAAmB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;;YAwM5B,uBAAuB;IA8FxB,gBAAgB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;;IA+M1B,gBAAgB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;;IAwH1B,uBAAuB,CAAC,IAAI,EAAE,GAAG;;;;;;;;;;;;;CAmHjD"}
|
package/dist/handlers.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fs from "fs";
|
|
2
2
|
import * as path from "path";
|
|
3
|
-
import { COLLECTION_LIMIT_MESSAGE } from "@zilliz/claude-context-core";
|
|
3
|
+
import { COLLECTION_LIMIT_MESSAGE, FileSynchronizer } from "@zilliz/claude-context-core";
|
|
4
|
+
import { createRequestSplitter, isRequestSplitterType } from "./splitter.js";
|
|
4
5
|
import { ensureAbsolutePath, truncateContent, trackCodebasePath } from "./utils.js";
|
|
5
6
|
export class ToolHandlers {
|
|
6
7
|
constructor(context, snapshotManager) {
|
|
@@ -245,6 +246,12 @@ export class ToolHandlers {
|
|
|
245
246
|
if (!cloudCodebases.has(localCodebase)) {
|
|
246
247
|
this.snapshotManager.removeCodebaseCompletely(localCodebase);
|
|
247
248
|
hasChanges = true;
|
|
249
|
+
try {
|
|
250
|
+
await FileSynchronizer.deleteSnapshot(localCodebase);
|
|
251
|
+
}
|
|
252
|
+
catch (error) {
|
|
253
|
+
console.warn(`[SYNC-CLOUD] ⚠️ Failed to delete local merkle snapshot for removed codebase '${localCodebase}':`, error?.message || error);
|
|
254
|
+
}
|
|
248
255
|
console.log(`[SYNC-CLOUD] ➖ Removed local codebase (not in cloud): ${localCodebase}`);
|
|
249
256
|
}
|
|
250
257
|
}
|
|
@@ -284,22 +291,28 @@ export class ToolHandlers {
|
|
|
284
291
|
async handleIndexCodebase(args) {
|
|
285
292
|
const { path: codebasePath, force, splitter, customExtensions, ignorePatterns } = args;
|
|
286
293
|
const forceReindex = force || false;
|
|
287
|
-
const
|
|
294
|
+
const requestedSplitter = splitter || 'ast'; // Default to AST
|
|
288
295
|
const customFileExtensions = customExtensions || [];
|
|
289
296
|
const customIgnorePatterns = ignorePatterns || [];
|
|
290
297
|
try {
|
|
291
298
|
// Sync indexed codebases from cloud first
|
|
292
299
|
await this.syncIndexedCodebasesFromCloud();
|
|
293
300
|
// Validate splitter parameter
|
|
294
|
-
if (
|
|
301
|
+
if (!isRequestSplitterType(requestedSplitter)) {
|
|
295
302
|
return {
|
|
296
303
|
content: [{
|
|
297
304
|
type: "text",
|
|
298
|
-
text: `Error: Invalid splitter type '${
|
|
305
|
+
text: `Error: Invalid splitter type '${requestedSplitter}'. Must be 'ast' or 'langchain'.`
|
|
299
306
|
}],
|
|
300
307
|
isError: true
|
|
301
308
|
};
|
|
302
309
|
}
|
|
310
|
+
const splitterType = requestedSplitter;
|
|
311
|
+
const indexOptions = {
|
|
312
|
+
requestSplitter: splitterType,
|
|
313
|
+
requestCustomExtensions: customFileExtensions,
|
|
314
|
+
requestIgnorePatterns: customIgnorePatterns
|
|
315
|
+
};
|
|
303
316
|
// Force absolute path resolution - warn if relative path provided
|
|
304
317
|
const absolutePath = ensureAbsolutePath(codebasePath);
|
|
305
318
|
// Validate path exists
|
|
@@ -411,15 +424,8 @@ export class ToolHandlers {
|
|
|
411
424
|
isError: true
|
|
412
425
|
};
|
|
413
426
|
}
|
|
414
|
-
// Add custom extensions if provided
|
|
415
427
|
if (customFileExtensions.length > 0) {
|
|
416
|
-
console.log(`[CUSTOM-EXTENSIONS]
|
|
417
|
-
this.context.addCustomExtensions(customFileExtensions);
|
|
418
|
-
}
|
|
419
|
-
// Add custom ignore patterns if provided (before loading file-based patterns)
|
|
420
|
-
if (customIgnorePatterns.length > 0) {
|
|
421
|
-
console.log(`[IGNORE-PATTERNS] Adding ${customIgnorePatterns.length} custom ignore patterns: ${customIgnorePatterns.join(', ')}`);
|
|
422
|
-
this.context.addCustomIgnorePatterns(customIgnorePatterns);
|
|
428
|
+
console.log(`[CUSTOM-EXTENSIONS] Using ${customFileExtensions.length} request-scoped custom extensions: ${customFileExtensions.join(', ')}`);
|
|
423
429
|
}
|
|
424
430
|
// Check current status and log if retrying after failure
|
|
425
431
|
const currentStatus = this.snapshotManager.getCodebaseStatus(absolutePath);
|
|
@@ -428,12 +434,12 @@ export class ToolHandlers {
|
|
|
428
434
|
console.log(`[BACKGROUND-INDEX] Retrying indexing for previously failed codebase. Previous error: ${failedInfo?.errorMessage || 'Unknown error'}`);
|
|
429
435
|
}
|
|
430
436
|
// Set to indexing status and save snapshot immediately
|
|
431
|
-
this.snapshotManager.setCodebaseIndexing(absolutePath, 0);
|
|
437
|
+
this.snapshotManager.setCodebaseIndexing(absolutePath, 0, indexOptions);
|
|
432
438
|
this.snapshotManager.saveCodebaseSnapshot();
|
|
433
439
|
// Track the codebase path for syncing
|
|
434
440
|
trackCodebasePath(absolutePath);
|
|
435
441
|
// Start background indexing - now safe to proceed
|
|
436
|
-
this.startBackgroundIndexing(absolutePath, forceReindex, splitterType);
|
|
442
|
+
this.startBackgroundIndexing(absolutePath, forceReindex, splitterType, customIgnorePatterns, customFileExtensions, indexOptions);
|
|
437
443
|
const pathInfo = codebasePath !== absolutePath
|
|
438
444
|
? `\nNote: Input path '${codebasePath}' was resolved to absolute path '${absolutePath}'`
|
|
439
445
|
: '';
|
|
@@ -463,7 +469,7 @@ export class ToolHandlers {
|
|
|
463
469
|
};
|
|
464
470
|
}
|
|
465
471
|
}
|
|
466
|
-
async startBackgroundIndexing(codebasePath, forceReindex, splitterType) {
|
|
472
|
+
async startBackgroundIndexing(codebasePath, forceReindex, splitterType, customIgnorePatterns = [], customFileExtensions = [], indexOptions) {
|
|
467
473
|
const absolutePath = codebasePath;
|
|
468
474
|
let lastSaveTime = 0; // Track last save timestamp
|
|
469
475
|
try {
|
|
@@ -472,33 +478,30 @@ export class ToolHandlers {
|
|
|
472
478
|
if (forceReindex) {
|
|
473
479
|
console.log(`[BACKGROUND-INDEX] ℹ️ Force reindex mode - collection was already cleared during validation`);
|
|
474
480
|
}
|
|
475
|
-
|
|
476
|
-
let contextForThisTask = this.context;
|
|
477
|
-
if (splitterType !== 'ast') {
|
|
478
|
-
console.warn(`[BACKGROUND-INDEX] Non-AST splitter '${splitterType}' requested; falling back to AST splitter`);
|
|
479
|
-
}
|
|
481
|
+
const requestSplitter = createRequestSplitter(splitterType);
|
|
480
482
|
// Load ignore patterns from files first (including .ignore, .gitignore, etc.)
|
|
481
|
-
|
|
483
|
+
// and merge them with this request's custom ignore patterns without
|
|
484
|
+
// relying on shared Context state for this background indexing task.
|
|
485
|
+
const ignorePatterns = await this.context.getEffectiveIgnorePatterns(absolutePath, customIgnorePatterns);
|
|
486
|
+
const supportedExtensions = this.context.getEffectiveSupportedExtensions(customFileExtensions);
|
|
482
487
|
// Initialize file synchronizer with proper ignore patterns (including project-specific patterns)
|
|
483
|
-
const { FileSynchronizer } = await import("@zilliz/claude-context-core");
|
|
484
|
-
const ignorePatterns = this.context.getIgnorePatterns() || [];
|
|
485
488
|
console.log(`[BACKGROUND-INDEX] Using ignore patterns: ${ignorePatterns.join(', ')}`);
|
|
486
|
-
|
|
489
|
+
if (customFileExtensions.length > 0) {
|
|
490
|
+
console.log(`[BACKGROUND-INDEX] Using ${customFileExtensions.length} request-scoped custom extensions: ${customFileExtensions.join(', ')}`);
|
|
491
|
+
}
|
|
492
|
+
const synchronizer = new FileSynchronizer(absolutePath, ignorePatterns, supportedExtensions);
|
|
487
493
|
await synchronizer.initialize();
|
|
488
494
|
// Store synchronizer in the context (let context manage collection names)
|
|
489
495
|
await this.context.getPreparedCollection(absolutePath);
|
|
490
496
|
const collectionName = this.context.getCollectionName(absolutePath);
|
|
491
497
|
this.context.setSynchronizer(collectionName, synchronizer);
|
|
492
|
-
if (contextForThisTask !== this.context) {
|
|
493
|
-
contextForThisTask.setSynchronizer(collectionName, synchronizer);
|
|
494
|
-
}
|
|
495
498
|
console.log(`[BACKGROUND-INDEX] Starting indexing with ${splitterType} splitter for: ${absolutePath}`);
|
|
496
499
|
// Log embedding provider information before indexing
|
|
497
500
|
const embeddingProvider = this.context.getEmbedding();
|
|
498
501
|
console.log(`[BACKGROUND-INDEX] 🧠 Using embedding provider: ${embeddingProvider.getProvider()} with dimension: ${embeddingProvider.getDimension()}`);
|
|
499
502
|
// Start indexing with the appropriate context and progress tracking
|
|
500
503
|
console.log(`[BACKGROUND-INDEX] 🚀 Beginning codebase indexing process...`);
|
|
501
|
-
const stats = await
|
|
504
|
+
const stats = await this.context.indexCodebase(absolutePath, (progress) => {
|
|
502
505
|
// Update progress in snapshot manager using new method
|
|
503
506
|
this.snapshotManager.setCodebaseIndexing(absolutePath, progress.percentage);
|
|
504
507
|
// Save snapshot periodically (every 2 seconds to avoid too frequent saves)
|
|
@@ -509,10 +512,10 @@ export class ToolHandlers {
|
|
|
509
512
|
console.log(`[BACKGROUND-INDEX] 💾 Saved progress snapshot at ${progress.percentage.toFixed(1)}%`);
|
|
510
513
|
}
|
|
511
514
|
console.log(`[BACKGROUND-INDEX] Progress: ${progress.phase} - ${progress.percentage}% (${progress.current}/${progress.total})`);
|
|
512
|
-
});
|
|
515
|
+
}, false, customIgnorePatterns, customFileExtensions, requestSplitter);
|
|
513
516
|
console.log(`[BACKGROUND-INDEX] ✅ Indexing completed successfully! Files: ${stats.indexedFiles}, Chunks: ${stats.totalChunks}`);
|
|
514
517
|
// Set codebase to indexed status with complete statistics
|
|
515
|
-
this.snapshotManager.setCodebaseIndexed(absolutePath, stats);
|
|
518
|
+
this.snapshotManager.setCodebaseIndexed(absolutePath, stats, indexOptions);
|
|
516
519
|
this.indexingStats = { indexedFiles: stats.indexedFiles, totalChunks: stats.totalChunks };
|
|
517
520
|
// Save snapshot after updating codebase lists
|
|
518
521
|
this.snapshotManager.saveCodebaseSnapshot();
|
|
@@ -528,7 +531,7 @@ export class ToolHandlers {
|
|
|
528
531
|
const lastProgress = this.snapshotManager.getIndexingProgress(absolutePath);
|
|
529
532
|
// Set codebase to failed status with error information
|
|
530
533
|
const errorMessage = error.message || String(error);
|
|
531
|
-
this.snapshotManager.setCodebaseIndexFailed(absolutePath, errorMessage, lastProgress);
|
|
534
|
+
this.snapshotManager.setCodebaseIndexFailed(absolutePath, errorMessage, lastProgress, indexOptions);
|
|
532
535
|
this.snapshotManager.saveCodebaseSnapshot();
|
|
533
536
|
// Log error but don't crash MCP service - indexing errors are handled gracefully
|
|
534
537
|
console.error(`[BACKGROUND-INDEX] Indexing failed for ${absolutePath}: ${errorMessage}`);
|
|
@@ -565,8 +568,14 @@ export class ToolHandlers {
|
|
|
565
568
|
}
|
|
566
569
|
trackCodebasePath(absolutePath);
|
|
567
570
|
// Check if this codebase is indexed or being indexed
|
|
568
|
-
const
|
|
569
|
-
const
|
|
571
|
+
const indexedCodebasePath = this.snapshotManager.findIndexedCodebasePath(absolutePath);
|
|
572
|
+
const indexingCodebasePath = this.snapshotManager.findIndexingCodebasePath(absolutePath);
|
|
573
|
+
const matchedCodebase = [indexedCodebasePath, indexingCodebasePath]
|
|
574
|
+
.filter((codebase) => codebase !== undefined)
|
|
575
|
+
.sort((a, b) => b.length - a.length)[0];
|
|
576
|
+
let searchCodebasePath = matchedCodebase || absolutePath;
|
|
577
|
+
let isIndexed = indexedCodebasePath === searchCodebasePath;
|
|
578
|
+
const isIndexing = indexingCodebasePath === searchCodebasePath;
|
|
570
579
|
if (!isIndexed && !isIndexing) {
|
|
571
580
|
// Fallback: check VectorDB directly in case snapshot is out of sync.
|
|
572
581
|
// Only recover the snapshot when we can confirm a real row count —
|
|
@@ -579,6 +588,8 @@ export class ToolHandlers {
|
|
|
579
588
|
console.warn(`[SEARCH] Snapshot missing but VectorDB has index for '${absolutePath}', recovering snapshot (rows=${stats.totalChunks})`);
|
|
580
589
|
this.snapshotManager.setCodebaseIndexed(absolutePath, { ...stats, status: 'completed' });
|
|
581
590
|
this.snapshotManager.saveCodebaseSnapshot();
|
|
591
|
+
searchCodebasePath = absolutePath;
|
|
592
|
+
isIndexed = true;
|
|
582
593
|
// Continue with search (don't return error)
|
|
583
594
|
}
|
|
584
595
|
else {
|
|
@@ -606,7 +617,7 @@ export class ToolHandlers {
|
|
|
606
617
|
if (isIndexing) {
|
|
607
618
|
indexingStatusMessage = `\n⚠️ **Indexing in Progress**: This codebase is currently being indexed in the background. Search results may be incomplete until indexing completes.`;
|
|
608
619
|
}
|
|
609
|
-
console.log(`[SEARCH] Searching in codebase: ${
|
|
620
|
+
console.log(`[SEARCH] Searching in codebase: ${searchCodebasePath}`);
|
|
610
621
|
console.log(`[SEARCH] Query: "${query}"`);
|
|
611
622
|
console.log(`[SEARCH] Indexing status: ${isIndexing ? 'In Progress' : 'Completed'}`);
|
|
612
623
|
// Log embedding provider information before search
|
|
@@ -631,21 +642,24 @@ export class ToolHandlers {
|
|
|
631
642
|
filterExpr = `fileExtension in [${quoted}]`;
|
|
632
643
|
}
|
|
633
644
|
// Search in the specified codebase
|
|
634
|
-
const searchResults = await this.context.semanticSearch(
|
|
645
|
+
const searchResults = await this.context.semanticSearch(searchCodebasePath, query, Math.min(resultLimit, 50), 0.3, filterExpr);
|
|
635
646
|
console.log(`[SEARCH] ✅ Search completed! Found ${searchResults.length} results using ${embeddingProvider.getProvider()} embeddings`);
|
|
636
647
|
if (searchResults.length === 0) {
|
|
637
648
|
// Check if collection was lost (indexed locally but missing in Milvus)
|
|
638
649
|
if (isIndexed && !isIndexing) {
|
|
639
|
-
const collectionName = this.context.getCollectionName(
|
|
650
|
+
const collectionName = this.context.getCollectionName(searchCodebasePath);
|
|
640
651
|
const hasCollection = await this.context.getVectorDatabase().hasCollection(collectionName);
|
|
641
652
|
if (!hasCollection) {
|
|
642
653
|
return {
|
|
643
|
-
content: [{ type: "text", text: `Error: Index data for '${
|
|
654
|
+
content: [{ type: "text", text: `Error: Index data for '${searchCodebasePath}' has been lost (collection not found in Milvus). Please re-index using index_codebase with force=true.` }],
|
|
644
655
|
isError: true
|
|
645
656
|
};
|
|
646
657
|
}
|
|
647
658
|
}
|
|
648
|
-
let noResultsMessage = `No results found for query: "${query}" in codebase '${
|
|
659
|
+
let noResultsMessage = `No results found for query: "${query}" in codebase '${searchCodebasePath}'`;
|
|
660
|
+
if (searchCodebasePath !== absolutePath) {
|
|
661
|
+
noResultsMessage += `\nRequested path '${absolutePath}' is covered by indexed codebase '${searchCodebasePath}'.`;
|
|
662
|
+
}
|
|
649
663
|
if (isIndexing) {
|
|
650
664
|
noResultsMessage += `\n\nNote: This codebase is still being indexed. Try searching again after indexing completes, or the query may not match any indexed content.`;
|
|
651
665
|
}
|
|
@@ -660,13 +674,17 @@ export class ToolHandlers {
|
|
|
660
674
|
const formattedResults = searchResults.map((result, index) => {
|
|
661
675
|
const location = `${result.relativePath}:${result.startLine}-${result.endLine}`;
|
|
662
676
|
const context = truncateContent(result.content, 5000);
|
|
663
|
-
const codebaseInfo = path.basename(
|
|
677
|
+
const codebaseInfo = path.basename(searchCodebasePath);
|
|
664
678
|
return `${index + 1}. Code snippet (${result.language}) [${codebaseInfo}]\n` +
|
|
665
679
|
` Location: ${location}\n` +
|
|
666
680
|
` Rank: ${index + 1}\n` +
|
|
667
681
|
` Context: \n\`\`\`${result.language}\n${context}\n\`\`\`\n`;
|
|
668
682
|
}).join('\n');
|
|
669
|
-
let resultMessage = `Found ${searchResults.length} results for query: "${query}" in codebase '${
|
|
683
|
+
let resultMessage = `Found ${searchResults.length} results for query: "${query}" in codebase '${searchCodebasePath}'${indexingStatusMessage}`;
|
|
684
|
+
if (searchCodebasePath !== absolutePath) {
|
|
685
|
+
resultMessage += `\nRequested path '${absolutePath}' is covered by indexed codebase '${searchCodebasePath}'.`;
|
|
686
|
+
}
|
|
687
|
+
resultMessage += `\n\n${formattedResults}`;
|
|
670
688
|
if (isIndexing) {
|
|
671
689
|
resultMessage += `\n\n💡 **Tip**: This codebase is still being indexed. More results may become available as indexing progresses.`;
|
|
672
690
|
}
|
|
@@ -832,27 +850,28 @@ export class ToolHandlers {
|
|
|
832
850
|
}
|
|
833
851
|
await this.syncIndexedCodebasesFromCloud();
|
|
834
852
|
// Check indexing status using new status system
|
|
835
|
-
const
|
|
836
|
-
const
|
|
853
|
+
const statusCodebasePath = this.snapshotManager.findTrackedCodebasePath(absolutePath) || absolutePath;
|
|
854
|
+
const status = this.snapshotManager.getCodebaseStatus(statusCodebasePath);
|
|
855
|
+
const info = this.snapshotManager.getCodebaseInfo(statusCodebasePath);
|
|
837
856
|
let statusMessage = '';
|
|
838
857
|
switch (status) {
|
|
839
858
|
case 'indexed':
|
|
840
859
|
if (info && 'indexedFiles' in info) {
|
|
841
860
|
const indexedInfo = info;
|
|
842
|
-
statusMessage = `✅ Codebase '${
|
|
861
|
+
statusMessage = `✅ Codebase '${statusCodebasePath}' is fully indexed and ready for search.`;
|
|
843
862
|
statusMessage += `\n📊 Statistics: ${indexedInfo.indexedFiles} files, ${indexedInfo.totalChunks} chunks`;
|
|
844
863
|
statusMessage += `\n📅 Status: ${indexedInfo.indexStatus}`;
|
|
845
864
|
statusMessage += `\n🕐 Last updated: ${new Date(indexedInfo.lastUpdated).toLocaleString()}`;
|
|
846
865
|
}
|
|
847
866
|
else {
|
|
848
|
-
statusMessage = `✅ Codebase '${
|
|
867
|
+
statusMessage = `✅ Codebase '${statusCodebasePath}' is fully indexed and ready for search.`;
|
|
849
868
|
}
|
|
850
869
|
break;
|
|
851
870
|
case 'indexing':
|
|
852
871
|
if (info && 'indexingPercentage' in info) {
|
|
853
872
|
const indexingInfo = info;
|
|
854
873
|
const progressPercentage = indexingInfo.indexingPercentage || 0;
|
|
855
|
-
statusMessage = `🔄 Codebase '${
|
|
874
|
+
statusMessage = `🔄 Codebase '${statusCodebasePath}' is currently being indexed. Progress: ${progressPercentage.toFixed(1)}%`;
|
|
856
875
|
// Add more detailed status based on progress
|
|
857
876
|
if (progressPercentage < 10) {
|
|
858
877
|
statusMessage += ' (Preparing and scanning files...)';
|
|
@@ -863,13 +882,13 @@ export class ToolHandlers {
|
|
|
863
882
|
statusMessage += `\n🕐 Last updated: ${new Date(indexingInfo.lastUpdated).toLocaleString()}`;
|
|
864
883
|
}
|
|
865
884
|
else {
|
|
866
|
-
statusMessage = `🔄 Codebase '${
|
|
885
|
+
statusMessage = `🔄 Codebase '${statusCodebasePath}' is currently being indexed.`;
|
|
867
886
|
}
|
|
868
887
|
break;
|
|
869
888
|
case 'indexfailed':
|
|
870
889
|
if (info && 'errorMessage' in info) {
|
|
871
890
|
const failedInfo = info;
|
|
872
|
-
statusMessage = `❌ Codebase '${
|
|
891
|
+
statusMessage = `❌ Codebase '${statusCodebasePath}' indexing failed.`;
|
|
873
892
|
statusMessage += `\n🚨 Error: ${failedInfo.errorMessage}`;
|
|
874
893
|
if (failedInfo.lastAttemptedPercentage !== undefined) {
|
|
875
894
|
statusMessage += `\n📊 Failed at: ${failedInfo.lastAttemptedPercentage.toFixed(1)}% progress`;
|
|
@@ -878,7 +897,7 @@ export class ToolHandlers {
|
|
|
878
897
|
statusMessage += `\n💡 You can retry indexing by running the index_codebase command again.`;
|
|
879
898
|
}
|
|
880
899
|
else {
|
|
881
|
-
statusMessage = `❌ Codebase '${
|
|
900
|
+
statusMessage = `❌ Codebase '${statusCodebasePath}' indexing failed. You can retry indexing.`;
|
|
882
901
|
}
|
|
883
902
|
break;
|
|
884
903
|
case 'not_found':
|
|
@@ -889,10 +908,13 @@ export class ToolHandlers {
|
|
|
889
908
|
const pathInfo = codebasePath !== absolutePath
|
|
890
909
|
? `\nNote: Input path '${codebasePath}' was resolved to absolute path '${absolutePath}'`
|
|
891
910
|
: '';
|
|
911
|
+
const matchedPathInfo = statusCodebasePath !== absolutePath
|
|
912
|
+
? `\nRequested path '${absolutePath}' is covered by tracked codebase '${statusCodebasePath}'.`
|
|
913
|
+
: '';
|
|
892
914
|
return {
|
|
893
915
|
content: [{
|
|
894
916
|
type: "text",
|
|
895
|
-
text: statusMessage + pathInfo
|
|
917
|
+
text: statusMessage + pathInfo + matchedPathInfo
|
|
896
918
|
}]
|
|
897
919
|
};
|
|
898
920
|
}
|