quick-start.jsβ’3.55 kB
#!/usr/bin/env node
/**
* Quick Start Script for AI MCP Gateway
* Helps users get started with minimal configuration
*/
import { writeFileSync, existsSync } from 'fs';
import { join } from 'path';
console.log('π AI MCP Gateway - Quick Start Setup\n');
// Check if .env exists
const envPath = join(process.cwd(), '.env');
if (!existsSync(envPath)) {
console.log('π Creating .env file...');
const envContent = `# AI MCP Gateway Configuration
# Generated by quick-start.js
# ==========================================
# REQUIRED: Add at least one API key below
# ==========================================
# Option 1: OpenRouter (recommended for cost optimization)
OPENROUTER_API_KEY=
# Option 2: Anthropic Claude
ANTHROPIC_API_KEY=
# Option 3: OpenAI
OPENAI_API_KEY=
# ==========================================
# OPTIONAL: External Services
# ==========================================
# Redis (optional - enables caching)
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=0
# PostgreSQL (optional - enables persistence)
DATABASE_URL=
DB_HOST=localhost
DB_PORT=5432
DB_NAME=ai_mcp_gateway
DB_USER=postgres
DB_PASSWORD=
DB_SSL=false
# ==========================================
# HTTP API Configuration
# ==========================================
# Set MODE=api to run as HTTP server instead of MCP
MODE=mcp
API_PORT=3000
API_HOST=0.0.0.0
API_CORS_ORIGIN=*
# ==========================================
# Routing & Cost Configuration
# ==========================================
DEFAULT_LAYER=L0
ENABLE_CROSS_CHECK=true
ENABLE_AUTO_ESCALATE=true
MAX_ESCALATION_LAYER=L2
ENABLE_COST_TRACKING=true
COST_ALERT_THRESHOLD=1.00
# ==========================================
# Logging
# ==========================================
LOG_LEVEL=info
LOG_FILE=logs/ai-mcp-gateway.log
`;
writeFileSync(envPath, envContent);
console.log('β
Created .env file\n');
console.log('β οΈ IMPORTANT: Edit .env and add your API keys:');
console.log(' - OPENROUTER_API_KEY (recommended)');
console.log(' - or ANTHROPIC_API_KEY');
console.log(' - or OPENAI_API_KEY\n');
} else {
console.log('β
.env file already exists\n');
}
// Print next steps
console.log('π Next Steps:\n');
console.log('1. Edit .env and add your API key(s)');
console.log('2. Build the project:');
console.log(' npm run build');
console.log('');
console.log('3. Choose your mode:');
console.log('');
console.log(' π₯οΈ MCP Mode (for Claude Desktop, VS Code):');
console.log(' npm start');
console.log('');
console.log(' π HTTP API Mode (for web services):');
console.log(' npm run start:api');
console.log('');
console.log('4. Optional Services:');
console.log('');
console.log(' π¦ Redis (for caching):');
console.log(' docker run -d -p 6379:6379 redis:alpine');
console.log('');
console.log(' ποΈ PostgreSQL (for persistence):');
console.log(' docker run -d -p 5432:5432 \\');
console.log(' -e POSTGRES_DB=ai_mcp_gateway \\');
console.log(' -e POSTGRES_PASSWORD=password \\');
console.log(' postgres:16-alpine');
console.log('');
console.log('π Documentation:');
console.log(' - README.md - Getting started guide');
console.log(' - ARCHITECTURE.md - System design');
console.log(' - IMPROVEMENTS.md - New features summary');
console.log('');
console.log('π‘ Tip: The gateway works without Redis/DB, but they enhance');
console.log(' performance and enable conversation persistence!');
console.log('');
console.log('π Happy coding with AI MCP Gateway!');