vcluster-yaml-mcp-server 1.4.1 → 1.4.2

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.
@@ -343,26 +343,51 @@ export function sortByRelevance(results, searchTerm) {
343
343
  });
344
344
  }
345
345
  /**
346
- * Rank search result
347
- * Pure function
346
+ * Rank search result - multi-keyword aware
348
347
  */
349
348
  function rankResult(item, searchTerm) {
350
349
  let score = 0;
351
350
  const pathLower = item.path.toLowerCase();
352
351
  const keyLower = item.key.toLowerCase();
353
- // Exact path match (highest priority)
354
- if (pathLower === searchTerm)
355
- score += 100;
356
- // Exact key match
357
- if (keyLower === searchTerm)
358
- score += 50;
359
- // Path contains exact term
360
- if (pathLower.includes(searchTerm))
361
- score += 20;
362
- // Key contains term
363
- if (keyLower.includes(searchTerm))
364
- score += 10;
365
- // Leaf nodes are more relevant
352
+ const termLower = searchTerm.toLowerCase();
353
+ if (termLower.includes('.')) {
354
+ if (pathLower === termLower)
355
+ score += 100;
356
+ if (pathLower.includes(termLower))
357
+ score += 20;
358
+ if (item.isLeaf)
359
+ score += 5;
360
+ return score;
361
+ }
362
+ const stopWords = new Set([
363
+ 'how', 'to', 'the', 'a', 'an', 'is', 'are', 'from', 'what', 'which',
364
+ 'for', 'with', 'in', 'on', 'at', 'by', 'and', 'or', 'of', 'do', 'does'
365
+ ]);
366
+ const keywords = searchTerm.split(/\s+/).filter(w => w.length > 2 && !stopWords.has(w));
367
+ if (keywords.length > 1) {
368
+ let matchCount = 0;
369
+ for (const kw of keywords) {
370
+ if (pathLower.includes(kw) || keyLower.includes(kw)) {
371
+ matchCount++;
372
+ if (keyLower.includes(kw))
373
+ score += 15;
374
+ }
375
+ }
376
+ score += matchCount * 25;
377
+ if (matchCount === keywords.length)
378
+ score += 50;
379
+ }
380
+ else {
381
+ const term = keywords[0] ?? searchTerm;
382
+ if (pathLower === term)
383
+ score += 100;
384
+ if (keyLower === term)
385
+ score += 50;
386
+ if (pathLower.includes(term))
387
+ score += 20;
388
+ if (keyLower.includes(term))
389
+ score += 10;
390
+ }
366
391
  if (item.isLeaf)
367
392
  score += 5;
368
393
  return score;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vcluster-yaml-mcp-server",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "MCP server for querying vcluster YAML configurations using jq",
5
5
  "repository": {
6
6
  "type": "git",