Skip to main content
Glama
final-rc5-vs-current-test.cjsβ€’6.77 kB
#!/usr/bin/env node // Final comparison test: RC5 vs Current Server with Bank Hapoalim const { spawn } = require('child_process'); const axios = require('axios'); class FinalComparisonTest { constructor() { this.rc5Process = null; this.messageId = 1; this.pendingRequests = new Map(); } async startRC5() { console.log('πŸš€ Starting RC5...'); this.rc5Process = spawn('npx', ['tsx', 'src/index.ts'], { stdio: ['pipe', 'pipe', 'pipe'], cwd: '/tmp/release-candidate' }); this.rc5Process.stdout.on('data', (data) => { const lines = data.toString().split('\n').filter(line => line.trim()); lines.forEach(line => { try { const message = JSON.parse(line); this.handleMessage(message); } catch (e) {} }); }); this.rc5Process.stderr.on('data', (data) => { const output = data.toString(); if (output.includes('Umbrella MCP Server started successfully')) { console.log('βœ… RC5 ready'); } }); await new Promise(resolve => setTimeout(resolve, 3000)); } handleMessage(message) { if (message.id && this.pendingRequests.has(message.id)) { const resolve = this.pendingRequests.get(message.id); this.pendingRequests.delete(message.id); resolve(message); } } async sendRequest(method, params) { const id = this.messageId++; const request = { jsonrpc: '2.0', id, method, params }; return new Promise((resolve, reject) => { this.pendingRequests.set(id, resolve); this.rc5Process.stdin.write(JSON.stringify(request) + '\n'); setTimeout(() => { if (this.pendingRequests.has(id)) { this.pendingRequests.delete(id); reject(new Error('Timeout')); } }, 15000); }); } async authenticateRC5() { console.log('πŸ” Authenticating RC5 with allcloud...'); await this.sendRequest('initialize', { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'final-comparison-test', version: '1.0.0' } }); await this.sendRequest('tools/call', { name: 'authenticate_user', arguments: { username: 'david+allcloud@umbrellacost.com', password: 'B4*zcI7#F7poEC' } }); console.log('βœ… RC5 authenticated'); } async authenticateCurrent() { console.log('πŸ” Authenticating Current Server with allcloud...'); const loginResponse = await axios.post('http://localhost:3000/auth', { username: 'david+allcloud@umbrellacost.com', password: 'B4*zcI7#F7poEC' }); this.currentToken = loginResponse.data.bearerToken; console.log('βœ… Current Server authenticated'); } extractSavingsValue(text) { const patterns = [ /\*\*πŸ’° Total Potential Annual Savings:\*\* \$?([\\d,]+\\.?\\d*)/i, /\*\*πŸ’° Potential Annual Savings:\*\* \$?([\\d,]+\\.?\\d*)/i, /\*\*βœ… Actual Annual Savings:\*\* \$?([\\d,]+\\.?\\d*)/i, ]; for (const pattern of patterns) { const match = text.match(pattern); if (match) { const value = parseFloat(match[1].replace(/,/g, '')); if (value > 0) return value; } } return null; } async testRC5Recommendations() { console.log('\\nπŸ“Š Testing RC5 recommendations with Bank Hapoalim...'); const result = await this.sendRequest('tools/call', { name: 'api___recommendationsNew_heatmap_summary', arguments: { customer_account_key: '16185' } }); if (result.error) { console.log(`❌ RC5 Error: ${result.error.message}`); return null; } const response = result.result?.content?.[0]?.text || ''; const savingsValue = this.extractSavingsValue(response); console.log(`πŸ’° RC5 Bank Hapoalim Savings: $${savingsValue?.toLocaleString() || 'N/A'}`); return savingsValue; } async testCurrentRecommendations() { console.log('\\nπŸ“Š Testing Current Server recommendations with Bank Hapoalim...'); const headers = { 'Authorization': `Bearer ${this.currentToken}`, 'Content-Type': 'application/json' }; const result = await axios.post('http://localhost:3000/mcp', { jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name: 'get_recommendations', arguments: { customer_account_key: '16185' } } }, { headers }); const response = result.data.result?.content?.[0]?.text || ''; const savingsValue = this.extractSavingsValue(response); console.log(`πŸ’° Current Server Bank Hapoalim Savings: $${savingsValue?.toLocaleString() || 'N/A'}`); return savingsValue; } async disconnect() { if (this.rc5Process) { this.rc5Process.kill(); } } } async function runFinalComparison() { const tester = new FinalComparisonTest(); try { console.log('πŸ” FINAL RC5 vs CURRENT SERVER COMPARISON'); console.log('═'.repeat(60)); console.log('Testing Bank Hapoalim recommendations (account key 16185)\\n'); await tester.startRC5(); await tester.authenticateRC5(); await tester.authenticateCurrent(); const rc5Value = await tester.testRC5Recommendations(); const currentValue = await tester.testCurrentRecommendations(); console.log('\\nπŸ“Š FINAL RESULTS:'); console.log('═'.repeat(60)); console.log(`RC5 Savings: $${rc5Value?.toLocaleString() || 'ERROR'}`); console.log(`Current Server: $${currentValue?.toLocaleString() || 'ERROR'}`); if (rc5Value && currentValue) { const difference = Math.abs(rc5Value - currentValue); const percentDiff = (difference / rc5Value * 100).toFixed(1); console.log(`Difference: $${difference.toLocaleString()} (${percentDiff}%)`); if (difference < 100) { console.log('\\nβœ… EXCELLENT: Servers are very close (<$100 difference)'); } else if (difference < 1000) { console.log('\\n🟒 GOOD: Servers are reasonably close (<$1,000 difference)'); } else if (difference < 5000) { console.log('\\n🟑 ACCEPTABLE: Servers have some difference (<$5,000)'); } else { console.log('\\n❌ ISSUE: Servers have significant difference (>$5,000)'); } console.log('\\nπŸŽ‰ SUCCESS: Customer account key switching is working!'); console.log('Both servers now properly access Bank Hapoalim account data.'); } else { console.log('\\n❌ UNABLE TO COMPARE: One or both servers returned no data'); } } catch (error) { console.error('❌ Test failed:', error.message); } finally { await tester.disconnect(); } } runFinalComparison();

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/daviddraiumbrella/invoice-monitoring'

If you have feedback or need assistance with the MCP directory API, please join our Discord server