Skip to main content
Glama
endpoints-debug.cjs3.34 kB
#!/usr/bin/env node // Get the actual endpoint names const { spawn } = require('child_process'); class EndpointsDebugger { constructor() { this.mcpProcess = null; } async getEndpoints() { console.log('🔍 GETTING ACTUAL ENDPOINT NAMES'); console.log('==============================='); try { await this.startServer(); await this.authenticate(); const response = await this.makeCall('help', { topic: 'endpoints' }); if (response.success) { console.log('✅ Available Endpoints:'); if (response.data && response.data.content && response.data.content[0]) { const text = response.data.content[0].text; console.log(text); // Extract tool names const toolMatches = text.match(/### (\w+)/g); if (toolMatches) { console.log('\n📋 Extracted Tool Names:'); toolMatches.forEach(match => { const toolName = match.replace('### ', ''); console.log(` - ${toolName}`); }); } } } else { console.log(`❌ Failed: ${response.error}`); } } catch (error) { console.error('Endpoints debug failed:', error.message); } finally { await this.cleanup(); } } async startServer() { this.mcpProcess = spawn('node', ['dist/index.js'], { stdio: ['pipe', 'pipe', 'pipe'], cwd: __dirname, env: { ...process.env, UMBRELLA_API_BASE_URL: 'https://api.umbrellacost.io/api/v1' } }); await this.wait(3000); } async authenticate() { await this.makeCall('authenticate_user', { username: 'david+allcloud@umbrellacost.com', password: 'B4*zcI7#F7poEC' }); } async makeCall(endpoint, params) { return new Promise((resolve) => { try { const request = { jsonrpc: '2.0', id: Date.now(), method: 'tools/call', params: { name: endpoint, arguments: params } }; const requestString = JSON.stringify(request) + '\n'; this.mcpProcess.stdin.write(requestString); const timeout = setTimeout(() => { resolve({ success: false, error: 'Timeout' }); }, 10000); const responseHandler = (data) => { clearTimeout(timeout); try { const lines = data.toString().split('\n').filter(line => line.trim()); const lastLine = lines[lines.length - 1]; const response = JSON.parse(lastLine); if (response.error) { resolve({ success: false, error: response.error.message }); } else { resolve({ success: true, data: response.result }); } } catch (error) { resolve({ success: false, error: 'Parse error' }); } }; this.mcpProcess.stdout.once('data', responseHandler); } catch (error) { resolve({ success: false, error: error.message }); } }); } wait(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } async cleanup() { if (this.mcpProcess) { this.mcpProcess.kill(); } } } new EndpointsDebugger().getEndpoints();

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