Claude Code のチャネルをローカル環境に設定する方法
本記事は、Claude Code Channels をローカル環境で設定し、Discord と連携させる具体的な手順と必要な前提条件を解説している。
キーポイント
Claude Code Channels の概要と特徴
重厚なエージェントフレームワークに代わる軽量な代替手段として、Claude をチャットプラットフォーム(Discord)に接続する機能であり、既存の Claude サブスクリプションで即座に動作する。
必須環境と前提条件
Claude Code のインストール、Pro または Max 契約の Claude.ai アカウント、Discord アカウントが必要であり、API キーのみでの認証は不可で、実際のログインセッションが必須である。
ローカル設定の実行手順
PowerShell を用いてインストールスクリプトを実行し、作業フォルダを作成して 'claude' コマンドを起動後、'/login' で認証を行うことでセットアップが完了する。
動作の制約事項
このボットはローカルで稼働している Claude Code セッションがアクティブな間のみ機能するため、常時稼働させるにはセッションの維持が必要である。
Bun のインストールと確認
Claude Code の公式チャンネルプラグインには Bun が必要であり、PowerShell スクリプトを使用してインストールし、バージョン確認コマンドで正常に完了したことを確認する必要があります。
プラグインマーケットプレイスの設定手順
Anthropic の公式マーケットプレイスを追加し、最新情報を取得した後、Discord プラグインをインストールして再読み込みを行うことで、一連の準備が完了します。
Discord Bot 設定と権限
Discord Developer Portal でボットを作成し、メッセージコンテンツ意図を有効にした上で、必要な権限(メッセージ送信、ファイル添付など)を付与してサーバーに招待する必要があります。
影響分析・編集コメントを表示
影響分析
この記事は、開発者や技術者が Claude の機能を既存のコミュニケーションツール(Discord)にシームレスに統合したい場合に、具体的な実装パスを提供する重要なガイドである。特に、重厚なインフラ構築を避けつつローカル制御性を維持できる点は、個人開発者や小規模チームにとって即戦力となる知見であり、AI ツールの活用範囲を広げる一助となる。
編集コメント
重厚なエージェントフレームワークの構築を避けつつ、Claude の能力を Discord で活用したい層にとって非常に実用的なチュートリアルです。ただし、ローカルセッションが常時稼働している必要があるという制約は、運用コストや安定性の観点で十分に考慮する必要があります。

# イントロダクション
Claude Code Channelsは、重厚なエージェントフレームワークを構築せずに Claude をチャットプラットフォームに接続したい人にとって、OpenClawの practical な代替手段として急速に普及しています。セットアップが簡単で、Claude のサブスクリプションがあればすぐに動作し、Discord を通じてローカルの Claude Code セッションと対話するための直感的な方法を提供します。
この記事では、Claude Code Channels をローカル環境で設定し、Discord サーバーに接続する方法を学びます。最初から理解しておくべき重要な点は、このセットアップには実行中のローカル Claude Code セッションが必要だということです。ボットは、そのセッションがあなたのマシン上でアクティブに実行されている間のみ機能します。
# 開始前に必要なもの
**
セットアップを始める前に、必ず以下の準備をしてください:
- Claude Code のインストール済み
- Pro または Max サブスクリプションを持つ Claude.ai アカウント
- Discord アカウントとデスクトップアプリケーション
また、Channels では Claude.ai へのログインが必要であり、API キーのみでの認証では動作しない点も知っておいてください。
注: このガイドではセットアップ手順とコマンドの例として Windows 11 をオペレーティングシステムとして使用していますが、Linux や macOS でも同様のプロセスを適用できます。
# Claude Code のインストールとサインイン
**
まず、PowerShell で Claude Code をインストールします:
irm https://claude.ai/install.ps1 | iex
次に、作業用フォルダを作成してその中に移動し、Claude Code を起動します:
mkdir my-channels
cd my-channels
claude
Claude Code が開いたら、Claude.ai アカウントでログインしてください:
/login
この手順は、Channels が機能するために必須です。

# Bun のインストールと Discord プラグインの追加
Claude Code の公式 Channels プラグインは Bun を使用しているため、次にこれをインストールしてください:
irm bun.sh/install.ps1 | iex
以下のコマンドでインストールが成功したか確認できます:
bun --version
その後、Claude Code 内で、以下のコマンドを順番に一つずつ実行してください。各コマンドは次のステップの準備を行うため、順序を飛ばさないことが重要です。
まず、公式プラグインマーケットプレイスを追加します:
/plugin marketplace add anthropics/claude-plugins-official
次に、マーケットプレイスを更新して、Claude Code が利用可能な最新のプラグインを取得できるようにします:
/plugin marketplace update claude-plugins-official
その後、公式の Discord プラグインをインストールします:
/plugin install discord@claude-plugins-official
最後に、プラグインを再読み込みして、新しくインストールした Discord 連携機能を現在の Claude Code セッションで使用可能にします:
/reload-plugins

これで、Claude Code は Discord チャンネル連携機能を使用する準備が整いました。
# Discord ボットの作成と設定
次に、Discord Developer Portal にアクセスして新しいアプリケーションを作成してください。そのアプリケーション内でBotセクションを開き、トークンをリセットして、安全な場所にコピーしておいてください。
また、メッセージコンテンツ権限(Message Content Intent)を有効にする必要があります。これを無効にすると、ボットはユーザーが送信したテキストを読み取ることができなくなります。
次に、OAuth2 URL Generatorを使用してボットの招待リンクを生成してください。必要な権限として以下のようなものを付与します:
- チャンネルの表示
- メッセージの送信
- スレッド内でのメッセージ送信
- メッセージ履歴の閲覧
- ファイルの添付
- リアクションの追加
- 音声メッセージの送信
生成されたリンクを使用して、ボットを Discord サーバーに招待してください。
**

# Claude Code と Discord の接続
Claude Code に戻り、ボットトークンを使用して Discord プラグインを構成してください:
/discord:configure YOUR_DISCORD_BOT_TOKEN
Claude Code は通常、このトークンを自動的に Channels 設定ディレクトリに保存します。
トークンの構成が完了したら、Channels を有効にして Claude Code を再起動してください:
claude --channels plugin:discord@claude-plugins-official
これにより、Discord Channels プラグインを有効にした状態で Claude Code が起動します。
Claude Code にツールを使用したり新しいアクションを実行するたびに許可を求めるのを避けたい場合は、代わりに自動承認フラグ(auto-approve flag)を指定して起動することもできます:
claude --dangerously-skip-permissions --channels plugin:discord@claude-plugins-official
これによりセッションがより自動化され、Discord の体験をスムーズにするのに役立ちます。ただし、環境を信頼し、Claude Code が毎回確認を求めることなく行動できることを理解している場合のみ、この機能を使用してください。
# Discord アカウントのペアリングと使用開始
Channels 機能を有効にして Claude Code を実行中になったら、Discord でボットにダイレクトメッセージを送信してください。すると、ペアリングコードが返信されます。
そのコードを取得し、Claude Code の内部に入力します:
/discord:access pair YOUR_PAIRING_CODE
その後、アクセスを承認されたユーザーのみに制限します:
/discord:access policy allowlist
これで、Discord でボットにメッセージを送信できるようになり、Claude Code がローカルセッションを通じて応答します。

# 最終的な注意点とトラブルシューティング
何かが期待通りに動作しない場合は、以下の項目で Claude Code Channels の最も一般的な問題と、それらを解決するための最速の方法を解説しています。
- ボットはオンライン状態ですが何も発言しません:Discord ボットの設定で「メッセージコンテンツの意図」を有効にしてください。これを無効にすると、ボットが空の内容しか受信できません。
- クロードが Discord に接続しない場合:Claude Code を
--channels plugin:discord@claude-plugins-officialフラグ付きで再起動してください。起動時に Channels が有効化されていないと、Discord プラグインは機能しません。 - 設定完了後にボットが応答しない場合:ペアリング手順を完了させてください。具体的には、ボットに DM を送信してペアリングコードをコピーし、Claude Code 内で
pairコマンドを実行します。 - DM が全く機能しない場合:Discord の仕様上、DM を利用するにはあなたの Discord アカウントとボットが同じサーバー内にいる必要がありますので、必ず確認してください。
- プラグインコマンドが表示されない場合:プラグインのインストールまたは更新後に
/reload-pluginsコマンドを実行し、現在のセッションで認識されるようにしてください。 - セッション再開後に返信が破綻する場合:現時点では
--resumeに依存しないようにしてください。最近の Claude Code の問題報告により、チャネルプラグインが再開後に正しく再起動しないケースが報告されています。 - クロードは聴取中と表示されるが何も届かない場合:
/mcpを確認して、Discord プラグインが実際に接続されているか確認してください。最近の報告では、Claude Code が準備完了に見えるにもかかわらず、起動時にプラグインが失敗する事例が確認されています。 - メッセージは届くのに Claude が応答しない場合:これは現在のチャネル通知バグの可能性が高いです。現時点での最も簡単な回避策はセッションを再起動することです。
- 「許可」または「拒否」のプロンプト後に返信が停止する場合:これは最近報告された Discord の権限リレーに関する問題です。発生した場合はセッションを再起動してください。
ターミナルを閉じた際にボットが動作しなくなっても、これは正常です。Claude Code Channels は、ローカルの Claude Code セッションが実行されている間のみ機能します。
Abid Ali Awan ** (@1abidaliawan) は機械学習モデルの構築を愛する認定データサイエンティストです。現在、彼は機械学習およびデータサイエンス技術に関するコンテンツ作成や技術ブログの執筆に注力しています。Abid はテクノロジー管理の修士号と電気通信工学の学士号を取得しており、そのビジョンは精神疾患で苦しむ学生向けにグラフニューラルネットワーク(Graph Neural Network)を用いた AI 製品を構築することです。
原文を表示

# Introduction
**
Claude Code Channels is quickly becoming a practical alternative to OpenClaw** for people who want to connect Claude to chat platforms without setting up a heavier agent framework. It is simpler to get running, works with a Claude subscription out of the box, and gives you a straightforward way to interact with a local Claude Code session through Discord.
In this article, you will learn how to set up Claude Code Channels locally and connect it to your Discord server. The key thing to understand from the start is that this setup depends on a live local Claude Code session. The bot only works while that session is actively running on your machine.
# What You Need Before You Start
**
Before setting everything up, make sure you have:
- Claude Code installed
- A Claude.ai account with a Pro or Max subscription
- A Discord account and the desktop application
You should also know that Channels requires a Claude.ai login** and does not work with API-key-only authentication.
Note: This guide uses Windows 11 as the operating system for the setup steps and commands, but the same overall process can also be followed on Linux and macOS.
# Installing Claude Code and Signing In
**
First, install Claude Code in PowerShell:
irm https://claude.ai/install.ps1 | iexThen create a working folder, move into it, and start Claude Code:
mkdir my-channels
cd my-channels
claudeOnce Claude Code opens, log in with your Claude.ai account:
/loginThis step is required before Channels will work.

# Installing Bun and Adding the Discord Plugin
Claude Code's official Channels plugins use Bun**, so install it next:
irm bun.sh/install.ps1 | iexYou can confirm the installation with:
bun --versionAfter that, inside Claude Code, run the following commands one by one in the same sequence. Each command prepares the next step, so it is important not to skip the order.
First, add the official plugin marketplace:
/plugin marketplace add anthropics/claude-plugins-officialNext, update the marketplace so Claude Code can fetch the latest available plugins:
/plugin marketplace update claude-plugins-officialThen install the official Discord plugin:
/plugin install discord@claude-plugins-officialFinally, reload plugins so the newly installed Discord integration becomes available in your current Claude Code session:
/reload-plugins
**
At this point, Claude Code is ready to use the Discord channel integration.
# Creating and Configuring Your Discord Bot
Now go to the Discord Developer Portal and create a new application. Inside that application, open the Bot** section, reset the token, and copy it somewhere safe.
You also need to enable Message Content Intent, because without it the bot will not be able to read the text people send.
Next, generate an invite link for the bot using the OAuth2 URL Generator. Give it the permissions it needs, such as:
- View Channels
- Send Messages
- Send Messages in Threads
- Read Message History
- Attach Files
- Add Reactions
- Send Voice Messages
Then use the generated link to add the bot to your Discord server.
**

# Connecting Claude Code to Discord
Go back to Claude Code and configure the Discord plugin using your bot token:
/discord:configure YOUR_DISCORD_BOT_TOKENClaude Code usually stores this token automatically in its Channels config directory.
After configuring the token, restart Claude Code with Channels enabled:
claude --channels plugin:discord@claude-plugins-officialThis starts Claude Code with the Discord Channels plugin turned on.
If you do not want Claude Code to ask for permission each time it needs to use a tool or take a new action, you can start it with the auto-approve flag instead:
claude --dangerously-skip-permissions --channels plugin:discord@claude-plugins-official
This makes the session more automatic, which can be useful for a smoother Discord experience. However, you should only use this if you trust the environment and understand that Claude Code will be allowed to act without asking for confirmation each time.
# Pairing Your Discord Account and Starting to Use It
Once Claude Code is running with Channels enabled, send your bot a direct message in Discord. It should reply with a pairing code.
Take that code and enter it inside Claude Code:
/discord:access pair YOUR_PAIRING_CODEThen lock access to approved users only:
/discord:access policy allowlistAfter that, you can message the bot in Discord and Claude Code will respond through your local session.

# Final Notes and Troubleshooting
If something is not working as expected, the points below cover the most common Claude Code Channels issues and the fastest ways to fix them.
- Bot is online but says nothing: Enable Message Content Intent in your Discord bot settings. Without it, the bot receives empty message content.
- Claude never connects to Discord: Restart Claude Code with the --channels plugin:discord@claude-plugins-official flag. The Discord plugin will not work unless Channels is enabled at launch.
- Bot does not answer after setup: Complete the pairing step by sending the bot a DM, copying the pairing code, and running the pair command inside Claude Code.
- DMs do not work at all: Make sure your Discord account and the bot are in the same server, since Discord requires that for direct messages to work.
- Plugin commands do not appear: Run /reload-plugins after installing or updating the plugin so the current session picks it up.
- Replies break after resuming a session: Avoid relying on --resume for now, because a recent Claude Code issue reports that channel plugins may not restart correctly after resume.
- Claude says it is listening, but nothing arrives: Check /mcp to confirm the Discord plugin is actually connected. Recent reports show cases where the plugin fails on startup even though Claude Code looks ready.
- Messages arrive but Claude stays idle: This may be a current channel notification bug. Restarting the session is the simplest workaround for now.
- Replies stop after an Allow or Deny prompt: This is a recently reported Discord permission relay issue. Restart the session if it happens.
If the bot stops working when you close the terminal, that is normal. Claude Code Channels only works while your local Claude Code session is still running.
Abid Ali Awan** (@1abidaliawan) is a certified data scientist professional who loves building machine learning models. Currently, he is focusing on content creation and writing technical blogs on machine learning and data science technologies. Abid holds a Master's degree in technology management and a bachelor's degree in telecommunication engineering. His vision is to build an AI product using a graph neural network for students struggling with mental illness.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み