Skip to main content
Glama
test-customer-params-only.cjs6.17 kB
#!/usr/bin/env node const https = require('https'); const axios = require('axios'); const axiosInstance = axios.create({ httpsAgent: new https.Agent({ rejectUnauthorized: false }), timeout: 30000 }); async function testCustomerParamsOnly() { console.log('\n════════════════════════════════════════════════════════════'); console.log(' TESTING WITH ONLY CUSTOMER PARAMS (NO ACCOUNTID)'); console.log('════════════════════════════════════════════════════════════\n'); const baseUrl = 'https://api.umbrellacost.io/api/v1'; try { // Authenticate as AllCloud user console.log('Authenticating as david+allcloud@umbrellacost.com...'); const authResponse = await axiosInstance.post(`${baseUrl}/users/signin`, { username: 'david+allcloud@umbrellacost.com', password: 'Dsamsung1!123' }); const token = authResponse.data.jwtToken; const tokenPayload = JSON.parse(Buffer.from(token.split('.')[1], 'base64').toString()); const userKey = tokenPayload.username || tokenPayload.sub; console.log('✅ Authenticated. User Key:', userKey); // Build API key for Bank Leumi const apiKey = `${userKey}:22676:139`; console.log('API Key:', apiKey); // Test: Query with ONLY customer params (simulating what MCP does after deleting accountId) console.log('\n📊 TEST: Only customer_account_key and customer_division_id'); console.log('════════════════════════════════════════════════════'); console.log('This simulates what MCP sends after deleting accountId'); const params = new URLSearchParams({ // NO accountId parameter customer_account_key: '22676', customer_division_id: '139', startDate: '2025-08-01', endDate: '2025-08-31', periodGranLevel: 'month', groupBy: 'none', costType: 'cost', isUnblended: 'true' }); params.append('costType', 'discount'); params.append('excludeFilters[chargetype]', 'Tax'); console.log('\nParameters being sent:'); console.log(' accountId: (NOT INCLUDED - deleted by MCP)'); console.log(' customer_account_key: 22676'); console.log(' customer_division_id: 139'); console.log(' groupBy: none'); console.log(' excludeFilters[chargetype]: Tax'); console.log('\nSending request...'); const response = await axiosInstance.get(`${baseUrl}/invoices/caui?${params}`, { headers: { 'Authorization': token, 'apikey': apiKey, 'commonparams': JSON.stringify({ isPpApplied: true }) } }); console.log('\n📋 RESPONSE:'); console.log('════════════════════════════════════════'); if (response.data && response.data.length > 0) { response.data.forEach(item => { console.log(`Month: ${item.usage_date}`); console.log(` Account ID: ${item.account_id}`); console.log(` Total Cost: $${item.total_cost.toFixed(6)}`); console.log(''); }); // Check which account was returned const returnedAccount = response.data[0].account_id; const returnedCost = response.data[0].total_cost; console.log('📝 ANALYSIS:'); console.log('════════════════════════════════════════'); if (returnedAccount === '696314371547') { console.log('✅ Correct account returned (696314371547 - Bank Leumi)'); if (Math.abs(returnedCost - 0.002684) < 0.01) { console.log('✅ Cost is correct (~$0.002684)'); } } else if (returnedAccount === '268413799883') { console.log('❌ WRONG ACCOUNT RETURNED!'); console.log(' Got: 268413799883 (unknown account with high costs)'); console.log(' Expected: 696314371547 (Bank Leumi)'); console.log('\n🔴 THIS IS THE BUG!'); console.log(' When accountId is deleted by MCP, the API returns the wrong account!'); } else { console.log(`⚠️ Unknown account returned: ${returnedAccount}`); } console.log('\n💡 CONCLUSION:'); console.log('════════════════════════════════════════'); if (returnedAccount === '268413799883') { console.log('The issue is confirmed: When MCP deletes accountId and sends only'); console.log('customer_account_key + customer_division_id, the API returns data'); console.log('for account 268413799883 instead of the correct Bank Leumi account.'); console.log('\nPossible solutions:'); console.log('1. Don\'t delete accountId when it\'s provided'); console.log('2. Fix the API to use the correct account when only customer params are sent'); console.log('3. Add accountId based on customer detection'); } } else { console.log('No data returned'); } } catch (error) { console.error('\n❌ Error:', error.message); if (error.response) { console.error('Response:', error.response.data); } } } testCustomerParamsOnly().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