Claude Discord Bot
This project packages Claude Code into a Docker image that runs on a remote server and receives its instructions from Discord. @mention the bot in an allowed channel and it opens a thread with its own Claude Code session; every thread is a separate context, and threads run in parallel. Claude replies in the thread and can work on code in its /workspace directory: edit files, run tools, commit and push to GitHub.
There are two modes, chosen with BOT_MODE:
bridge(default): the thread-session bridge, one session per Discord thread.plugin: the original setup, one shared session through the officialdiscord@claude-plugins-officialchannel plugin.
How it fits together
Section titled “How it fits together”Discord ──► bridge (Node, discord.js) BOT_MODE=bridge │ thread A ──► Claude Code session A ┐ │ thread B ──► Claude Code session B ├─ parallel (Claude Agent SDK) │ thread C ──► Claude Code session C ┘ ▼ /workspace code the bot works on (volume) /home/node/.claude config, sessions, thread→session map (volume) git / gh push to GitHub with GH_TOKEN| Piece | What it does |
|---|---|
bridge/ |
The thread-session bridge (TypeScript). |
Dockerfile |
Builds the image: Node 22, Bun, Claude Code, the bridge, gh, and common CLI tools. |
entrypoint.sh |
Seeds config, then starts the bridge, or (plugin mode) installs the plugin and starts Claude. |
docker-compose.yml |
Local / plain Docker deployment that builds the image. |
docker-compose.portainer.yml |
Portainer stack that uses a pre-built image. |
.env.example |
Every environment variable the container reads. |
- Thread sessions: how to use the bot and how sessions work.
- Docker image: what is installed and why.
- Entrypoint: the startup sequence, step by step.
- Configuration: all environment variables.
- Deployment: Docker Compose and Portainer.
- Operations: attaching, updating, persistence, troubleshooting.
- Security: what the bot can do and how to limit it.