Skip to content

sequenzia/discord-claudebot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Claudebot

A two-way MCP channel server that bridges Discord messages to Claude Code. Claude receives Discord messages as channel notifications and replies back via a tool call.

Prerequisites

  • Bun v1.0+
  • Claude Code v2.1.80+
  • A Discord bot application (setup below)

Discord Bot Setup

  1. Go to the Discord Developer Portal
  2. Click New Application, name it (e.g., "Claude Channel"), and create it
  3. Go to the Bot tab in the left sidebar
  4. Click Reset Token, copy the token — you'll need it for config.json
  5. Under Privileged Gateway Intents, enable:
    • Message Content Intent (required to read message text)
    • Server Members Intent (optional, helps with username resolution)
  6. Go to OAuth2URL Generator
  7. Under Scopes, check bot
  8. Under Bot Permissions, check:
    • Send Messages
    • Read Message History
    • View Channels
  9. Copy the generated URL, open it in your browser, and invite the bot to your server

Getting Your Discord User ID

  1. Open Discord Settings → Advanced → enable Developer Mode
  2. Right-click your username → Copy User ID

Getting a Channel ID

  1. With Developer Mode enabled, right-click any channel → Copy Channel ID

Configuration

Edit config.json:

{
  "token": "your-bot-token-here",
  "allowedUsers": ["123456789012345678"],
  "watchedChannels": ["111111111111111111"]
}
Field Description
token Your Discord bot token
allowedUsers Array of Discord user IDs that can talk to Claude
watchedChannels Array of channel IDs to monitor (optional — DMs and @mentions always work)

Message Routing

Source Condition Forwarded?
DM from allowed user Always Yes
Message in watched channel From allowed user Yes
@mention in any channel From allowed user Yes
Any other message No

Usage

Install dependencies:

bun install

Run with Claude Code (research preview):

claude --dangerously-load-development-channels server:discord

Security

  • Only messages from users in allowedUsers are forwarded to Claude
  • Gates on immutable Discord user ID (snowflake), not display name
  • Bot token is stored in config.json which is gitignored
  • Messages from other bots are always ignored (prevents loops)

About

A two-way MCP channel server that bridges Discord messages to Claude Code. Claude receives Discord messages as channel notifications and replies back via a tool call.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors