Knock MCP Server for Multi-Channel Messaging
Send unified product and customer messaging across email, in-app, push, SMS, Slack, and MS Teams with the Knock MCP server for reliable multi-channel delivery.
npx -y @knocklabs/agent-toolkit#model-context-protocol-mcpOverview
The Knock MCP (Model Context Protocol) server is a lightweight service that centralizes message composition and delivery across multiple channels — email, in-app, push, SMS, Slack, and Microsoft Teams. It provides a single place to supply customer and product context (user profile, organization data, event metadata, templates, and channel preferences) and then renders and routes messages to the appropriate providers for each channel.
For developer teams building cross-channel notification systems, the MCP server reduces duplication of delivery logic, enforces channel-specific formatting, and simplifies fallbacks and retries. Instead of wiring templates and provider SDKs into many parts of your application, you send contextual payloads to the MCP server and let it produce channel-specific messages and dispatch them reliably.
Features
- Single API for multi-channel messaging and context enrichment
- Template rendering per channel (HTML for email, plaintext for SMS, blocks for Slack)
- Channel preference resolution and recipient targeting
- Fallbacks and retries to improve delivery reliability
- Pluggable provider integrations (SMTP, push providers, SMS gateways, Slack, MS Teams)
- Message deduplication and rate limiting support
- Local development server and Docker support
- Audit logs and webhooks for delivery events
Installation / Configuration
Minimum system requirements: Node.js 16+ (or run via Docker).
Quickstart (Node/npm)
# example: mcp server lives under packages/mcp-server
# set environment variables, then start
Run with Docker
# docker-compose.yml
version: "3.8"
services:
mcp:
image: knocklabs/mcp-server:latest
ports:
- "8080:8080"
environment:
- KNOCK_API_KEY=${KNOCK_API_KEY}
- NODE_ENV=production
- PORT=8080
Environment variables
| Variable | Description | Example |
|---|---|---|
| KNOCK_API_KEY | API key for Knock / provider service | sk_live_12345 |
| PORT | HTTP port the server listens on | 8080 |
| LOG_LEVEL | Logging verbosity (info/debug/error) | info |
| TEMPLATE_DIR | Path to channel templates | ./templates |
| DEFAULT_FROM_EMAIL | Default “from” address for email channel | [email protected] |
Configuration file (example config.json)
Available Resources
- Source code and examples: https://github.com/knocklabs/agent-toolkit#model-context-protocol-mcp
- Local development: built-in server with hot reload (npm run dev)
- Templates: channel-specific templates folder with examples for email, SMS, push, Slack blocks
- Provider adapters: modular adapters for SMTP, Twilio, Firebase/APNs, Slack, and MS Teams
- Webhook endpoints: delivery status and error callbacks for integration with analytics or audit stores
Use Cases
Transactional notifications (order confirmations)
- Send a unified message when an order is placed that includes an HTML email, in-app confirmation, push notification for mobile, and an SMS receipt if the user prefers SMS.
- The MCP server accepts order context (order id, line items, user id) and generates channel-appropriate content from the same template source.
Alerting and incident notifications
- Send critical alerts to on-call engineers via Slack and SMS, with a fallback to email if other channels fail.
- The server enforces rate limits and escalation rules to avoid alert storms.
Feature announcements and product messaging
- Target users based on segments and channel preference: in-app modals for active users, email for less-active users, and push for mobile users.
- The MCP server handles templating and personalization across channels so product teams can author one message payload.
Multi-tenant apps
- Deliver tenant-specific branding and from-addresses by selecting tenant templates and provider credentials at send time.
- The MCP server routes messages under the correct tenant context and logs events per tenant.
Example API
Below is a representative API request pattern to create a multi-channel message. The exact endpoint and payload shape can vary by implementation.
Request:
POST /mcp/v1/messages
Content-Type: application/json
Authorization: Bearer <MCP_API_KEY>
{
"recipient": { "userId": "user_123", "channels": ["email","sms","slack"] },
"context": {
"user": { "name": "Ava", "email": "[email protected]", "phone": "+15550001111" },
"order": { "id": "ord_987", "total": 49.99 }
},
"template": "order_confirmation",
"metadata": { "source": "checkout" }
}
Typical response:
Notes
- Use the server’s webhooks or status endpoints to track delivery, bounces, and failures.
- For production use, configure retries, monitoring, and provider credentials securely (secrets manager recommended).
If you need help mapping your existing notification logic into the MCP server model, check the GitHub repository for example adapters and templates to get started fast.