Skip to main content
Glama
index.ts1.93 kB
import { config } from 'dotenv'; import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio'; import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp'; import { AppSignalMcpServer } from './mcp/index'; // Load environment variables config(); // Get API credentials from environment variables const apiToken = process.env.APPSIGNAL_API_TOKEN; const appId = process.env.APPSIGNAL_APP_ID; if (!apiToken || !appId) { console.error('Error: APPSIGNAL_API_TOKEN and APPSIGNAL_APP_ID environment variables are required'); process.exit(1); } // Create the MCP server const server = new AppSignalMcpServer(apiToken, appId); // Determine transport type based on command line arguments const transportType = process.argv[2] || 'stdio'; async function main() { try { if (transportType === 'http') { // Start HTTP server const port = parseInt(process.env.PORT || '3000', 10); // This is a simplified example - in a real application, you would // integrate this with Express or another HTTP server framework console.log(`Starting HTTP server on port ${port}...`); // For demonstration purposes only - this won't actually start an HTTP server console.log('HTTP transport not fully implemented in this example'); // In a real implementation, you would do something like: // const transport = new StreamableHTTPServerTransport({...}); // await server.connect(transport); } else { // Default to stdio transport console.log('Starting MCP server with stdio transport...'); const transport = new StdioServerTransport(); await server.connect(transport); } } catch (error) { if (error instanceof Error) { console.error(`Error starting server: ${error.message}`); } else { console.error('Unknown error starting server'); } 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/c20020207/mcp-appsignal'

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