Clawdbot Integration
Clawdbot is an open-source Discord bot that brings Claude AI to your Discord server. You can configure it to use the LeanMCP AI Gateway for monitoring and cost tracking.Video Tutorial: Watch the Clawdbot setup guide on YouTube for a visual walkthrough.
Prerequisites
Get Credits
Purchase credits at ship.leanmcp.com
Create API Key
Create an API key at ship.leanmcp.com/api-keys with SDK permissions
Configuration
Environment Variables
Configure your.env file with the LeanMCP AI Gateway:
Configuration File
If Clawdbot uses a configuration file, update it to use the gateway:How It Works
Benefits for Discord Bots
User Monitoring
Track which Discord users are using the bot and how much
Cost Control
Set limits to prevent runaway costs from heavy usage
Content Filtering
Block inappropriate prompts before they reach Claude
Usage Analytics
Understand how your community uses the AI bot
Adding User Tracking
To track usage per Discord user, modify your Clawdbot code to include user headers:- Per-user usage tracking in your dashboard
- Setting limits per Discord user
- Blocking specific users if needed
Verifying the Setup
- Start your Clawdbot instance
- Send a message to the bot in Discord
- Check your LeanMCP Dashboard to see the request

Setting Up Rate Limits
Protect your bot from abuse with rate limits:Troubleshooting
Bot not responding
Bot not responding
- Check your Discord bot token is valid
- Verify the LeanMCP API key has credits
- Check Clawdbot logs for error messages
API errors
API errors
- Ensure the base URL ends with
/v1/anthropic(no trailing slash) - Verify your API key starts with
leanmcp_ - Check that you have sufficient credits
Requests not in dashboard
Requests not in dashboard
- Confirm Clawdbot is using the custom base URL
- Check environment variables are loaded correctly
- Restart the bot after configuration changes