This guide walks you through connecting cc-connect to Discord, so you can chat with your local Claude Code via a Discord bot.
- A Discord account
- A machine that can run cc-connect (no public IP needed)
- Claude Code installed and configured
💡 Advantage: Uses Gateway (WebSocket) — no public IP, no domain, no reverse proxy needed.
Go to Discord Developer Portal and sign in.
- Click "New Application" in the top right
- Enter an application name (e.g.
cc-connect) - Agree to the Terms of Service
- Click "Create"
In the left sidebar, click "Bot".
- Click "Add Bot"
- Confirm the action
| Field | Suggested Value |
|---|---|
| Username | cc-connect |
| Avatar | Upload an icon you like |
On the Bot page:
- Click "Reset Token"
- You may need to enter a 2FA code
- Click "Copy" to copy the token
⚠️ The token is only shown once — save it immediately! Format:MTk4NjIyNDgzNDcOTY3NDUxMg.G8vKqh.xxx...
Click "Reset Token" at any time to regenerate. The old token will be invalidated immediately.
Intents control which events your bot can receive from Discord's Gateway.
On the Bot page, under "Privileged Gateway Intents", enable:
| Intent | Purpose | Required? |
|---|---|---|
| Message Content Intent | Read message content | ✅ Required |
| Presence Intent | Read user status | Optional |
| Server Members Intent | Read server members | Optional |
⚠️ You must enable Message Content Intent, or the bot won't be able to read messages!
Click "Save Changes".
Add the token to your config.toml:
[[projects]]
name = "my-project"
[projects.agent]
type = "claudecode"
[projects.agent.options]
work_dir = "/path/to/your/project"
mode = "default"
[[projects.platforms]]
type = "discord"
[projects.platforms.options]
token = "MTk4NjIyNDgzNDcOTY3NDUxMg.G8vKqh.xxx..."
# thread_isolation = true # Optional: isolate each agent session in its own Discord thread
# progress_style = "legacy" # Optional: legacy | compact | cardcc-connect automatically configures the required Intents (MESSAGE_CONTENT, GUILD_MESSAGES, DIRECT_MESSAGES). With
thread_isolation = true, cc-connect creates or reuses a Discord thread for each session and routes follow-up messages by thread channel ID.progress_style = "compact"merges thinking/tool updates into one editable message;progress_style = "card"renders a Discord-native embed progress card and still sends the final answer as a normal message.
In the left sidebar, click "OAuth2" → "URL Generator".
Under "Scopes", check:
- ✅
bot
Under "Bot Permissions", check:
| Permission | Purpose |
|---|---|
| Read Messages/View Channels | Read messages |
| Send Messages | Send messages |
| Create Public Threads | Create a new thread for a fresh agent session |
| Send Messages in Threads | Send messages in threads |
| Read Message History | Read message history |
- The invite link will be generated at the bottom of the page
- Click "Copy"
Open the copied URL in your browser and sign in to Discord.
Choose the server you want to add the bot to from the dropdown.
Review the permissions and click "Authorize". Complete the CAPTCHA if prompted.
cc-connect
# Or specify a config file
cc-connect -config /path/to/config.tomlYou should see logs like:
level=INFO msg="discord: connected" bot=cc-connect#0000
level=INFO msg="platform started" project=my-project platform=discord
level=INFO msg="cc-connect is running" projects=1
Send a message in any channel where the bot has permissions.
- Click the bot's avatar
- Send a DM
User: Help me analyze the current project structure
cc-connect: 🤔 Thinking...
cc-connect: 🔧 Tool: Bash(ls -la)
cc-connect: Here's the project structure...
If you enable progress_style = "card", Discord shows one editable progress embed during the turn, then the final answer arrives as a separate normal message. This reduces channel noise compared with the legacy multi-message flow.
┌─────────────────────────────────────────────────────────────┐
│ Discord Cloud │
│ │
│ User Message ──→ Discord Gateway ◄── WebSocket │
│ │ │
└─────────────────────────┼────────────────────────────────────┘
│
│ WebSocket (no public IP needed)
▼
┌─────────────────────────────────────────────────────────────┐
│ Your Local Machine │
│ │
│ cc-connect ◄──► Claude Code CLI ◄──► Your Project Code │
│ │
└─────────────────────────────────────────────────────────────┘
| Feature | Details |
|---|---|
| Connection | WebSocket |
| Public IP | ❌ Not needed |
| Heartbeat | Automatic keepalive |
| Reconnection | Automatic on disconnect |
| Intents | Must declare required event types |
| Message limit | 2000 characters per message (auto-split by cc-connect) |
| Markdown | Full native support |
Most common issue: Message Content Intent is not enabled!
Fix:
- Go to Discord Developer Portal
- Select your app → Bot
- Enable "Message Content Intent"
- Save changes
- Restart cc-connect
Check:
- Is the bot token correct?
- Are intents configured properly?
- Are you hitting Discord rate limits? (from frequent reconnects)
- Make sure you used the invite link to add the bot
- Check if the bot was kicked from the server
- Go to Discord Developer Portal
- Select your app → Bot
- Click "Reset Token"
- Update your config.toml
- Generate a new invite link with the correct permissions
- Re-invite the bot to the server
- Discord Developer Portal
- Discord API Documentation
- Bot Getting Started Guide
- Gateway Intents
- OAuth2 Scopes