// =============================================================================
// START SCRIPT
// =============================================================================
// Builds and starts all services with Docker Compose.
// =============================================================================
import { execSync } from 'child_process';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
const __dirname = dirname(fileURLToPath(import.meta.url));
const projectRoot = join(__dirname, '..');
function run(cmd, cwd = projectRoot) {
console.log(`\n> ${cmd}\n`);
execSync(cmd, { stdio: 'inherit', cwd });
}
console.log('๐ Starting MCP-A2A-AP2 services...\n');
// Stop existing containers
const containers = ['registry', 'doordash-agent', 'ubereats-agent', 'grubhub-agent', 'mcp-server', 'stripe-agent', 'user-wallet'];
for (const c of containers) {
try { execSync(`docker stop ${c}`, { stdio: 'ignore' }); } catch {}
try { execSync(`docker rm ${c}`, { stdio: 'ignore' }); } catch {}
}
// Build and start Docker containers (Docker handles npm install and tsc)
run('docker compose -f deploy/docker-compose.yml up --build -d');
console.log('\nโ
All services are running!\n');
console.log('๐ MCP Server: http://localhost:8000/mcp');
console.log('๐ Registry: http://localhost:8004');
console.log('๐ DoorDash Agent: http://localhost:8001 (A2A)');
console.log('๐ UberEats Agent: http://localhost:8002 (A2A)');
console.log('๐ Grubhub Agent: http://localhost:8003 (A2A)');
console.log('๐ Stripe Agent: http://localhost:8005 (AP2 with Mandates)');
console.log('๐ฑ User Wallet: http://localhost:8006 (Signs mandates after Face ID)');
console.log('\nView logs: docker compose -f deploy/docker-compose.yml logs -f\n');