MoatBot is your secure gateway to Claude AI Claude. Like a castle moat protects what's inside, MoatBot keeps your AI conversations private and under your control—accessible only through your own Discord, Telegram, or IDE.
- Multi-platform: Discord, Telegram, and IDE support via ACP
- Conversation persistence: Continue where you left off
- Streaming responses: Real-time message updates
- Built on Claude CLI: Leverages the official Claude Code CLI
-
Claude CLI - MoatBot uses the Claude CLI under the hood
npm install -g @anthropic-ai/claude-code
-
JDK 21+ - Required to run MoatBot
java -version
-
Platform token (at least one):
- Discord Bot Token, or
- Telegram Bot Token, or
- IDE with ACP support
export DISCORD_BOT_TOKEN="your-discord-bot-token"
./gradlew runSetup:
- Go to Discord Developer Portal
- Create a new application → Bot section → Reset Token → Copy
- Enable "Message Content Intent" under Privileged Gateway Intents
- Invite bot using OAuth2 URL Generator
export TELEGRAM_BOT_TOKEN="your-telegram-bot-token"
./gradlew runSetup:
- Message @BotFather on Telegram
- Send
/newbotand follow the prompts - Copy the token
./gradlew shadowJar
java -jar build/libs/moatbot-kotlin-0.1.0-SNAPSHOT-all.jar --acp| Variable | Description | Default |
|---|---|---|
DISCORD_BOT_TOKEN |
Discord bot token | - |
TELEGRAM_BOT_TOKEN |
Telegram bot token | - |
SESSION_DIR |
Conversation storage (:memory: for in-memory) |
~/.moatbot/sessions |
CLAUDE_CLI_PATH |
Path to Claude CLI | claude |
CLAUDE_WORKING_DIR |
Working directory for Claude | . |
| Command | Description |
|---|---|
/clear |
Clear conversation history |
/status |
Show session info |
/help |
Show available commands |
For detailed design, see docs/design.md.
┌─────────────────────────────────────────────────────────┐
│ Your Platform │
│ Discord │ Telegram │ IDE (ACP) │
└─────────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ MoatBot │
│ • Manages conversations │
│ • Streams responses │
│ • Handles multiple platforms │
└─────────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────┐
│ Claude CLI │
│ Executes prompts, maintains context │
└─────────────────────────────────────────────────────────┘
git clone https://github.com/anthropics/moatbot.git
cd moatbot
./gradlew build
./gradlew testContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Claude CLI not found
which claude # Verify installationNo messaging platform configured
Set at least one of DISCORD_BOT_TOKEN or TELEGRAM_BOT_TOKEN.
Discord bot not responding
- Enable "Message Content Intent" in Discord Developer Portal
- Verify bot has read/send message permissions
MIT