setup.js•1.98 kB
// backend/scripts/setup.js
const inquirer = require('inquirer');
const fs = require('fs');
const path = require('path');
const envFilePath = path.resolve(__dirname, '../.env');
const questions = [
{
type: 'input',
name: 'TELEGRAM_API_TOKEN',
message: `Enter your Telegram API Token:
(How to get it:
1. Open Telegram and search for the user "@BotFather".
2. Send the command "/newbot".
3. Follow the prompts to name your bot.
4. BotFather will give you a unique API token. Paste it here.)
->`
},
{
type: 'input',
name: 'WHATSAPP_SESSION_NAME',
message: 'Enter a unique name for your WhatsApp session file (e.g., my_whatsapp_session):',
default: 'my_whatsapp_session'
},
// Future services can be added here
{
type: 'input',
name: 'BURP_SUITE_API_KEY',
message: `(Optional) Enter your Burp Suite Professional API Key:
(How to get it:
1. In Burp Suite Pro, go to User options > Misc > REST API.
2. Click 'Generate new API key' and copy it here.)
->`
}
];
async function runSetup() {
console.log('--- Universal MCP Server Interactive Setup ---');
console.log('This will help you create your .env configuration file.\n');
try {
const answers = await inquirer.prompt(questions);
let envContent = '# This file was generated by the interactive setup script\n\n';
for (const key in answers) {
if (answers[key]) { // Only add keys that have a value
envContent += `${key}=${answers[key]}\n`;
}
}
fs.writeFileSync(envFilePath, envContent);
console.log('\n✅ Success!');
console.log(`Your configuration has been written to: ${envFilePath}`);
console.log('You can now start the backend server with: npm run dev');
} catch (error) {
console.error('\n❌ An error occurred during setup:', error);
}
}
runSetup();