Jake Shore d25ea2031b Gold standard upgrade: greenhouse, lever, loom
- Greenhouse: 29 tools (was 18), added interviews, scorecards, organization
- Lever: 26 tools (was 13), added tags, sources, expanded opportunities/postings
- Loom: 25 tools (was 14), added analytics, privacy, search, workspace members

All servers now have:
- main.ts with env validation & graceful shutdown
- server.ts with lazy-loaded tool modules
- Zod validation on all inputs
- Rich tool descriptions (when/why to use)
- Pagination support on all list_* tools
- Updated package.json (bin field, updated deps)
- Updated README with coverage manifests
- Old index.ts renamed to index.ts.bak
- Zero TypeScript errors (npx tsc --noEmit verified)
2026-02-14 05:52:42 -05:00

69 lines
2.3 KiB
JavaScript

#!/usr/bin/env node
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import { TwilioMCPServer } from './server.js';
// Validate environment
const TWILIO_ACCOUNT_SID = process.env.TWILIO_ACCOUNT_SID;
const TWILIO_AUTH_TOKEN = process.env.TWILIO_AUTH_TOKEN;
if (!TWILIO_ACCOUNT_SID) {
console.error('❌ ERROR: TWILIO_ACCOUNT_SID environment variable is required');
console.error('');
console.error('Get your Account SID from:');
console.error(' 1. Log in to Twilio Console: https://console.twilio.com/');
console.error(' 2. Your Account SID is displayed on the dashboard');
console.error(' 3. Set: export TWILIO_ACCOUNT_SID=your_account_sid_here');
console.error('');
process.exit(1);
}
if (!TWILIO_AUTH_TOKEN) {
console.error('❌ ERROR: TWILIO_AUTH_TOKEN environment variable is required');
console.error('');
console.error('Get your Auth Token from:');
console.error(' 1. Log in to Twilio Console: https://console.twilio.com/');
console.error(' 2. Click "Show" next to Auth Token on the dashboard');
console.error(' 3. Set: export TWILIO_AUTH_TOKEN=your_auth_token_here');
console.error('');
console.error('⚠️ WARNING: Keep your Auth Token secret! It provides full account access.');
process.exit(1);
}
// Create server instance
const server = new TwilioMCPServer({
accountSid: TWILIO_ACCOUNT_SID,
authToken: TWILIO_AUTH_TOKEN,
});
// Graceful shutdown
let isShuttingDown = false;
const shutdown = async (signal: string) => {
if (isShuttingDown) return;
isShuttingDown = true;
console.error(`\n📡 Received ${signal}, shutting down Twilio MCP server...`);
try {
await server.close();
console.error('✅ Server closed gracefully');
process.exit(0);
} catch (error) {
console.error('❌ Error during shutdown:', error);
process.exit(1);
}
};
process.on('SIGINT', () => shutdown('SIGINT'));
process.on('SIGTERM', () => shutdown('SIGTERM'));
// Start server
const transport = new StdioServerTransport();
server.connect(transport).catch((error) => {
console.error('❌ Failed to start Twilio MCP server:', error);
process.exit(1);
});
console.error('🚀 Twilio MCP Server running on stdio');
console.error('📱 Ready to handle SMS, voice, verify, conversations, and lookups');