@sknoble/slvsx-mcp-server 0.1.0 → 0.1.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/mcp-server.js +49 -6
- package/package.json +1 -1
package/mcp-server.js
CHANGED
|
@@ -23,8 +23,38 @@ import { fileURLToPath } from 'url';
|
|
|
23
23
|
const __filename = fileURLToPath(import.meta.url);
|
|
24
24
|
const __dirname = path.dirname(__filename);
|
|
25
25
|
|
|
26
|
-
//
|
|
27
|
-
|
|
26
|
+
// Find slvsx binary - check env var, PATH, then local build
|
|
27
|
+
function findSlvsxBinary() {
|
|
28
|
+
// 1. Check explicit env var
|
|
29
|
+
if (process.env.SLVSX_BINARY) {
|
|
30
|
+
return process.env.SLVSX_BINARY;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 2. Check if slvsx is in PATH
|
|
34
|
+
try {
|
|
35
|
+
const which = execSync('which slvsx 2>/dev/null || where slvsx 2>nul', { encoding: 'utf-8' }).trim();
|
|
36
|
+
if (which) return which.split('\n')[0];
|
|
37
|
+
} catch (e) {
|
|
38
|
+
// Not in PATH
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 3. Check local build
|
|
42
|
+
const localBuild = './target/release/slvsx';
|
|
43
|
+
if (fs.existsSync(localBuild)) {
|
|
44
|
+
return localBuild;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// 4. Check relative to this script (for development)
|
|
48
|
+
const scriptDir = path.dirname(__filename);
|
|
49
|
+
const devBuild = path.join(scriptDir, 'target/release/slvsx');
|
|
50
|
+
if (fs.existsSync(devBuild)) {
|
|
51
|
+
return devBuild;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const SLVSX_BINARY = findSlvsxBinary();
|
|
28
58
|
|
|
29
59
|
// Load documentation embeddings if available
|
|
30
60
|
let docsIndex = null;
|
|
@@ -586,10 +616,23 @@ class SlvsxServer {
|
|
|
586
616
|
}
|
|
587
617
|
|
|
588
618
|
// Check if slvsx binary exists
|
|
589
|
-
if (!fs.existsSync(SLVSX_BINARY)) {
|
|
590
|
-
console.error(
|
|
591
|
-
console.error('
|
|
592
|
-
console.error('
|
|
619
|
+
if (!SLVSX_BINARY || !fs.existsSync(SLVSX_BINARY)) {
|
|
620
|
+
console.error('Error: SLVSX binary not found.');
|
|
621
|
+
console.error('');
|
|
622
|
+
console.error('The MCP server requires the slvsx CLI binary. Install it via one of:');
|
|
623
|
+
console.error('');
|
|
624
|
+
console.error(' Option 1: Install via Homebrew (macOS/Linux)');
|
|
625
|
+
console.error(' brew install sknoble/tap/slvsx');
|
|
626
|
+
console.error('');
|
|
627
|
+
console.error(' Option 2: Build from source');
|
|
628
|
+
console.error(' git clone https://github.com/snoble/slvsx-cli');
|
|
629
|
+
console.error(' cd slvsx-cli && cargo build --release');
|
|
630
|
+
console.error(' export SLVSX_BINARY=$PWD/target/release/slvsx');
|
|
631
|
+
console.error('');
|
|
632
|
+
console.error(' Option 3: Download binary from GitHub releases');
|
|
633
|
+
console.error(' https://github.com/snoble/slvsx-cli/releases');
|
|
634
|
+
console.error('');
|
|
635
|
+
console.error('Then restart the MCP server.');
|
|
593
636
|
process.exit(1);
|
|
594
637
|
}
|
|
595
638
|
|