Integration Guide
Give your AI agent a phone number. Register, get a token, send your first message, go live.
1. Quick Start (5 Steps)
Install & Run
git clone https://github.com/elrad/butt-dial-mcp.git
cd butt-dial-mcp
npm install && cp .env.example .env
npm run build && node dist/index.js
Register
Visit http://localhost:3100/auth/login → Register. Verify with the 6-digit code (printed to console in demo mode).
Get Your API Token
Go to /admin. Your API token is at the top of the dashboard. Click Copy.
Send Your First Message
curl -X POST http://localhost:3100/api/v1/send-message \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"agentId":"test-agent-001","to":"+15559876543","body":"Hello!","channel":"sms"}'
Check for Waiting Messages
curl http://localhost:3100/api/v1/waiting-messages?agentId=test-agent-001 \
-H "Authorization: Bearer YOUR_TOKEN"
This returns any messages that couldn't be delivered while your agent was offline. Fetching acknowledges them automatically. If an LLM key is configured, sandbox sends also generate a simulated reply after ~2 seconds.
2. Authentication
| Token | Who | How to Get | Accesses |
|---|---|---|---|
| Org Token | Developers | Registration / admin panel | Admin, provisioning |
| Agent Token | AI agents | Provisioning API | MCP tools, REST API |
| Orchestrator Token | Super-admins | .env file | Everything |
REST: Authorization: Bearer YOUR_TOKEN
MCP: GET /sse?token=YOUR_TOKEN
3. Sandbox Mode
New accounts start in sandbox. All API calls work with mock providers — no real messages, no costs.
LLM-Powered Replies: If ANTHROPIC_API_KEY, OPENAI_API_KEY, or SANDBOX_LLM_ENDPOINT is set, sandbox sends generate a simulated inbound reply after ~2 seconds. Set SANDBOX_LLM_ENABLED=false to disable.
4. REST API
All endpoints at /api/v1/. Interactive docs at /admin#docs.
# SMS
curl -X POST /api/v1/send-message -d '{"agentId":"bot","to":"+15559876543","body":"Hi","channel":"sms"}'
Email
curl -X POST /api/v1/send-message -d '{"agentId":"bot","to":"user@example.com","body":"Hi","channel":"email","subject":"Hello"}'
Voice call
curl -X POST /api/v1/make-call -d '{"agentId":"bot","to":"+15559876543","greeting":"Hello!"}'
Waiting messages (dead letters)
curl /api/v1/waiting-messages?agentId=bot
Provision agent
curl -X POST /api/v1/provision -d '{"agentId":"bot","displayName":"My Bot","capabilities":["sms","voice"]}'
5. MCP Connection
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
const transport = new SSEClientTransport(
new URL("http://localhost:3100/sse?token=YOUR_TOKEN")
);
const client = new Client({ name: "my-agent", version: "1.0.0" });
await client.connect(transport);
const result = await client.callTool({
name: "comms_send_message",
arguments: { agentId: "my-agent", to: "+15559876543", body: "Hello!", channel: "sms" }
});
Claude Desktop / Cursor config:
{ "mcpServers": { "butt-dial": { "url": "http://localhost:3100/sse?token=TOKEN" } } }
6. Channels
| Channel | Provider | Send | Inbound | Requirements |
|---|---|---|---|---|
| SMS | Twilio | channel: "sms" | Auto-webhook | TWILIO_ACCOUNT_SID, AUTH_TOKEN |
| Voice | Twilio | comms_make_call | Auto-webhook | Same + WEBHOOK_BASE_URL (HTTPS) |
| Resend | channel: "email" | Resend dashboard webhook | RESEND_API_KEY | |
| Twilio | channel: "whatsapp" | Auto-webhook | Twilio WhatsApp sandbox | |
| LINE | LINE API | channel: "line" | LINE Console webhook | LINE_CHANNEL_ACCESS_TOKEN |
7. Going Live
- Add real provider credentials (Settings tab or
.env) - Set
DEMO_MODE=false - Set public
WEBHOOK_BASE_URL - Provision agent with real channels
- Real messages flow
Community/enterprise editions auto-approve accounts. SaaS requires admin review.
8. Troubleshooting
| Problem | Fix |
|---|---|
| Can't connect | curl http://localhost:3100/health |
| Auth errors | Check token, or set DEMO_MODE=true |
| No inbound | Set WEBHOOK_BASE_URL to public URL |
| No sandbox replies | Set an LLM key + SANDBOX_LLM_ENABLED=true |
Full guide: /api/v1/integration-guide (raw markdown) or docs.