Skip to main content
Glama
mmarqueti

WhatsApp Cloud API MCP Server

by mmarqueti
index.js•1.31 kB
import express from 'express'; import { createServer } from 'http'; import { config } from './config/env.js'; import { webhookRouter } from './whatsapp/webhook.js'; import { mcpServer } from './mcp/server.js'; const app = express(); const httpServer = createServer(app); // Middleware app.use(express.json()); // Routes app.use('/webhook', webhookRouter); // Health check app.get('/health', (req, res) => { res.status(200).json({ status: 'ok' }); }); // Start servers async function main() { try { const args = process.argv.slice(2); const useStdio = args.includes('--stdio'); if (useStdio) { // Start MCP Server (Stdio) await mcpServer.startStdio(); } else { // Start MCP Server (WebSocket) await mcpServer.start(httpServer); } // Start HTTP Server httpServer.listen(config.PORT, () => { console.error(`🚀 Server running on port ${config.PORT}`); console.error(`webhook: http://localhost:${config.PORT}/webhook`); if (!useStdio) { console.error(`mcp: ws://localhost:${config.PORT}`); } }); } catch (error) { console.error('Failed to start server:', error); 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/mmarqueti/whatsapp-mcp'

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