Skill Development

discord

Connects a Discord bot to Claude Code through an MCP server. Messages the bot receives are forwarded to Claude, and Claude gets tools to reply, react, edit messages, fetch history and download attachments.

  • 37.6k GitHub stars
curl -fsSL https://bun.sh/install | bash
discord — illustration

What it is

The Discord plugin is a channel plugin for Claude Code (version 0.0.4). The description calls it a messaging bridge with built-in access control. It runs an MCP server on Bun that connects to a Discord bot. When the bot receives a message, the server forwards it to Claude and exposes tools so Claude can respond in Discord. Inbound messages automatically trigger a typing indicator, so Discord shows "botname is typing…" while the assistant works on a response. The assistant gets five tools: - reply sends text to a channel. It can optionally use native threading via reply_to and attach files (max 10 files, 25MB each). Long messages are auto-chunked. - react adds emoji reactions. Unicode emoji work directly; custom emoji need the <:name:id> form. - edit_message updates the bot's own messages. This is useful for "working…" → result progress updates. - fetch_messages pulls up to 100 recent messages per call, oldest-first. Discord's search API isn't exposed to bots, so this is the only lookback. - download_attachment saves a message's attachments to ~/.claude/channels/discord/inbox/. Attachments are not auto-downloaded. The channel notification lists each attachment's name, type and size, and the assistant downloads files only when it actually needs them. Access control is managed through /discord:access. The default policy is pairing: you DM the bot, it replies with a pairing code, and you approve that code inside Claude Code. Once you're paired, the README recommends switching to an allowlist policy so strangers don't get pairing-code replies. Guild channels are opt-in per channel ID, and IDs are Discord snowflakes. ACCESS.md covers groups, multi-user setups, mention detection, delivery config and the access.json schema.

Who it's for

  • Claude Code users who want to talk to their assistant through Discord DMs
  • Developers who want to run a single-user DM bot backed by Claude Code
  • Users who want Claude to interact in Discord guild channels with controlled access
  • People running multiple Discord bots on one machine with separate tokens and allowlists

Requirements

Requirements

  • Bun (the MCP server runs on Bun)
  • Claude Code
  • A Discord application and bot created in the Discord Developer Portal with Message Content Intent enabled
  • A Discord bot token
  • A Discord server shared with the bot (required to DM it)

Setup

  1. Install Bun

    The MCP server runs on Bun.

    bash
    curl -fsSL https://bun.sh/install | bash
  2. Create a Discord application and bot

    In the Discord Developer Portal: 1. Click New Application and give it a name. 2. Go to Bot in the sidebar and give your bot a username. 3. Under Privileged Gateway Intents, enable Message Content Intent. Without it, the bot receives messages with empty content.

  3. Generate a bot token

    On the Bot page, scroll up to Token and press Reset Token. Copy the token: it's only shown once.

  4. Invite the bot to a server

    Discord won't let you DM a bot unless you share a server with it. 1. Go to OAuth2 → URL Generator and select the bot scope. 2. Under Bot Permissions, enable View Channels, Send Messages, Send Messages in Threads, Read Message History, Attach Files and Add Reactions. 3. Set the integration type to Guild Install. 4. Copy the Generated URL, open it, and add the bot to a server you're in.

  5. Install the plugin

    Run claude to start a session first, then install the plugin.

    bash
    /plugin install discord@claude-plugins-official
  6. Give the server the token

    This writes DISCORD_BOT_TOKEN=... to ~/.claude/channels/discord/.env. You can also write that file by hand or set the variable in your shell environment; the shell takes precedence.

    bash
    /discord:configure MTIz...
  7. Relaunch with the channel flag

    The server won't connect without this flag. Exit your session and start a new one.

    sh
    claude --channels plugin:discord@claude-plugins-official
  8. Pair

    With Claude Code running, DM your bot on Discord and it replies with a pairing code. Run the command below in your Claude Code session. After that, your next DM reaches the assistant.

    bash
    /discord:access pair <code>
  9. Lock it down

    Pairing is for capturing IDs. Once you're paired, switch to the allowlist policy so strangers don't get pairing-code replies. You can ask Claude to do it or run the command directly.

    bash
    /discord:access policy allowlist

هالبلغن بيوصل بوت ديسكورد بـ Claude Code عن طريق سيرفر MCP، فكل رسالة بتوصل للبوت بتنبعت لـ Claude. وClaude بيقدر يرد ويحط ريأكشن ويعدّل الرسايل، وكل هاد مع تحكّم بالوصول عن طريق الـ pairing والـ allowlist.

Examples

Install the plugin

Code
text
/plugin install discord@claude-plugins-official

What it does: Installs the Discord plugin from inside a Claude Code session.

Start Claude Code with the Discord channel

sh
sh
claude --channels plugin:discord@claude-plugins-official

What it does: Launches Claude Code with the Discord channel enabled. The MCP server won't connect without this flag.

Approve a pairing code

Code
text
/discord:access pair <code>

What it does: Pairs your Discord account using the code the bot sent you in DM, so your next messages reach the assistant.

Switch to allowlist policy

Code
text
/discord:access policy allowlist

What it does: Locks down access after pairing so strangers no longer receive pairing-code replies.