Skip to main content
Glama
test-bank-leumi-only-msp.cjs8.06 kB
const fetch = require('node-fetch'); // Disable SSL verification for local testing process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'; const serverUrl = 'https://localhost:3003'; async function callMCPMethod(method, params, token) { const response = await fetch(`${serverUrl}/mcp`, { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ method, params, jsonrpc: '2.0', id: 1 }) }); return await response.json(); } async function testBankLeumiWithToken(token) { console.log('\n🚀 Testing Bank Leumi Recommendations with MSP OAuth Token\n'); console.log('=' .repeat(70)); console.log('ℹ️ Using OAuth token from AllCloud authentication\n'); // Test 1: Bank Leumi BL Test Env - Open recommendations only console.log('📊 Test 1: Bank Leumi BL Test Env - OPEN recommendations only'); console.log('-'.repeat(70)); const result1 = await callMCPMethod('tools/call', { name: 'get_all_recommendations', arguments: { userQuery: 'show me recommendations for Bank Leumi BL Test Env', daysBack: 30, pageSize: 100, includeClosedAndDone: false // Only open recommendations } }, token); if (result1.result && result1.result.content && result1.result.content[0]) { const content = result1.result.content[0].text; // Extract key information const statusMatch = content.match(/\*\*Status Filter:\*\* ([^\n]+)/); const totalMatch = content.match(/\*\*Total Recommendations:\*\* (\d+)/); const savingsMatch = content.match(/\*\*Total Potential Savings:\*\* \$[\d,]+\.?\d{0,2}/); const customerMatch = content.match(/\*\*Customer:\*\* ([^\n]+)/); console.log('🔍 Results:'); if (customerMatch) console.log(` Customer: ${customerMatch[1]}`); if (statusMatch) console.log(` Status Filter: ${statusMatch[1]}`); if (totalMatch) console.log(` Total Recommendations: ${totalMatch[1]}`); if (savingsMatch) console.log(` ${savingsMatch[0].replace(/\*\*/g, '')}`); // Show first few recommendations with details const recsMatch = content.match(/## Top \d+ Recommendations by Savings:[\s\S]*?(?=##|$)/); if (recsMatch) { console.log('\n First 5 recommendations:'); const recs = recsMatch[0].split(/\d+\.\s+\*\*/).slice(1, 6); recs.forEach((rec, i) => { const lines = rec.split('\n').filter(l => l.trim()); if (lines[0]) { const title = lines[0].replace(/\*\*/g, '').trim(); console.log(` ${i + 1}. ${title.substring(0, 80)}`); // Extract savings for this recommendation const savingsLine = lines.find(l => l.includes('Annual Savings:')); if (savingsLine) { console.log(` ${savingsLine.trim()}`); } } }); } // Check if this is the problematic 4-recommendation response if (totalMatch && parseInt(totalMatch[1]) === 4) { console.log('\n⚠️ WARNING: Only 4 recommendations found!'); console.log(' This appears to be the incorrect response.'); console.log(' Expected: More recommendations for Bank Leumi BL Test Env'); } } else if (result1.error) { console.log('❌ Error:', result1.error.message || result1.error); } // Test 2: Include closed and done recommendations console.log('\n\n📊 Test 2: Bank Leumi BL Test Env - INCLUDING closed/done'); console.log('-'.repeat(70)); const result2 = await callMCPMethod('tools/call', { name: 'get_all_recommendations', arguments: { userQuery: 'show me recommendations for Bank Leumi BL Test Env', daysBack: 30, pageSize: 100, includeClosedAndDone: true // Include all statuses } }, token); if (result2.result && result2.result.content && result2.result.content[0]) { const content = result2.result.content[0].text; const statusMatch = content.match(/\*\*Status Filter:\*\* ([^\n]+)/); const totalMatch = content.match(/\*\*Total Recommendations:\*\* (\d+)/); const savingsMatch = content.match(/\*\*Total Potential Savings:\*\* \$[\d,]+\.?\d{0,2}/); console.log('🔍 Results:'); if (statusMatch) console.log(` Status Filter: ${statusMatch[1]}`); if (totalMatch) console.log(` Total Recommendations: ${totalMatch[1]}`); if (savingsMatch) console.log(` ${savingsMatch[0].replace(/\*\*/g, '')}`); // Compare counts if (result1.result && result1.result.content && result1.result.content[0]) { const openCount = result1.result.content[0].text.match(/\*\*Total Recommendations:\*\* (\d+)/); if (openCount && totalMatch) { const diff = parseInt(totalMatch[1]) - parseInt(openCount[1]); console.log(` Difference (closed/done): ${diff} recommendations`); } } } else if (result2.error) { console.log('❌ Error:', result2.error.message || result2.error); } // Test 3: Try without userQuery to see default behavior console.log('\n\n📊 Test 3: Default behavior (no userQuery specified)'); console.log('-'.repeat(70)); const result3 = await callMCPMethod('tools/call', { name: 'get_all_recommendations', arguments: { daysBack: 30, pageSize: 100, includeClosedAndDone: false } }, token); if (result3.result && result3.result.content && result3.result.content[0]) { const content = result3.result.content[0].text; const totalMatch = content.match(/\*\*Total Recommendations:\*\* (\d+)/); const savingsMatch = content.match(/\*\*Total Potential Savings:\*\* \$[\d,]+\.?\d{0,2}/); const customerMatch = content.match(/\*\*Customer:\*\* ([^\n]+)/); console.log('🔍 Results:'); if (customerMatch) console.log(` Customer: ${customerMatch[1]}`); if (totalMatch) console.log(` Total Recommendations: ${totalMatch[1]}`); if (savingsMatch) console.log(` ${savingsMatch[0].replace(/\*\*/g, '')}`); } else if (result3.error) { console.log('❌ Error:', result3.error.message || result3.error); } console.log('\n' + '=' .repeat(70)); console.log('✅ Testing completed!'); console.log('\n📝 Summary:'); console.log(' - Test 1: Bank Leumi BL Test Env with open recommendations only'); console.log(' - Test 2: Bank Leumi BL Test Env including closed/done'); console.log(' - Test 3: Default behavior without specific query'); console.log('\n'); } async function main() { try { // Check if bearer token is provided as command line argument const token = process.argv[2]; if (!token) { console.log('❌ Please provide the OAuth Bearer token as an argument'); console.log(' Usage: node test-bank-leumi-only-msp.cjs <BEARER_TOKEN>'); console.log('\n To get a token:'); console.log(' 1. Run the OAuth test script in TestUmbrellaMCP'); console.log(' 2. Login with david+allcloud@umbrellacost.com'); console.log(' 3. Copy the Bearer token from the output'); return; } console.log('🔍 Using provided Bearer token for MSP account (AllCloud)'); await testBankLeumiWithToken(token); } catch (error) { console.error('❌ Error:', error.message); console.error(error.stack); } } main();

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