#!/usr/bin/env node
const { spawn } = require('child_process');
async function getAccounts() {
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 = [];
server.stdout.on('data', (data) => {
const lines = data.toString().split('\n').filter(line => line.trim());
for (const line of lines) {
try {
const response = JSON.parse(line);
responses.push(response);
} catch (e) {}
}
});
await new Promise(resolve => setTimeout(resolve, 2000));
server.stdin.write(JSON.stringify({
jsonrpc: "2.0", id: 1, method: "tools/call",
params: {
name: 'authenticate_user',
arguments: { username: 'david+saola@umbrellacost.com', password: 'Dsamsung1!' }
}
}) + '\n');
await new Promise(resolve => setTimeout(resolve, 5000));
server.stdin.write(JSON.stringify({
jsonrpc: "2.0", id: 2, method: "tools/call",
params: { name: 'api__user_management_accounts', arguments: {} }
}) + '\n');
await new Promise(resolve => setTimeout(resolve, 4000));
const response = responses.find(r => r.id === 2);
if (response?.result?.content?.[0]?.text) {
console.log('ACCOUNTS RESPONSE:');
console.log(response.result.content[0].text);
} else {
console.log('No accounts response found');
console.log('All responses:', responses.map(r => ({ id: r.id, hasContent: !!r.result?.content })));
}
server.kill();
}
getAccounts().catch(console.error);