vestige/packages/vestige-mcp-npm/bin/vestige-mcp.js

32 lines
821 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
const { spawn } = require('child_process');
const path = require('path');
const fs = require('fs');
const os = require('os');
const platform = os.platform();
const binaryName = platform === 'win32' ? 'vestige-mcp.exe' : 'vestige-mcp';
const binaryPath = path.join(__dirname, binaryName);
if (!fs.existsSync(binaryPath)) {
console.error('Error: vestige-mcp binary not found.');
console.error(`Expected at: ${binaryPath}`);
console.error('');
console.error('Try reinstalling: npm install -g vestige-mcp-server');
process.exit(1);
}
const child = spawn(binaryPath, process.argv.slice(2), {
stdio: 'inherit',
});
child.on('error', (err) => {
console.error('Failed to start vestige-mcp:', err.message);
process.exit(1);
});
child.on('exit', (code) => {
process.exit(code ?? 0);
});