An AI-powered Discord bot that uses Claude Code CLI to answer questions directly in your server. It also doubles as an MCP server, so Claude Desktop or Claude Code can read and send Discord messages.
- A user sends
!ask <question>or mentions the bot in a channel - The bot spawns the Claude Code CLI to generate a response
- The response is sent back to the channel as a reply
- All exchanges are saved as text files, giving Claude memory across conversations
Claude is sandboxed — it can only search the web and read/write its own message history files. No shell access, no code execution.
-
Create a Discord bot and invite it to your server with these permissions:
- Read Messages/View Channels
- Send Messages
- Read Message History
-
Set your environment variables in
docker-compose.yml:DISCORD_TOKEN— your bot tokenREQUIRED_ROLE_ID— Discord role ID that can use the bot (leave as placeholder to allow everyone)AUTH_ADMIN_USER_IDS— comma-separated Discord user IDs allowed to manage Claude authentication (leave empty to disable)CLAUDE_AUTH_LOGIN_TIMEOUT_MS— optional Discord login-session timeout (default:300000)MESSAGES_DIR— where message history is stored (default:/app/messages)BOT_EFFORT— optional Claude Code--effortlevel:low,medium,high,xhigh, ormaxSUPPRESS_MENTIONS— optional; set totrueto prevent bot messages from notifying users, roles,@everyone, or@here(default:false)
-
Run it:
docker compose up -dClaude Code CLI needs to be authenticated inside the container before the bot can respond. On first run (or after clearing volumes), you need to log in:
Set AUTH_ADMIN_USER_IDS to your Discord user ID and restart the bot. Claudify registers owner-only slash commands with ephemeral responses:
/auth statuschecks the CLI's authentication state without making a model request./auth loginreturns Claude's browser login URL./auth codeprivately submits the short-lived code shown after browser authorization./auth cancelstops an unfinished login.
Only explicitly listed user IDs can execute these commands. Discord roles and Administrator status are not used for authorization. Claudify never logs or stores the one-time code. Never submit an API key or long-lived OAuth token through Discord.
The Discord application must be installed with the applications.commands scope for slash commands to appear.
You can also exec into the running container:
docker exec -it <container_name> claude auth loginThe CLI will display a URL. Open it in your browser and complete the login.
Once authenticated, the bot is ready — no restart needed. Auth persists across container restarts via the claude-home volume.
If the bot sends "Sorry, I could not generate a response", it's most likely an auth issue. Check the logs with docker logs <container_name> and re-run the auth command above.
For deployed products or services, prefer ANTHROPIC_API_KEY or a supported cloud provider rather than relaying Claude subscription authentication.
When used as an MCP server (e.g., with Claude Desktop or Claude Code), these tools are available:
| Tool | Description |
|---|---|
send-message |
Send a message to a Discord channel |
read-messages |
Read recent messages from a channel via Discord API |
read-message-history |
Read saved message history/pending files from disk |
After Claudify successfully logs in to Discord, configure an MCP client in the same network environment to connect to its Streamable HTTP endpoint:
{
"mcpServers": {
"discord": {
"type": "http",
"url": "http://localhost:3100/mcp"
}
}
}Set DISCORD_TOKEN in Claudify's environment, not in the MCP client
configuration. If you change MCP_PORT, update the URL to match. Claudify also
writes this configuration to .mcp-config.json when it starts. The server is
loopback-only and has no request authentication; the Docker setup therefore
does not expose it to host-side MCP clients by default.
npm install
npm run dev # watch mode
npm run build # compile
npm start # runTest with the MCP Inspector:
npm start
# In another terminal:
npx @modelcontextprotocol/inspectorIn the Inspector, select Streamable HTTP and connect to
http://localhost:3100/mcp (or your configured MCP_PORT).
- Claude CLI is restricted to
WebSearch,WebFetch,Read, andWritetools only - File access is scoped to the messages directory
- Role-based access control limits who can interact with the bot
- Claude authentication commands use the explicit user-ID allowlist; Discord roles are not used
- Authentication responses are ephemeral, and login codes are never logged or persisted
- Runs in Docker for isolation
MIT