Troubleshooting
Solutions for common Discord Agent MCP issues.
Quick Diagnostics
Run these commands to quickly identify issues:
# Check if server is running
curl http://localhost:3000/health
# Check Discord connection
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"resources/read","params":{"uri":"discord://guilds"}}'
# Check available tools
curl -X POST http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | jq '.result.tools | length'
Discord Connection Issues
Bot Not Connecting
Symptoms:
- Server starts but Discord shows offline
- “Discord client not connected” errors
- Health check shows
"discord": "disconnected"
Solutions:
- Verify your token
# Check token is set echo $DISCORD_TOKEN | head -c 20 # Should show first 20 chars of your token - Check token validity
- Go to Discord Developer Portal
- Select your application → Bot
- If you’ve regenerated the token, update your
.env
- Enable required intents
- In Developer Portal → Bot → Privileged Gateway Intents
- Enable: Server Members Intent and Message Content Intent
- Save changes
- Check for connection errors in logs
# Local npm start 2>&1 | grep -i "discord\|error\|token" # Docker docker logs discord-mcp 2>&1 | grep -i "discord\|error\|token"
Bot Online But Can’t See Channels/Members
Solutions:
- Verify bot is in server
- Check Server Settings → Integrations
- Look for your bot in the list
- Check bot permissions
- Server Settings → Roles → [Your Bot Role]
- Ensure “View Channels” is enabled
- Check role hierarchy (bot role should be above roles it needs to manage)
- Check channel-specific permissions
- Right-click channel → Edit Channel → Permissions
- Verify bot has access
Frequent Disconnections
Solutions:
- Check network stability
ping discord.com - Increase reconnect settings
RECONNECT_MAX_RETRIES=10 RECONNECT_BACKOFF_MS=2000 - Check for rate limiting
- Review logs for rate limit warnings
- Reduce request frequency if needed
MCP Server Issues
Server Won’t Start
Symptoms:
npm startfails- Port already in use error
- Module not found errors
Solutions:
- Port already in use
# Find what's using port 3000 lsof -i :3000 # Kill the process kill -9 <PID> # Or use different port HTTP_PORT=3001 npm start - Missing dependencies
rm -rf node_modules package-lock.json npm install npm run build - Build errors
# Check for TypeScript errors npm run build 2>&1 # Clear dist and rebuild rm -rf dist npm run build
Tools Not Working
Symptoms:
- Tool calls return errors
- “Permission denied” messages
- Empty responses
Solutions:
-
Check bot permissions for the action
Tool Required Permissions send_message Send Messages delete_message Manage Messages kick_member Kick Members ban_member Ban Members create_channel Manage Channels assign_role Manage Roles - Verify role hierarchy
- Bot’s role must be higher than target role/member
- Check Server Settings → Roles → drag to reorder
- Check channel-specific overrides
- Channel permissions can override server permissions
- Right-click channel → Edit Channel → Permissions
Claude Code Integration
Can’t Add MCP Server
Symptoms:
claude mcp addfails- Server not showing in
claude mcp list
Solutions:
- Verify server is running first
# In one terminal npm start # In another terminal curl http://localhost:3000/health # Should return {"status":"healthy","discord":"connected"} - Add with correct URL
claude mcp add --transport http discord-agent http://localhost:3000/mcp - Check Claude Code version
claude --version # Update if needed
Tools Not Appearing in Claude Code
Solutions:
- Restart Claude Code
- Close and reopen the application
- Tools load at startup
- Re-add the server
claude mcp remove discord-agent claude mcp add --transport http discord-agent http://localhost:3000/mcp claude mcp list - Check for connection errors
- Look at MCP server logs when Claude Code connects
- Should see “Client connected” messages
Claude Code Can’t Connect
Symptoms:
- “Connection refused” errors
- Timeout errors
- “Server unavailable” messages
Solutions:
- Verify URL is correct
# List current config claude mcp list # Should show: discord-agent: http://localhost:3000/mcp (HTTP) - Check firewall
# Allow port 3000 (Linux) sudo ufw allow 3000 # Check if blocked (macOS) sudo pfctl -sr | grep 3000 - Try different port
HTTP_PORT=8080 npm start claude mcp remove discord-agent claude mcp add --transport http discord-agent http://localhost:8080/mcp
Docker Issues
Container Won’t Start
Solutions:
- Check logs
docker logs discord-mcp - Verify environment variables
docker run --rm \ -e DISCORD_TOKEN=your_token \ discord-mcp-server:latest \ printenv | grep DISCORD - Rebuild image
docker build --no-cache -t discord-mcp-server:latest .
Container Keeps Restarting
Solutions:
- Check exit code
docker inspect discord-mcp --format='' - Check for OOM (Out of Memory)
docker inspect discord-mcp --format='' - Increase memory limit
docker run -d --memory=512m --name discord-mcp ...
Can’t Connect to Container
Solutions:
- Verify port mapping
docker ps # Look for 0.0.0.0:3000->3000/tcp - Check container IP (if not using port mapping)
docker inspect discord-mcp --format='' - Check Docker network
docker network ls docker network inspect bridge
Permission Errors
“Missing Permission” Errors
Error:
Error: Missing permission MANAGE_MESSAGES in channel 123456789
Solutions:
- Grant permission in Discord
- Server Settings → Roles → [Bot Role]
- Enable the required permission
- Or: Grant Administrator for testing
- Check channel overrides
- Channel might deny the permission specifically
- Right-click channel → Edit Channel → Permissions
- Check role hierarchy
- Can’t manage roles/members above bot’s highest role
- Drag bot’s role higher in Server Settings → Roles
“Cannot Modify Higher Role” Errors
Error:
Error: Cannot assign role that is higher than bot's highest role
Solutions:
- Reorder roles
- Server Settings → Roles
- Drag your bot’s role above the target role
- Note: Can’t modify server owner
- Bot cannot kick/ban/timeout the server owner
- This is a Discord limitation
Rate Limiting
“Rate Limit Exceeded” Errors
Symptoms:
- Operations failing after many requests
- “Retry after X ms” messages
Solutions:
- Slow down requests
- Add delays between bulk operations
- Use bulk_delete_messages instead of many delete_message calls
- Check for loops
- Ensure no infinite loops in your usage
- Review recent actions in audit log
- Wait for cooldown
- Discord rate limits reset after the specified time
- Check error message for retry time
Common Error Messages
“DiscordNotConnectedError”
Cause: Bot hasn’t established connection to Discord gateway
Fix:
- Check DISCORD_TOKEN
- Wait for connection (can take 10-30 seconds at startup)
- Check network connectivity
“GuildNotFoundError”
Cause: Bot is not a member of the specified server
Fix:
- Verify guildId is correct
- Invite bot to the server
- Check bot hasn’t been kicked
“ChannelNotFoundError”
Cause: Channel doesn’t exist or bot can’t see it
Fix:
- Verify channelId
- Check bot has View Channels permission
- Channel may have been deleted
“InvalidInputError”
Cause: Parameter validation failed
Fix:
- Check parameter types (strings for IDs)
- Verify content length limits
- Check for required parameters
Getting Help
If you’re still stuck:
- Check the logs
LOG_LEVEL=debug npm start - Search existing issues
- Open a new issue
- Include error messages
- Include relevant logs
- Describe steps to reproduce
- Resources