Skip to main content
Glama
test-allcloud-performance.cjs7.28 kB
#!/usr/bin/env node const https = require('https'); console.log('=== Testing AllCloud Account Performance Issue ===\n'); // Configuration from AllCloud const authToken = 'eyJraWQiOiJoUFBoZTFRaWM4TklLU1dHcjQ4NEFHK3UwU2c5bCtmUHFWRWZUeCtcL0FcL1k9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5NTk0YTI4YS01OGQ4LTRlZGYtYjk1MC1lMzc5NzMxYTM1YTEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1bWJyZWxsYS11c2VyLTEiXSwiZW1haWxfdmVyaWZpZWQiOnRydWUsImNvZ25pdG86cHJlZmVycmVkX3JvbGUiOiJhcm46YXdzOmlhbTo6NTg5MDk2Nzk2MjE0OnJvbGVcL1VtYnJlbGxhVXNlcjJfMTc5NTcxNjg5MzM3NSIsImlzcyI6Imh0dHBzOlwvXC9jb2duaXRvLWlkcC51cy1lYXN0LTEuYW1hem9uYXdzLmNvbVwvdXMtZWFzdC0xX1V2NkFyTmRTSyIsImNvZ25pdG86dXNlcm5hbWUiOiI5NTk0YTI4YS01OGQ4LTRlZGYtYjk1MC1lMzc5NzMxYTM1YTEiLCJvcmlnaW5fanRpIjoiY2VmYWIzZDctYjhjZi00ZjhmLWE3ZmItZmM0YmVhNGQzYTU0IiwiY29nbml0bzpyb2xlcyI6WyJhcm46YXdzOmlhbTo6NTg5MDk2Nzk2MjE0OnJvbGVcL1VtYnJlbGxhVXNlcjJfMTc5NTcxNjg5MzM3NSJdLCJhdWQiOiI3aTgyY25wdDQ2OXJjZDkzZmlmMWdsaG5rbSIsImV2ZW50X2lkIjoiOTEzMDU4MWYtN2Y0Yi00MTA1LWJkMGItMzhlOGNkMmJmODg5IiwidG9rZW5fdXNlIjoiaWQiLCJhdXRoX3RpbWUiOjE3NTkwNzM1MzIsImV4cCI6MTc1OTE1OTkzMiwiaWF0IjoxNzU5MDczNTMyLCJqdGkiOiIzOTZjOGUzNS1mNTk4LTQzNTMtOTc1OS0wNGFmOTgzN2U0OWUiLCJlbWFpbCI6ImRhdmlkK2FsbGNsb3VkQHVtYnJlbGxhY29zdC5jb20ifQ.CrvK3hJaX1OQOGvLGz8JBPdkxFRxCf1GKDBnSb1fOz3k-LfA8t0SJHxdxXxBkkDQYTazRjeJD1lmuJUfUz84wKNQyJJlsxdaOvWQS_8rZCG0X10i00qkSaRGQV1xgdE4H5_Nrg6fGsayy6m-Ml5qFQP4pzUjrP7EcyJqCsn63kfcb-VRCRk5jE9Gb_wD-WJyfYeQnGhCKGzDlFQrj6P-ZP5hKo9wpQNFKzCTmxSU-4vIBCFdJl7SRoZRxXbQJNHfx6YrVaGDEbJcSWaUrA7OJxmGvN1XJJ8HsY6yRJqpBq6RQXB2uCEUW34vW_s-JQaWLlxRfKMBY0Ixs-3B3mvQsQ'; async function testPlainSubUsers() { return new Promise((resolve) => { const startTime = Date.now(); console.log('Testing: /users/plain-sub-users'); https.get('https://api.umbrellacost.io/api/v1/users/plain-sub-users', { headers: { 'Authorization': authToken, 'apikey': '9594a28a-58d8-4edf-b950-e379731a35a1:15832:0', 'Accept': 'application/json' } }, (res) => { let data = ''; let dataLength = 0; res.on('data', chunk => { data += chunk; dataLength += chunk.length; // Progress indicator for large responses if (dataLength % 100000 === 0) { process.stdout.write('.'); } }); res.on('end', () => { const responseTime = Date.now() - startTime; console.log(''); try { const json = JSON.parse(data); const accountCount = json.accounts?.length || 0; const customerCount = json.customerDivisions ? Object.keys(json.customerDivisions).length : 0; console.log(`Status: ${res.statusCode}`); console.log(`Response Time: ${responseTime}ms`); console.log(`Response Size: ${(dataLength / 1024).toFixed(2)} KB`); console.log(`Accounts: ${accountCount}`); console.log(`Customer Divisions: ${customerCount}`); console.log(`User Type: ${json.user_type} (${json.user_type === 11 ? 'MSP' : 'Direct'})`); if (accountCount > 100) { console.log(`⚠️ Large account list detected: ${accountCount} accounts`); } // Show first 5 accounts if (json.accounts?.length > 0) { console.log('\nFirst 5 accounts:'); json.accounts.slice(0, 5).forEach((acc, i) => { console.log(` ${i + 1}. ${acc.accountName || acc.accountId} (${acc.accountKey})`); }); } resolve({ responseTime, accountCount, success: true }); } catch (e) { console.log(`Error parsing: ${e.message}`); resolve({ responseTime, success: false, error: e.message }); } }); }).on('error', (e) => { const responseTime = Date.now() - startTime; console.log(`Request error after ${responseTime}ms: ${e.message}`); resolve({ responseTime, success: false, error: e.message }); }); }); } async function testCAUIQuery() { return new Promise((resolve) => { const startTime = Date.now(); console.log('\nTesting: CAUI API with Bank Hapoalim account'); const url = 'https://api.umbrellacost.io/api/v1/invoices/caui?startDate=2025-01-01&endDate=2025-09-30&groupBy=none&periodGranLevel=month&costType=cost'; https.get(url, { headers: { 'Authorization': authToken, 'apikey': '9594a28a-58d8-4edf-b950-e379731a35a1:16185:10', // Bank Hapoalim 'Accept': 'application/json' } }, (res) => { let data = ''; res.on('data', chunk => data += chunk); res.on('end', () => { const responseTime = Date.now() - startTime; try { const json = JSON.parse(data); const hasData = Array.isArray(json) && json.length > 0; console.log(`Status: ${res.statusCode}`); console.log(`Response Time: ${responseTime}ms`); console.log(`Has Data: ${hasData ? '✅ YES' : '❌ NO'}`); if (hasData) { console.log(`Records: ${json.length}`); console.log(`First record date: ${json[0]?.date}`); } resolve({ responseTime, hasData, success: true }); } catch (e) { console.log(`Error parsing: ${e.message}`); resolve({ responseTime, success: false, error: e.message }); } }); }).on('error', (e) => { const responseTime = Date.now() - startTime; console.log(`Request error after ${responseTime}ms: ${e.message}`); resolve({ responseTime, success: false, error: e.message }); }); }); } async function simulateMCPWorkflow() { console.log('\n=== Simulating MCP Workflow ===\n'); // Step 1: Load plain-sub-users const step1 = await testPlainSubUsers(); if (!step1.success) { console.log('❌ Failed at Step 1: Could not load plain-sub-users'); return; } if (step1.responseTime > 30000) { console.log(`⚠️ Warning: plain-sub-users took ${step1.responseTime}ms (> 30s)`); console.log('This might cause timeouts in Claude Desktop MCP connection'); } // Step 2: Query CAUI API const step2 = await testCAUIQuery(); if (!step2.success) { console.log('❌ Failed at Step 2: Could not query CAUI API'); return; } // Summary console.log('\n=== SUMMARY ==='); console.log(`Total workflow time: ${step1.responseTime + step2.responseTime}ms`); if (step1.responseTime + step2.responseTime > 60000) { console.log('❌ Total time exceeds 60s - likely to timeout in MCP'); console.log('\nRecommendations:'); console.log('1. Implement caching for plain-sub-users (already loaded accounts)'); console.log('2. Increase timeout in MCP client connection'); console.log('3. Consider lazy-loading accounts or pagination'); } else if (step1.accountCount > 200) { console.log('⚠️ Large account list might cause performance issues'); console.log('\nRecommendations:'); console.log('1. Cache the plain-sub-users response for 10+ minutes'); console.log('2. Consider account search/filter instead of loading all'); } else { console.log('✅ Performance looks acceptable'); } } // Run the tests simulateMCPWorkflow();

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