Gateway & Channels
The gateway is Moneypenny’s multi-channel server. It spawns worker processes for each agent, starts the scheduler, and binds channel adapters for HTTP, Slack, Discord, and Telegram.
Starting the Gateway
mp startAsk your MCP-connected agent:
Start the Moneypenny gateway
The gateway binds to the configured host and port (default 127.0.0.1:4820).
All channel adapters share a single HTTP server.
HTTP API
The HTTP adapter exposes REST, SSE, and WebSocket endpoints.
Configuration
[channels.http]port = 4821api_key = "your-secret-key" # optional; omit for no authREST: POST /v1/chat
Send a message and get a response:
curl -X POST http://localhost:4821/v1/chat \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-secret-key" \ -d '{"message":"What do you know about deployments?","agent":"main"}'Response:
{ "response": "Based on what I know...", "session_id": "sess_abc123"}Pass session_id to continue a conversation:
curl -X POST http://localhost:4821/v1/chat \ -H "Content-Type: application/json" \ -d '{"message":"Tell me more","session_id":"sess_abc123"}'REST: POST /v1/ops
Execute canonical operations over HTTP:
curl -X POST http://localhost:4821/v1/ops \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-secret-key" \ -d '{"op":"memory.search","args":{"query":"deployment","limit":5}}'SSE: GET /v1/chat/stream
Server-Sent Events for streaming responses:
curl "http://localhost:4821/v1/chat/stream?message=Hello&agent=main"WebSocket: GET /v1/ws
Full-duplex communication:
// Send{"message": "Hello", "agent": "main", "session_id": "optional"}
// Receive{"response": "...", "session_id": "sess_abc123"}Health Check: GET /health
curl http://localhost:4821/health{"status": "ok", "version": "0.1.0"}Slack
The Slack adapter uses the Events API. Moneypenny responds to app_mention
and message events, threading replies automatically.
Configuration
[channels.slack]bot_token = "xoxb-your-bot-token"signing_secret = "your-signing-secret" # optional but recommendedagent = "main" # default agent for Slack messagesSetup
- Create a Slack app at api.slack.com/apps
- Enable Event Subscriptions and point the request URL to
https://your-host/slack/events - Subscribe to
app_mentionandmessage.imevents - Install the app to your workspace
- Copy the bot token and signing secret into
moneypenny.toml
Discord
The Discord adapter handles slash command interactions with Ed25519 signature verification.
Configuration
[channels.discord]application_id = "your-app-id"public_key = "your-ed25519-public-key"bot_token = "your-bot-token"agent = "main"Setup
- Create an application at discord.com/developers
- Set the Interactions Endpoint URL to
https://your-host/discord/interactions - Create a slash command (e.g.
/askwith amessagestring option) - Copy the application ID, public key, and bot token into config
Discord interactions use deferred responses — the agent processes the request asynchronously and sends a follow-up message.
Telegram
The Telegram adapter uses long-polling (no webhook setup required).
Configuration
[channels.telegram]bot_token = "your-bot-token-from-botfather"agent = "main"Setup
- Talk to @BotFather on Telegram
- Create a new bot and copy the token
- Add the token to
moneypenny.toml
The adapter starts polling automatically when the gateway launches. Each Telegram chat maintains its own session.
Gateway Configuration
[gateway]host = "127.0.0.1"port = 4820log_level = "info" # trace, debug, info, warn, errorGraceful Shutdown
mp stopAsk your MCP-connected agent:
Stop the Moneypenny gateway
The gateway signals all workers and channel adapters to shut down gracefully, completing in-flight requests before exiting.