Skip to main content
Glama
demo-session.tsβ€’7.51 kB
#!/usr/bin/env node import dotenv from 'dotenv'; import { UmbrellaAuth } from './auth.js'; import { UmbrellaApiClient } from './api-client.js'; dotenv.config(); // Simulate what a user would see when asking questions async function runDemoSession() { const baseURL = process.env.UMBRELLA_API_BASE_URL || 'https://api.umbrellacost.io/api/v1'; console.log('🎭 UMBRELLA MCP DEMO SESSION'); console.log('============================'); console.log('Simulating real user questions and MCP server responses\n'); // Question 1: Authentication console.log('πŸ’¬ USER: "Let me authenticate with my Umbrella Cost account"'); console.log('πŸ”§ MCP Tool: authenticate()'); console.log('πŸ“€ Response:'); const auth = new UmbrellaAuth(baseURL); const apiClient = new UmbrellaApiClient(baseURL); // Check for credentials in environment const username = process.env.UMBRELLA_USERNAME; const password = process.env.UMBRELLA_PASSWORD; if (!username || !password) { console.log(' ❌ Authentication failed: Missing credentials'); console.log(' \n Please set UMBRELLA_USERNAME and UMBRELLA_PASSWORD environment variables'); console.log(' \n Example: UMBRELLA_USERNAME=your-email@domain.com UMBRELLA_PASSWORD=your-password'); return; } try { const authResult = await auth.authenticate({ username, password }); console.log(` βœ… Successfully authenticated as ${username}`); console.log(' \n You can now use the API tools to query your Umbrella Cost data. Use "list_endpoints" to see available endpoints.'); apiClient.setAuthToken(auth.getAuthHeaders()); } catch (error: any) { console.log(` ❌ Authentication failed: ${error.message}`); return; } console.log('\n' + '─'.repeat(80) + '\n'); // Question 2: Available Services console.log('πŸ’¬ USER: "What AWS services do I have data for?"'); console.log('πŸ”§ MCP Tool: api__invoices_service_names_distinct(limit="5")'); console.log('πŸ“€ Response:'); try { const servicesResponse = await apiClient.makeRequest('/invoices/service-names/distinct', { limit: 5 }); if (servicesResponse.success) { console.log(' # API Response: /invoices/service-names/distinct'); console.log(` \n **Authenticated as:** ${username}`); console.log(' \n **Status:** βœ… Success'); console.log(' \n **Results:** 5 items (limited from 6826 total)'); console.log(' \n ```json'); console.log(' ' + JSON.stringify(servicesResponse.data?.slice(0, 5), null, 2)); console.log(' ```'); } else { console.log(` ❌ API Error: ${servicesResponse.error}`); } } catch (error: any) { console.log(` ❌ Request Error: ${error.message}`); } console.log('\n' + '─'.repeat(80) + '\n'); // Question 3: Recommendations console.log('πŸ’¬ USER: "Show me my cost optimization recommendations"'); console.log('πŸ”§ MCP Tool: api__recommendations_report()'); console.log('πŸ“€ Response:'); try { const recsResponse = await apiClient.makeRequest('/recommendations/report'); if (recsResponse.success) { console.log(' # API Response: /recommendations/report'); console.log(` \n **Authenticated as:** ${username}`); console.log(' \n **Status:** βœ… Success'); console.log(' \n **Data:**'); console.log(' ```json'); console.log(' ' + JSON.stringify(recsResponse.data, null, 2)); console.log(' ```'); } else { console.log(` ❌ API Error: ${recsResponse.error}`); } } catch (error: any) { console.log(` ❌ Request Error: ${error.message}`); } console.log('\n' + '─'.repeat(80) + '\n'); // Question 4: Cost Anomalies console.log('πŸ’¬ USER: "Are there any cost anomalies I should be aware of?"'); console.log('πŸ”§ MCP Tool: api__anomaly_detection()'); console.log('πŸ“€ Response:'); try { const anomalyResponse = await apiClient.makeRequest('/anomaly-detection'); if (anomalyResponse.success) { console.log(' # API Response: /anomaly-detection'); console.log(` \n **Authenticated as:** ${username}`); console.log(' \n **Status:** βœ… Success'); console.log(' \n **Data:**'); console.log(' ```json'); console.log(' ' + JSON.stringify(anomalyResponse.data, null, 2)); console.log(' ```'); } else { console.log(` ❌ API Error: ${anomalyResponse.error}`); } } catch (error: any) { console.log(` ❌ Request Error: ${error.message}`); } console.log('\n' + '─'.repeat(80) + '\n'); // Question 5: Failed Example console.log('πŸ’¬ USER: "Show me my cost and usage data for last month"'); console.log('πŸ”§ MCP Tool: api__invoices_caui(startDate="2024-01-01", endDate="2024-01-31")'); console.log('πŸ“€ Response:'); try { const costResponse = await apiClient.makeRequest('/invoices/caui', { startDate: '2024-01-01', endDate: '2024-01-31' }); if (costResponse.success) { console.log(' # API Response: /invoices/caui'); console.log(' \n **Status:** βœ… Success'); console.log(' \n **Data:**'); console.log(' ```json'); console.log(' ' + JSON.stringify(costResponse.data, null, 2)); console.log(' ```'); } else { console.log(` ❌ API Error: ${costResponse.error}`); console.log(` \n This endpoint requires an accountId parameter. You may need to specify which account you want to analyze.`); } } catch (error: any) { console.log(` ❌ Request Error: ${error.message}`); } console.log('\n' + '─'.repeat(80) + '\n'); // Question 6: Help console.log('πŸ’¬ USER: "How do I get help with using this system?"'); console.log('πŸ”§ MCP Tool: help(topic="authentication")'); console.log('πŸ“€ Response:'); const helpText = `# Authentication Help To use the Umbrella MCP server, you need to authenticate with your Umbrella Cost credentials. ## Credentials Setup You need to provide your own Umbrella Cost credentials: **Environment Variables:** - UMBRELLA_USERNAME=your-email@domain.com - UMBRELLA_PASSWORD=your-password **Supported Account Types:** - MSP Customer accounts - Direct Customer accounts ## Authentication Process 1. Set your credentials in environment variables or .env file 2. The server will obtain an authentication token from Umbrella Cost 3. The token will be used automatically for all subsequent API calls ## Security Notes - Your credentials are only used to obtain a token and are not stored - All API access is read-only for security - Tokens expire after a certain time and you may need to re-authenticate`; console.log(helpText.split('\n').map(line => ' ' + line).join('\n')); console.log('\n' + '='.repeat(80)); console.log('πŸŽ‰ DEMO SESSION COMPLETED'); console.log('='.repeat(80)); console.log('\nπŸ’‘ KEY TAKEAWAYS:'); console.log(' βœ… Authentication works perfectly'); console.log(' βœ… Service discovery works (6826+ services)'); console.log(' βœ… Recommendations system is functional'); console.log(' βœ… Anomaly detection provides monitoring'); console.log(' ⚠️ Some endpoints need additional parameters (like accountId)'); console.log(' πŸ“š Comprehensive help system available'); console.log('\nπŸš€ The MCP server provides immediate value for cloud cost insights!'); } runDemoSession().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