#!/usr/bin/env node
// Compare AWS monthly costs: RC5 vs Current Server
const axios = require('axios');
async function compareAWSMonthlyCosts() {
console.log('🔍 AWS MONTHLY COSTS COMPARISON: RC5 vs CURRENT SERVER');
console.log('═'.repeat(70));
// Current Server Test
console.log('\n🖥️ CURRENT SERVER (OAuth 2.0):');
console.log('─'.repeat(50));
try {
// Login to current server
const loginResponse = await axios.post('http://localhost:3000/auth', {
username: 'david+saola@umbrellacost.com',
password: 'Dsamsung1!'
});
if (!loginResponse.data.success) {
console.log('❌ Current server login failed');
return;
}
const token = loginResponse.data.bearerToken;
const headers = {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json'
};
// Get AWS monthly costs from current server
const currentResult = await axios.post('http://localhost:3000/mcp', {
jsonrpc: '2.0',
id: 1,
method: 'tools/call',
params: {
name: 'get_costs',
arguments: {
startDate: '2025-01-01',
endDate: '2025-08-31',
cloud_context: 'aws'
}
}
}, { headers });
const currentResponse = currentResult.data.result?.content?.[0]?.text || '';
// Extract JSON from current server response
const currentJsonMatch = currentResponse.match(/\[([\s\S]*?)\]/);
let currentMonthlyData = [];
if (currentJsonMatch) {
try {
const currentData = JSON.parse(currentJsonMatch[0]);
currentMonthlyData = currentData;
console.log('💰 CURRENT SERVER AWS MONTHLY COSTS:');
const monthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug'];
let currentTotal = 0;
currentData.forEach((item, idx) => {
const cost = parseFloat(item.total_cost || 0);
const month = monthNames[idx] || `M${idx+1}`;
currentTotal += cost;
console.log(` ${month} 2025: $${cost.toLocaleString()}`);
});
console.log(` TOTAL: $${currentTotal.toLocaleString()}`);
} catch (e) {
console.log('❌ Failed to parse current server JSON');
}
}
} catch (error) {
console.log(`❌ Current server test failed: ${error.message}`);
}
// RC5 Baseline (from previous test)
console.log('\n🏆 RC5 BASELINE (Known Good):');
console.log('─'.repeat(50));
const rc5MonthlyData = [
{ month: 'Jan 2025', cost: 120021.977 },
{ month: 'Feb 2025', cost: 112626.603 },
{ month: 'Mar 2025', cost: 104755.074 },
{ month: 'Apr 2025', cost: 111340.424 },
{ month: 'May 2025', cost: 149774.238 },
{ month: 'Jun 2025', cost: 165666.570 },
{ month: 'Jul 2025', cost: 183920.578 },
{ month: 'Aug 2025', cost: 162635.363 }
];
console.log('💰 RC5 AWS MONTHLY COSTS:');
let rc5Total = 0;
rc5MonthlyData.forEach(item => {
rc5Total += item.cost;
console.log(` ${item.month}: $${item.cost.toLocaleString()}`);
});
console.log(` TOTAL: $${rc5Total.toLocaleString()}`);
console.log('\n📊 COMPARISON SUMMARY:');
console.log('═'.repeat(70));
console.log(`🏆 RC5 Total AWS (Jan-Aug 2025): $${rc5Total.toLocaleString()}`);
console.log(`🖥️ Current Server AWS (Jan-Aug 2025): [Check above]`);
console.log('\n✅ If numbers match exactly, current server = RC5 baseline');
console.log('❌ If numbers differ, current server needs more fixes');
}
compareAWSMonthlyCosts();