Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

How to Connect Claude Code to Discord Safely with Channels

Set up the Claude Code Discord channel plugin, pair an account, enforce an allowlist, minimize bot permissions, and troubleshoot the connection without disabling safeguards.

Table of Contents

Claude Code's Discord channel plugin forwards bot messages to a running Claude Code session and lets that session reply, react and edit its own Discord messages. This creates a convenient remote interface, but it also gives approved Discord users a path to a coding agent that can read project files and request tool actions.

Use a dedicated bot, a restricted project directory and Claude Code's normal permission prompts. Do not run this integration with --dangerously-skip-permissions.

Requirements

  • The latest Claude Code release, signed in with a supported Claude.ai subscription rather than API-key-only authentication
  • Bun, which runs the Discord plugin's MCP server
  • A Discord account and permission to install a bot in a server
  • A dedicated test repository that contains no production credentials or unrelated private files

Channels and the Discord plugin are evolving features. Check the current plugin README for changed requirements and commands before setup.

1. Install and sign in to Claude Code

Use Anthropic's current installer for your operating system. On Windows PowerShell, the documented command is:

irm https://claude.ai/install.ps1 | iex

Open the intended project directory and start Claude Code:

cd restricted-project
claude

If sign-in is required, run /login inside Claude Code and complete browser authentication. Do not switch to API-key authentication for this channel session.

2. Install Bun

Install Bun from its official instructions, restart the terminal if needed, and verify that it is available:

bun --version

If the command is not found, reopen the shell and confirm that the Bun installation directory is on PATH.

3. Install the Discord plugin

Inside Claude Code, run:

/plugin install discord@claude-plugins-official
/reload-plugins

If the plugin cannot be found, open /plugin, refresh the official marketplace and confirm that the package name has not changed. Treat marketplace packages as executable code: review the publisher and current plugin documentation before installing or updating.

4. Create a Discord application and bot

  1. Open the Discord Developer Portal and choose New Application.
  2. Open Bot, create or reset the token, and copy it once.
  3. Store the token in a password manager until configuration is complete. Never paste it into chat, source control, screenshots or issue reports.
  4. Under Privileged Gateway Intents, enable Message Content Intent so the bot can receive message text.

If a token is exposed, reset it immediately in the Developer Portal. A Discord bot token is a credential, not an application ID.

5. Invite the bot with minimum permissions

In OAuth2 > URL Generator, select the bot scope and Guild Install. For the plugin's documented server features, grant only:

  • View Channels
  • Send Messages
  • Send Messages in Threads
  • Read Message History
  • Attach Files
  • Add Reactions

For DM-only use, the bot technically does not need guild channel permissions, but it must share a server with you before Discord allows a direct message. Do not grant Administrator.

6. Configure the bot token

Back in Claude Code, run the plugin command with the token:

/discord:configure YOUR_BOT_TOKEN

The plugin stores it as DISCORD_BOT_TOKEN under ~/.claude/channels/discord/.env. Restrict access to your user account and do not copy this file into a project repository.

7. Start Claude Code with the Discord channel

Exit the current session, return to the restricted project directory and launch:

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

The terminal must remain running. If the session stops, the bot can no longer forward messages.

8. Pair your Discord account

  1. Send the bot a direct message. It should reply with a short pairing code.
  2. In the running Claude Code session, approve that code:
/discord:access pair PAIRING_CODE

Verify that the displayed Discord account is yours before approval.

9. Lock access to the allowlist

Pairing is a temporary enrollment state, not a permanent policy. After every intended user has been added, run:

/discord:access policy allowlist

Review the allowed Discord user IDs. If the bot is added to a guild channel later, opt in only the specific channel needed; do not expose it server-wide by default.

10. Test without disabling safeguards

Begin with a read-only request such as asking Claude Code to summarize the repository structure. Then test a harmless edit in a disposable branch. Tool or file actions may pause until you approve them in the terminal; that is expected and protects the machine from an untrusted or mistaken remote request.

Security checklist

  • Keep Claude Code in a dedicated repository with least-privilege filesystem and network access.
  • Leave manual approvals enabled for commands, edits and external access.
  • Use a dedicated Discord bot and private test server.
  • Keep the DM policy on allowlist after pairing.
  • Do not let Discord messages supply secrets, shell commands or unreviewed files.
  • Review attachments and quoted content for prompt-injection attempts.
  • Stop the Claude Code session when remote access is no longer needed.
  • Rotate the bot token and remove the bot from the server when retiring the setup.

Troubleshooting

  • “Channels are not currently available”: update Claude Code, confirm Claude.ai account authentication and check current plan/platform availability.
  • Bot is offline: verify that the terminal is still running with the --channels flag and that Bun is available.
  • No message content: enable Message Content Intent, then restart the channel session.
  • No pairing code: confirm the bot shares a server with your Discord account and inspect the Claude Code terminal for plugin errors.
  • Plugin command is missing: reload plugins or start a fresh Claude Code session.
  • Permission request appears stuck: return to the terminal and approve or reject it; do not bypass the permission system to make the bot appear more responsive.
Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.