Skip to main content
Glama
test-mcp-simple.cjs4.78 kB
#!/usr/bin/env node const axios = require('axios'); const https = require('https'); const axiosInstance = axios.create({ httpsAgent: new https.Agent({ rejectUnauthorized: false }), timeout: 30000 }); async function simulateMcpRequest() { console.log('\n════════════════════════════════════════════════════════════'); console.log(' SIMULATING CLAUDE DESKTOP MCP REQUEST'); console.log('════════════════════════════════════════════════════════════\n'); const baseURL = 'https://api.umbrellacost.io/api/v1'; try { // Authenticate directly to Umbrella API console.log('1️⃣ Authenticating with Umbrella API...'); 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 - this is what MCP should build const correctApiKey = `${userKey}:22676:139`; console.log(`✅ Correct API key for Bank Leumi: ${correctApiKey}`); // Test with correct API key console.log('\n2️⃣ Testing with correct Bank Leumi API key...'); const params = new URLSearchParams({ 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'); const response = await axiosInstance.get(`${baseURL}/invoices/caui?${params}`, { headers: { 'Authorization': token, 'apikey': correctApiKey, 'commonparams': JSON.stringify({ isPpApplied: true }) } }); if (response.data && response.data.length > 0) { const item = response.data[0]; console.log('✅ Response with correct API key:'); console.log(` Account: ${item.account_id}`); console.log(` Total cost: $${item.total_cost}`); if (item.account_id === '696314371547') { console.log(' ✅ CORRECT ACCOUNT!'); } } // Now test what MCP is actually doing (wrong) console.log('\n3️⃣ Testing with wrong API key (what MCP uses)...'); const wrongApiKey = `${userKey}:15808:0`; console.log(`❌ Wrong API key that MCP falls back to: ${wrongApiKey}`); const response2 = await axiosInstance.get(`${baseURL}/invoices/caui?${params}`, { headers: { 'Authorization': token, 'apikey': wrongApiKey, 'commonparams': JSON.stringify({ isPpApplied: true }) } }); if (response2.data && response2.data.length > 0) { const item = response2.data[0]; console.log('❌ Response with wrong API key:'); console.log(` Account: ${item.account_id}`); console.log(` Total cost: $${item.total_cost}`); if (item.account_id === '268413799883') { console.log(' ❌ WRONG ACCOUNT (Mark.Watson_Sandbox)!'); } } console.log('\n════════════════════════════════════════════════════════════'); console.log('THE ISSUE: MCP server fails to build customer API key'); console.log('It should use: ' + correctApiKey); console.log('But falls back to: ' + wrongApiKey); console.log('════════════════════════════════════════════════════════════'); } catch (error) { console.error('\n❌ Error:', error.message); if (error.response) { console.error('Response:', error.response.data); } } } simulateMcpRequest().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