@mayurgodhani/ecomtools-cli
Version:
E-commerce tools MCP server for Shopify development
60 lines (51 loc) • 1.73 kB
JavaScript
/**
* ecomTools CLI
* Command line interface for ecomTools
*/
const { program } = require('commander');
const chalk = require('chalk');
const ora = require('ora');
const { startServer } = require('../lib/ecomtools-server');
const packageJson = require('../package.json');
// Configure the CLI program
program
.name('ecomtools')
.description('E-commerce tools MCP server for Shopify development')
.version(packageJson.version);
// Start MCP server command
program
.command('start')
.description('Start the ecomTools MCP server')
.action(() => {
console.log(chalk.bold.blue('⚙️ ecomTools MCP Server'));
console.log(chalk.blue('======================'));
console.log(chalk.dim('Version:'), chalk.green(packageJson.version));
console.log();
const spinner = ora('Starting MCP server...').start();
process.on('exit', () => {
spinner.stop();
});
// Start the server
startServer()
.then(() => {
spinner.succeed('MCP server running');
console.log();
console.log(chalk.green('Server is ready to handle requests'));
console.log();
console.log('You can use this server with compatible AI assistants.');
console.log('To stop the server, press', chalk.bold('Ctrl+C'));
})
.catch(err => {
spinner.fail('Failed to start MCP server');
console.error(chalk.red('Error:'), err.message);
process.exit(1);
});
});
// Define default command to run if no command is specified
if (!process.argv.slice(2).length) {
// If no arguments provided, default to start command
program.help();
}
// Parse command line arguments
program.parse(process.argv);