Discord connector for AI Maestro. Routes Discord messages (DMs and @mentions) to AI Maestro agents, and delivers agent responses back to Discord channels.
- DM handling (routes to default agent)
- @mention detection in guild channels
@AIM:agent-namerouting syntax for multi-agent support- Thread support
- 2000-character message splitting for long responses
- Typing indicators while waiting for agent responses
- Content security (trust model + injection pattern scanning)
- Management APIs (health, config, stats, activity log)
- Admin token authentication
cp .env.example .env
# Edit .env with your Discord bot token
npm install
npm run dev- Create a Discord Application at https://discord.com/developers/applications
- Create a Bot and copy the token
- Enable Message Content Intent in Bot settings
- Invite the bot to your server with permissions: Send Messages, Read Messages, Add Reactions
See .env.example for all available environment variables.
- User sends DM or @mentions the bot
- Gateway applies content security (trust assessment + injection scanning)
- Message forwarded to AI Maestro with Discord context (channelId, messageId)
- Target agent receives the message
- Agent sends response via AI Maestro
- Gateway polls inbox, picks up responses
- Replies sent to the originating Discord channel/thread
- Long responses split at 2000-character boundaries
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/health |
GET | No | Health check with Discord connection status |
/api/config |
GET | Yes | Current gateway configuration |
/api/config/security |
PATCH | Yes | Update operator Discord IDs |
/api/stats |
GET | Yes | Gateway metrics and uptime |
/api/activity |
GET | Yes | Recent activity log |
pm2 start ecosystem.config.cjs
pm2 logs discord-gateway