@simonecoelhosfo/optimizely-mcp-server
Version:
Optimizely MCP Server for AI assistants with integrated CLI tools
52 lines (46 loc) • 1.88 kB
JavaScript
// NPX Fix for Optimizely MCP Server
// Auto-generated by setup-docs command
// Solves Windows NPX spawn issues while maintaining cross-platform compatibility
const { execSync } = require('child_process');
const fs = require('fs');
const args = process.argv.slice(2);
if (args.length === 0) {
console.log('🚀 Optimizely MCP Server - NPX Fix');
console.log('');
console.log('Usage:');
console.log(' node optly-npx-fix.cjs optly setup-docs');
console.log(' node optly-npx-fix.cjs optly health');
console.log(' node optly-npx-fix.cjs optly sync status');
console.log(' node optly-npx-fix.cjs optly analytics templates');
console.log('');
console.log('💡 This fixes Windows NPX spawn issues.');
console.log(' Works on Windows, Linux, and macOS.');
console.log('');
console.log('📦 Package.json integration:');
console.log(' "setup-docs": "node optly-npx-fix.cjs optly setup-docs"');
process.exit(0);
}
if (args[0] === 'optly') {
const optlyPath = './node_modules/@simonecoelhosfo/optimizely-mcp-server/bin/optly';
if (fs.existsSync(optlyPath)) {
try {
const command = `node "${optlyPath}" ${args.slice(1).join(' ')}`;
execSync(command, {
stdio: 'inherit',
timeout: 30000
});
} catch (error) {
console.error('❌ Error executing optly:', error.message);
process.exit(1);
}
} else {
console.error('❌ Optimizely MCP Server not found.');
console.error('📦 Install with: npm install @simonecoelhosfo/optimizely-mcp-server');
process.exit(1);
}
} else {
console.log('💡 This tool currently supports optly commands only.');
console.log(' For other packages, use standard npm/npx commands.');
process.exit(1);
}