Skip to main content
Glama

TMB Bus Arrival Times

by esteveavi
host.tsβ€’2.25 kB
#!/usr/bin/env node /** * TMB Bus MCP Server Host * * This host application starts the MCP server as a child process. * In production, you would typically configure this in your MCP client's config file. * * For Claude Desktop, add to your config file: * * macOS: ~/Library/Application Support/Claude/claude_desktop_config.json * Windows: %APPDATA%\Claude\claude_desktop_config.json * * { * "mcpServers": { * "tmb-bus": { * "command": "node", * "args": ["/path/to/tmb-bus-mcp/dist/server.js"], * "env": { * "TMB_APP_ID": "your_app_id", * "TMB_APP_KEY": "your_app_key" * } * } * } * } */ import { spawn } from 'child_process'; import { fileURLToPath } from 'url'; import { dirname, join } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); function startServer() { console.log('Starting TMB Bus MCP Server...\n'); // Check for required environment variables if (!process.env.TMB_APP_ID || !process.env.TMB_APP_KEY) { console.error('ERROR: Please set TMB_APP_ID and TMB_APP_KEY environment variables'); console.error('\nExample:'); console.error(' export TMB_APP_ID=your_app_id'); console.error(' export TMB_APP_KEY=your_app_key'); console.error(' npm run host\n'); process.exit(1); } const serverPath = join(__dirname, 'server.js'); // Start the server process const serverProcess = spawn('node', [serverPath], { stdio: 'inherit', env: { ...process.env, TMB_APP_ID: process.env.TMB_APP_ID, TMB_APP_KEY: process.env.TMB_APP_KEY, }, }); serverProcess.on('error', (error) => { console.error('Failed to start server:', error); process.exit(1); }); serverProcess.on('exit', (code) => { if (code !== 0) { console.error(`Server exited with code ${code}`); process.exit(code || 1); } }); // Handle graceful shutdown process.on('SIGINT', () => { console.log('\nShutting down server...'); serverProcess.kill('SIGINT'); }); process.on('SIGTERM', () => { serverProcess.kill('SIGTERM'); }); } startServer();

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/esteveavi/ibus-mcp'

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