Skip to main content
Glama
final-bank-leumi-test.cjsβ€’7.56 kB
#!/usr/bin/env node /** * Final test for Bank Leumi fix */ const { spawn } = require('child_process'); async function finalBankLeumiTest() { console.log('🏁 FINAL BANK LEUMI TEST\n'); console.log('========================\n'); const mcp = spawn('node', ['dist/index.js'], { env: { ...process.env, USERNAME: 'david+allcloud@umbrellacost.com', PASSWORD: 'B4*zcI7#F7poEC' } }); let requestId = 1; mcp.stdout.on('data', (data) => { const text = data.toString(); const lines = text.split('\n'); for (const line of lines) { if (line.trim() && line.startsWith('{')) { try { const msg = JSON.parse(line); // Handle initialization if (msg.id === 0 && msg.result) { console.log('βœ… Server initialized\n'); // First authenticate setTimeout(() => { const authRequest = { jsonrpc: '2.0', id: requestId++, method: 'tools/call', params: { name: 'authenticate_user', arguments: { username: 'david+allcloud@umbrellacost.com', password: 'B4*zcI7#F7poEC' } } }; console.log('πŸ” Authenticating...\n'); mcp.stdin.write(JSON.stringify(authRequest) + '\n'); }, 500); } // Handle authentication response if (msg.id === 1 && msg.result) { console.log('βœ… Authentication successful\n'); console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'); // Test exactly as Claude Desktop would setTimeout(() => { const request = { jsonrpc: '2.0', id: requestId++, method: 'tools/call', params: { name: 'api___invoices_caui', arguments: { userQuery: 'Bank Leumi Account 1: Production Environment', endDate: '2025-08-31', groupBy: 'none', costType: ['cost', 'discount'], startDate: '2025-06-01', isUnblended: true, periodGranLevel: 'month' } } }; console.log('πŸ“€ REQUEST: Bank Leumi Account 1: Production Environment\n'); console.log('Parameters:', JSON.stringify(request.params.arguments, null, 2), '\n'); mcp.stdin.write(JSON.stringify(request) + '\n'); }, 500); } // Handle cost response if (msg.id === 2 && msg.result) { console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'); console.log('πŸ“Š RESPONSE:\n'); if (msg.result.content && msg.result.content[0]) { const content = msg.result.content[0]; try { const text = content.text || ''; if (text.includes('```json')) { const jsonMatch = text.match(/```json\s*([\s\S]*?)\s*```/); if (jsonMatch) { const jsonData = JSON.parse(jsonMatch[1]); console.log(`Records: ${jsonData.length}`); if (jsonData.length > 0) { const firstRow = jsonData[0]; console.log(`Account ID returned: ${firstRow.account_id}`); // Calculate totals by month const monthly = {}; jsonData.forEach(row => { const month = row.usage_date; monthly[month] = (monthly[month] || 0) + row.total_cost; }); console.log('\nMonthly costs:'); Object.entries(monthly).sort().forEach(([month, cost]) => { console.log(` ${month}: $${cost.toFixed(2)}`); }); const total = Object.values(monthly).reduce((sum, cost) => sum + cost, 0); console.log(` ─────────────`); console.log(` Total: $${total.toFixed(2)}\n`); console.log('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'); console.log('βœ… VERIFICATION:\n'); if (firstRow.account_id === '696314371547') { console.log(' βœ… Correct account ID (696314371547)'); } else { console.log(` ❌ Wrong account ID (${firstRow.account_id} instead of 696314371547)`); } if (total < 1) { console.log(' βœ… Correct costs (~$0.01 for Reseller-1)'); console.log(' βœ… FIX IS WORKING!'); } else if (total > 1000) { console.log(` ❌ Wrong costs ($${total.toFixed(2)} - getting test env data)`); console.log(' ❌ Still getting wrong division data'); } else { console.log(` πŸ€” Unexpected cost range: $${total.toFixed(2)}`); } } } } } catch (e) { console.log('Error parsing response:', e.message); } } console.log('\n🏁 Test complete\n'); setTimeout(() => { mcp.kill(); process.exit(0); }, 1000); } } catch (e) { // Not JSON } } } }); mcp.stderr.on('data', (data) => { const text = data.toString(); const lines = text.split('\n'); for (const line of lines) { // Show key debug info if (line.includes('Using accountKey') && line.includes('divisionId')) { console.log(`πŸ” ${line.trim()}`); } else if (line.includes('Built customer API key')) { const match = line.match(/Built customer API key.*:(\d+):(\d+)$/); if (match) { console.log(`πŸ”‘ API Key: ...accountKey:${match[1]}:divisionId:${match[2]}`); } } else if (line.includes('NOT adding as parameter')) { console.log(`⚠️ ${line.split(']')[1].trim()}`); } } }); // Initialize setTimeout(() => { const init = { jsonrpc: '2.0', id: 0, method: 'initialize', params: { protocolVersion: '1.0.0', capabilities: {}, clientInfo: { name: 'final-test', version: '1.0.0' } } }; console.log('Initializing MCP server...\n'); mcp.stdin.write(JSON.stringify(init) + '\n'); }, 1000); // Timeout setTimeout(() => { console.log('\n⏱️ Timeout'); mcp.kill(); process.exit(1); }, 15000); } finalBankLeumiTest().catch(console.error);

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