Skip to main content
Glama
index-dual-transport.ts2.65 kB
#!/usr/bin/env node import dotenv from 'dotenv'; import { UmbrellaMcpServer } from './server.js'; import { HttpsTransport } from './https-transport.js'; import { OAuthSessionManager } from './oauth-session-manager.js'; // Load environment variables dotenv.config(); async function main() { const baseURL = process.env.UMBRELLA_API_BASE_URL || 'https://api.umbrellacost.io/api/v1'; const transport = process.env.MCP_TRANSPORT || 'stdio'; // 'stdio', 'https', or 'both' try { // Always create the MCP server const server = new UmbrellaMcpServer(baseURL); if (transport === 'stdio' || transport === 'both') { // Run stdio transport (existing functionality) console.error('[MAIN] Starting MCP server with stdio transport...'); if (transport === 'stdio') { // Run only stdio await server.run(); } else { // Run stdio in background for 'both' mode server.run().catch(error => { console.error('[MAIN] Stdio transport error:', error); }); } } if (transport === 'https' || transport === 'both') { // Run HTTPS transport console.error('[MAIN] Starting MCP server with HTTPS transport...'); const sessionManager = new OAuthSessionManager(); const httpsTransport = new HttpsTransport(server.getServer(), sessionManager); // Enhance server with HTTPS context handling // Note: setHttpsTransport method not available in current server implementation // server.setHttpsTransport(httpsTransport, sessionManager); await httpsTransport.start(); console.error('[MAIN] MCP server running with HTTPS transport'); console.error(`[MAIN] Authentication URL: https://${process.env.MCP_HOST || '127.0.0.1'}:${process.env.MCP_HTTPS_PORT || '8443'}/oauth/authorize`); } if (transport === 'both') { console.error('[MAIN] MCP server running with both stdio and HTTPS transports'); } } catch (error) { console.error('Failed to start Umbrella MCP Server:', error); process.exit(1); } } // Handle process termination gracefully process.on('SIGINT', () => { console.error('\n👋 Umbrella MCP Server shutting down...'); process.exit(0); }); process.on('SIGTERM', () => { console.error('\n👋 Umbrella MCP Server shutting down...'); process.exit(0); }); // Prevent process from exiting immediately when running HTTPS if (process.env.MCP_TRANSPORT === 'https' || process.env.MCP_TRANSPORT === 'both') { process.stdin.resume(); } main().catch((error) => { console.error('Unhandled error:', error); process.exit(1); });

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