Skip to main content
Glama
index.ts1.43 kB
#!/usr/bin/env node import * as dotenv from "dotenv"; import Client from "./Client/index.js"; import { startMcpServer } from "./mcp/index.js"; import { ACTIONS } from "./actions/index.js"; dotenv.config(); // Validate required environment variables function validateEnvironment() { const requiredEnvVars = {}; const missingVars = Object.entries(requiredEnvVars) .filter(([_, value]) => !value) .map(([key]) => key); if (missingVars.length > 0) { throw new Error(`Missing required environment variables: ${missingVars.join(', ')}`); } } async function main() { try { // Validate environment before proceeding validateEnvironment(); // Initialize the agent with error handling const agent = Client.createClient({}); const mcpActions = ACTIONS; // Start the MCP server with error handling await startMcpServer(mcpActions, agent, { name: "quick-chart-agent", version: "0.0.1" }); } catch (error) { console.error('Failed to start MCP server:', error instanceof Error ? error.message : String(error)); process.exit(1); } } // Handle uncaught exceptions and rejections process.on('uncaughtException', (error) => { console.error('Uncaught Exception:', error); process.exit(1); }); process.on('unhandledRejection', (reason, promise) => { console.error('Unhandled Rejection at:', promise, 'reason:', reason); process.exit(1); }); main();

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/datafe/quick-chart-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server