Skip to main content
Glama
comprehensive-azure-test.cjsβ€’6.91 kB
#!/usr/bin/env node const { spawn } = require('child_process'); async function comprehensiveAzureTest() { console.log('πŸ§ͺ COMPREHENSIVE AZURE ACCOUNT TEST'); console.log('=' .repeat(80)); console.log('Testing all Azure accounts through MCP protocol'); console.log(''); const server = spawn('node', ['dist/index.js'], { stdio: ['pipe', 'pipe', 'pipe'], env: { ...process.env, UMBRELLA_API_BASE_URL: 'https://api-front.umbrellacost.io/api/v1' } }); const responses = {}; let requestId = 0; server.stdout.on('data', (data) => { console.log('πŸ“€ RAW STDOUT:', data.toString().substring(0, 200) + '...'); const lines = data.toString().split('\n').filter(line => line.trim()); for (const line of lines) { try { const parsed = JSON.parse(line); if (parsed.id) responses[parsed.id] = parsed; } catch (e) {} } }); server.stderr.on('data', (data) => { const msg = data.toString(); if (msg.includes('23105') || msg.includes('AzureAmortized') || msg.includes('AZURE API key')) { console.log('πŸ”§ AZURE LOG:', msg.trim()); } }); await new Promise(resolve => setTimeout(resolve, 2000)); console.log('πŸ” Step 1: Authentication...\n'); server.stdin.write(JSON.stringify({ jsonrpc: "2.0", id: ++requestId, method: "tools/call", params: { name: 'authenticate_user', arguments: { username: 'david+saola@umbrellacost.com', password: 'Dsamsung1!' } } }) + '\n'); await new Promise(resolve => setTimeout(resolve, 8000)); const authResponse = responses[requestId]; if (authResponse && authResponse.result) { console.log('βœ… Authentication successful'); } else { console.log('❌ Authentication failed'); server.kill(); return; } console.log('\nπŸ“Š Step 2: Azure AzureAmortized Test (23105)...\n'); const azureTestId = ++requestId; server.stdin.write(JSON.stringify({ jsonrpc: "2.0", id: azureTestId, method: "tools/call", params: { name: 'api___invoices_caui', arguments: { startDate: '2025-07-01', endDate: '2025-08-26', periodGranLevel: 'day', costType: ['cost', 'discount'], cloud_context: 'azure', groupBy: 'service' } } }) + '\n'); // Wait longer for Azure response await new Promise(resolve => setTimeout(resolve, 15000)); const azureResponse = responses[azureTestId]; console.log('\nπŸ“‹ AZURE TEST RESULTS:'); console.log('=' .repeat(60)); if (!azureResponse) { console.log('❌ CRITICAL: No response received for Azure request'); console.log(' πŸ”§ This indicates a server-side issue'); // Try a simpler request to test if it's a timeout or data issue console.log('\nπŸ” Fallback Test: Trying shorter date range...'); const fallbackTestId = ++requestId; server.stdin.write(JSON.stringify({ jsonrpc: "2.0", id: fallbackTestId, method: "tools/call", params: { name: 'api___invoices_caui', arguments: { startDate: '2025-07-01', endDate: '2025-07-05', periodGranLevel: 'day', costType: ['cost', 'discount'], cloud_context: 'azure', groupBy: 'none' } } }) + '\n'); await new Promise(resolve => setTimeout(resolve, 10000)); const fallbackResponse = responses[fallbackTestId]; if (fallbackResponse) { console.log('βœ… Fallback test worked - issue is with large data set'); } else { console.log('❌ Fallback test also failed - fundamental Azure routing issue'); } } else if (azureResponse.error) { console.log(`❌ CRITICAL: Azure request returned error`); console.log(` Error: ${azureResponse.error.message || azureResponse.error}`); } else if (azureResponse.result?.content?.[0]?.text) { const text = azureResponse.result.content[0].text; console.log('βœ… Azure response received'); const jsonMatch = text.match(/```json\n([\s\S]*?)\n```/); if (jsonMatch) { try { const data = JSON.parse(jsonMatch[1]); if (Array.isArray(data) && data.length > 0) { const accounts = new Set(); const services = new Set(); let totalCost = 0; data.forEach(item => { if (item.account_id) accounts.add(item.account_id); if (item.service_name) services.add(item.service_name); if (item.total_cost) totalCost += parseFloat(item.total_cost); }); console.log(`πŸ“Š SUCCESS: ${data.length} records, $${totalCost.toFixed(2)} total`); console.log(` Accounts: ${Array.from(accounts).join(', ')}`); console.log(` Services: ${Array.from(services).slice(0, 5).join(', ')}`); // Check if we got the expected AzureAmortized account data if (Array.from(accounts).includes('AzureA-7ba44c')) { console.log('βœ… PERFECT: Correct AzureAmortized account data received!'); console.log(' βœ… Cloud context routing is working for Azure'); console.log(' βœ… Account 23105 (AzureAmortized) is properly connected'); } else { console.log(`⚠️ MISMATCH: Expected AzureA-7ba44c, got ${Array.from(accounts).join(', ')}`); } } else { console.log('⚠️ Empty data array - account might not have data for this period'); } } catch (e) { console.log(`❌ JSON parsing error: ${e.message}`); } } else { console.log('⚠️ No JSON found - might be error message'); console.log(`Response preview: ${text.substring(0, 200)}...`); } } else { console.log('❌ Invalid response format'); console.log('Response structure:', JSON.stringify(azureResponse, null, 2)); } server.kill(); console.log('\n🎯 AZURE COMPREHENSIVE TEST VERDICT:'); if (azureResponse && azureResponse.result?.content?.[0]?.text) { const text = azureResponse.result.content[0].text; const hasJson = text.includes('```json'); if (hasJson) { console.log('βœ… AZURE IS WORKING: Account 23105 routing successful'); console.log(' βœ… Priority selection fix worked'); console.log(' βœ… AzureAmortized account properly connected'); } else { console.log('⚠️ AZURE PARTIAL: Routing works but data issue'); console.log(' βœ… Priority selection fix worked'); console.log(' ⚠️ Data retrieval needs investigation'); } } else { console.log('❌ AZURE BROKEN: Fundamental routing issue'); console.log(' ❌ Priority selection may not be working'); console.log(' 🚨 Requires further debugging'); } console.log('\n🏁 Comprehensive Azure test complete!'); } comprehensiveAzureTest().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