DEV Community

Cover image for Claude Code Channels: Control Your AI Agent from Discord (Complete Setup Guide)
Ayyaz Zafar
Ayyaz Zafar

Posted on • Originally published at ayyaztech.com

Claude Code Channels: Control Your AI Agent from Discord (Complete Setup Guide)

Developers were paying for Mac Minis just to run OpenClaw so they could message their AI agent from their phone. Anthropic just made that completely unnecessary. Claude Code Channels is the native, secure version of what OpenClaw was trying to do — and it supports Discord and Telegram out of the box.

In this guide, I'll walk you through the complete setup process: from testing with a local Fake Chat demo, to creating a Discord bot, pairing your account, and locking down access for security.

What Are Claude Code Channels?

A channel is an MCP server that pushes events into your running Claude Code session. This means Claude can react to things that happen while you're not at the terminal. Channels are two-way — Claude reads the event and replies back through the same channel, like a chat bridge.

Key points:

  • Events only arrive while the session is open
  • For an always-on setup, run Claude in a background process or persistent terminal
  • Discord and Telegram are included in the research preview
  • You can build your own custom channels for Slack, WhatsApp, or anything else

Quick Start: Testing with Fake Chat

Before connecting Discord, let's verify everything works with the built-in Fake Chat demo — a local chat UI that requires no authentication or external services.

# Make sure Claude Code is up to date
claude update

# Add the official plugins marketplace (if not already added)
claude plugin add-marketplace claude-plugins-official

# Install the Fake Chat plugin
claude plugin install @anthropic-ai/claude-code-fakechat

# Start Claude Code with the Fake Chat channel
claude --channels fakechat
Enter fullscreen mode Exit fullscreen mode

Once running, open http://localhost:8787 in your browser. You'll see a simple chat interface where you can type messages and even attach files.

Setting Up Discord

Step 1: Create a Discord Bot

  1. Go to the Discord Developer Portal
  2. Click New Application and name it (e.g., "Claude Code")
  3. Go to the Bot section in the left sidebar
  4. Click Reset Token and copy the token — save it somewhere safe
  5. Enable Message Content Intent under Privileged Gateway Intents
  6. Click Save Changes

Step 2: Invite the Bot to Your Server

  1. Go to OAuth2 → URL Generator
  2. Select the bot scope
  3. Under Bot Permissions, enable: View Channels, Send Messages, Read Message History, and Attach Files
  4. Copy the generated URL and open it in a new tab
  5. Select your server and click Authorize

Step 3: Install and Configure the Discord Plugin

# Install the Discord channel plugin
claude plugin install @claude-plugins-official/discord

# Configure with your bot token
/discord:configure YOUR_BOT_TOKEN_HERE

# Restart Claude Code with the Discord channel enabled
claude --channels discord
Enter fullscreen mode Exit fullscreen mode

Step 4: Pair Your Discord Account

  1. DM your bot on Discord — it will reply with a pairing code
  2. Run the pairing command shown in the bot's reply in your Claude Code terminal
  3. Approve the pairing when prompted
  4. You're connected! Send messages from Discord and Claude responds

Security: Locking Down Access

This step is critical. Without locking down access, anyone who can message your bot could potentially control your Claude Code session — and by extension, your entire computer.

# Lock down to allow-list mode
/discord:access policy allowlist
Enter fullscreen mode Exit fullscreen mode

This changes the DM policy from pairing (anyone can request access) to allowlist (only pre-approved users can interact).

What Can You Do from Discord?

Once connected, you can do everything from Discord that you'd normally do in the terminal:

  • Send text messages — ask Claude to read files, explain code, or answer questions
  • Upload images — Claude can analyze screenshots, diagrams, or any visual content
  • Create files — ask Claude to generate code, HTML pages, configs, etc.
  • Run commands — anything Claude Code can do locally, you can trigger remotely

Bypass Permissions (Use with Caution)

# WARNING: Only use in sandboxed/trusted environments
claude --channels discord --dangerously-skip-permissions
Enter fullscreen mode Exit fullscreen mode

⚠️ Warning: This flag bypasses ALL permission prompts. Only use this in sandboxed environments you can easily restore.

Resources

Related Articles

Top comments (0)