Skip to main content
Glama

@devli13/mcp-discord

npm License: MIT

Discord用のMCPサーバーです。Claude Code、Paperclipエージェント、Gemini CLI、またはその他のMCP互換クライアントから、メッセージの送信、モデレーション、チャンネル管理、サーバーの調査を行うことができます。

純粋なRESTラッパーです。Gatewayは使用せず、データベースもありません。 Discordのv10 APIを26個の十分にドキュメント化されたツールとして提供し、ルートごとのレート制限と構造化されたエラー結果をサポートしています。


なぜこれが必要か

DiscordのAPIは広大で、生の curl で呼び出すにはエージェントにとって不親切です。エージェントはレート制限に抵触したり、429エラーを適切に処理できなかったり、監査ログの理由付けに失敗したり、ページネーションのカーソルを忘れたりします。このMCPはそれらを一度に解決するため、エージェントは「そのスパムメッセージを削除する」「#mod-logに日次ダイジェストを投稿する」「@userを1時間タイムアウトにする」といった意図に集中できます。

人間にとっても便利です。Claude Codeに接続すれば、「Discordの#devチャンネルの過去50件のメッセージを要約して」と言うだけで、Claudeがそれを実行してくれます。


Related MCP server: Discord Bridge MCP Server

インストール

npm install -g @devli13/mcp-discord

またはnpx経由(インストール不要):

DISCORD_BOT_TOKEN=<your-token> npx -y @devli13/mcp-discord

セットアップ

1. Discordボットの作成

  1. https://discord.com/developers/applications にアクセスし、New Application をクリックします。

  2. アプリケーションに Bot を追加します。

  3. ボットトークンをコピーします。これが DISCORD_BOT_TOKEN になります。

  4. OAuth2 URLジェネレーター(スコープ: bot)を使用して、ボットをサーバーに招待します。MCPに実行させたい操作(例:削除のための「メッセージの管理」、タイムアウトのための「メンバーのモデレーション」)に基づいて権限を選択してください。

2. MCPクライアントへの接続

Claude Code:

claude mcp add discord \
  --env DISCORD_BOT_TOKEN=<your-token> \
  -- npx -y @devli13/mcp-discord

Paperclip mcp-gateway (.mcp.json):

{
  "mcpServers": {
    "discord": {
      "command": "npx",
      "args": ["-y", "@devli13/mcp-discord"],
      "env": {
        "DISCORD_BOT_TOKEN": "<your-token>"
      }
    }
  }
}

Gemini CLI (~/.gemini/config.json):

{
  "mcpServers": {
    "discord": {
      "command": "npx",
      "args": ["-y", "@devli13/mcp-discord"]
    }
  }
}

3. (オプション)特権インテントの有効化

サーバーメンバーの一覧表示 (discord_list_members) を行いたい場合や、インバウンドイベント用のコンパニオンプラグインと併用する場合は、ボットのDeveloper Portal設定で Server Members Intent と Message Content Intent を有効にしてください。これらはほとんどのMCP操作には不要で、特定のエンドポイントでのみ必要となります。


ツールリファレンス

すべてのツールには discord_* というプレフィックスが付いており、JSONブロブ(成功時)またはフォーマットされたエラーメッセージ(失敗時)を返します。例外はスローされず、すべてのツールが使用可能な文字列結果を返します。

メッセージ (8)

ツール

目的

discord_send_message

チャンネルへの送信。埋め込み、返信、メンション制御をサポート

discord_edit_message

ボット自身のメッセージの編集

discord_delete_message

メッセージを1件削除(ボットまたは他者のメッセージ、「メッセージの管理」権限が必要)

discord_bulk_delete_messages

2〜100件のメッセージ(14日以内)を1回の呼び出しで削除

discord_get_message

IDでメッセージを1件取得

discord_list_messages

ページネーションされたチャンネル履歴(before/after/aroundカーソル)

discord_pin_message / discord_unpin_message

ピン留めの管理

リアクション (3)

ツール

目的

discord_add_reaction

ボットがリアクションを追加

discord_remove_reaction

ボットまたはユーザーのリアクションを削除

discord_get_reactions

特定の絵文字でリアクションしたユーザーの一覧

チャンネルとスレッド (5)

ツール

目的

discord_list_channels

ギルド内の全チャンネル

discord_get_channel

単一チャンネルの詳細

discord_create_thread

新しいスレッドを作成(公開または非公開、アンカー付きまたはスタンドアロン)

discord_list_active_threads

ギルド内の全アクティブスレッド

discord_send_typing

「ボットが入力中…」インジケーターをトリガー

モデレーション (6)

ツール

目的

discord_get_member

メンバープロフィール(ロール、参加日、タイムアウト状態)

discord_list_members

ページネーションされたメンバーリスト(Server Membersインテントが必要)

discord_timeout_user

communication_disabled_until を介したミュート(最大28日、0で解除)

discord_kick_user

ギルドから追放

discord_add_role / discord_remove_role

ロール管理

サーバー情報 (4)

ツール

目的

discord_list_guilds

ボットが参加している全ギルド

discord_get_guild

単一ギルドの詳細

discord_list_roles

全ロール(位置順)

discord_get_audit_log

最近の監査ログエントリ(ユーザー、アクションなどでフィルタリング)

含まれていない機能(意図的):

  • ban/unban — 意図的な制限です。DiscordのUIを使用してください。不可逆的なアクションはエージェントの呼び出し1回で実行されるべきではありません。

  • チャンネルの作成/削除/編集 — 影響範囲が大きいため、UIを使用してください。

  • Webhook CRUD — ほとんどのエージェントフローでは不要です。将来のリリースで追加する可能性があります。

  • 音声操作、スタンプ/絵文字管理 — v0.1のスコープ外です。


例: Claude Codeによるチャンネルの要約

User: Summarize the last 30 messages in the #dev channel of my Discord server, guild ID 1234...

Claude (calls discord_list_channels → finds #dev → calls discord_list_messages → writes summary)

例: Paperclipエージェントによる日次ダイジェスト

// From an agent's prompt:
"Post the daily digest to channel 1234. Summarize the last 24h of activity
using discord_list_messages with limit=100, then format as an embed via
discord_send_message."

エラーハンドリング

すべてのツールは使用可能なテキスト結果を返します。エラー発生時:

Error (DISCORD_50001, HTTP 403): Missing Access
Details: [...]
(This error is transient and may succeed on retry.)

MCPは、429(レート制限)および5xx(サーバーエラー)に対する再試行を、指数バックオフを用いて内部的に処理します。


レート制限

Discordには2つのレート制限レイヤーがあります:

  1. ルートごと — 各APIエンドポイントは独立したバケットを持っています。このMCPは、429エラーを回避するために(メソッド + ルートテンプレート)ごとにリクエストをシリアル化します。

  2. グローバル — ボットごと、全エンドポイント共通。MCPはグローバルに Retry-After ヘッダーを尊重します。

これについて意識する必要はありません。もしグローバル制限に繰り返し抵触する場合は、人間が介入すべき操作を行っている可能性が高いです。


セキュリティ

  • ボットトークンをコミットしないでください。 このMCPは起動時に DISCORD_BOT_TOKEN 環境変数から読み取ります。

  • 最小権限の招待URLを使用してください。 「メッセージの管理」だけで十分な場合に、ボットに「管理者」権限を与えないでください。

  • 監査ログの理由 — すべてのモデレーションツールは、Discordの監査ログに表示される reason 引数を受け付けます。活用してください。


開発

git clone https://github.com/devli13/mcp-discord.git
cd mcp-discord
npm install
npm test           # smoke tests (no live Discord calls)
npm run lint       # syntax check all files
npm start          # boot server over stdio (needs DISCORD_BOT_TOKEN)

コンパニオンプロジェクト — インバウンドイベント

このMCPはアウトバウンドのREST呼び出し(送信、削除、モデレーション)を処理します。Discord Gateway WebSocketを保持しないため、インバウンドイベント(ボットへの@メンション、DM、新規メンバーの参加など)には反応できません。

Paperclip環境でDiscordのインバウンドイベントを処理するには、@devli13/paperclip-plugin-discord を使用してください。これは @mvanhorn/paperclip-plugin-discord のフォークであり、自由形式の@メンションルーティング、DMサポート、コンテキストごとのシリアル化されたメッセージキュー、ダウンタイム時のメンションバックフィル機能を備えています。

これら2つのプロジェクトは連携するように設計されています。プラグインがイベントを受信してエージェントを呼び出し、エージェントがこのMCPを使用して応答やモデレーションを行います。セットアップに応じて、どちらか一方または両方を使用してください。

帰属表示

ATTRIBUTION.md を参照してください。要約: @mvanhorn による paperclip-plugin-discord のフォークと並行して構築されました。そのGateway処理がここでの設計パターンのインスピレーションとなっています。

ライセンス

MIT — LICENSE を参照してください。

Available Tools

26 tools
discord_add_reactionA

Add a reaction from the bot to a message. Emoji can be a unicode glyph (e.g. "👍") or custom-emoji string ("name:id"). Requires Add Reactions + Read Message History.

Inputs: channel_id (required), message_id (required), emoji (required).

discord_add_roleA

Add a role to a guild member. Requires Manage Roles and the target role must be below the bot's highest role.

Inputs: guild_id (required), user_id (required), role_id (required), reason.

discord_bulk_delete_messagesA

Bulk delete 2-100 messages from a channel. All messages must be less than 14 days old. Useful for raid cleanup. Requires Manage Messages permission.

Inputs: channel_id (required), message_ids (required), reason.

discord_create_threadA

Create a thread. If message_id is provided, creates a thread from that message; otherwise creates a standalone thread in the channel. auto_archive_duration is in minutes: 60, 1440, 4320, or 10080.

Inputs: channel_id (required), name (required), message_id, auto_archive_duration, +2 more.

discord_delete_messageA

Delete a single message. Requires Manage Messages for other users' messages; bot can always delete its own.

Inputs: channel_id (required), message_id (required), reason.

discord_edit_messageA

Edit a message the bot previously sent. Can edit content and embeds. Cannot edit other users' messages.

Inputs: channel_id (required), message_id (required), content, embeds.

discord_get_audit_logA

Fetch recent audit log entries. Filter by action_type (Discord AuditLogEvent enum integer) and/or user_id. Requires View Audit Log permission.

Inputs: guild_id (required), user_id, action_type, before, +1 more.

discord_get_channelB

Fetch details about a single channel — name, type, permission overwrites, parent category, rate limit, etc.

Inputs: channel_id (required).

discord_get_guildC

Fetch details for a single guild — name, icon, owner, member count, features, etc.

Inputs: guild_id (required), with_counts.

discord_get_memberC

Fetch a guild member — nickname, joined_at, roles, communication_disabled_until (timeout), etc.

Inputs: guild_id (required), user_id (required).

discord_get_messageB

Fetch a single message by ID. Useful for reading context before acting.

Inputs: channel_id (required), message_id (required).

discord_get_reactionsA

List users who reacted with a specific emoji on a message. Paginated (default 25, max 100).

Inputs: channel_id (required), message_id (required), emoji (required), limit, +1 more.

discord_kick_userA

Remove a user from the guild. They can rejoin via invite. Requires Kick Members permission.

Inputs: guild_id (required), user_id (required), reason.

discord_list_active_threadsA

List all active (non-archived) threads in a guild.

Inputs: guild_id (required).

discord_list_channelsB

List all channels in a guild (server). Includes text, voice, category, thread channels.

Inputs: guild_id (required).

discord_list_guildsA

List all guilds (servers) the bot is a member of. Useful for multi-server setups.

Inputs: limit.

discord_list_membersA

List members of a guild. Paginate with after cursor (last user ID). Requires the Server Members privileged intent on the bot.

Inputs: guild_id (required), limit, after.

discord_list_messagesA

Fetch recent messages from a channel. Paginate with before/after/around cursors. Default limit is 50, max 100.

Inputs: channel_id (required), limit, before, after, +1 more.

discord_list_rolesA

List all roles in a guild. Returns role objects sorted by position (highest first).

Inputs: guild_id (required).

discord_pin_messageA

Pin a message in a channel. Requires Manage Messages. Channels max 50 pinned messages.

Inputs: channel_id (required), message_id (required), reason.

discord_remove_reactionA

Remove a reaction. Without user_id, removes the bot's own reaction. With user_id, removes a specific user's reaction (requires Manage Messages).

Inputs: channel_id (required), message_id (required), emoji (required), user_id.

discord_remove_roleC

Remove a role from a guild member.

Inputs: guild_id (required), user_id (required), role_id (required), reason.

discord_send_messageA

Send a new message to a Discord channel. Supports plain text, embeds, replies, and allowed_mentions control. Returns the created message object including its ID.

Inputs: channel_id (required), content, embeds, reply_to_message_id, +2 more.

discord_send_typingA

Trigger the "bot is typing…" indicator in a channel for about 10 seconds. Useful before sending a long-form response so users know the bot is working.

Inputs: channel_id (required).

discord_timeout_userA

Timeout a user — they cannot send messages, react, or join voice. Up to 28 days. Pass duration_seconds=0 to remove an existing timeout. Requires Moderate Members permission.

Inputs: guild_id (required), user_id (required), duration_seconds (required), reason.

discord_unpin_messageC

Unpin a previously pinned message.

Inputs: channel_id (required), message_id (required), reason.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 26 tools

    Disambiguation4/5

    Most tools have distinct purposes targeting specific Discord resources and actions, such as send_message vs. edit_message or kick_user vs. timeout_user. However, some overlap exists: add_reaction and remove_reaction are clear, but get_reactions could be confused with list_messages for reading message content, and list_active_threads vs. create_thread might cause minor ambiguity in thread management scenarios.

    Naming Consistency5/5

    All tools follow a consistent snake_case naming pattern with a clear verb_noun structure, such as discord_send_message, discord_get_channel, and discord_list_members. The naming is predictable and uniform across all 26 tools, making it easy for agents to understand and select the appropriate tool.

    Tool Count3/5

    With 26 tools, the count is on the higher side for a Discord bot server, which may feel heavy and potentially overwhelming for agents. While Discord's API is feature-rich, this many tools could lead to decision paralysis or misselection, though it does cover a broad range of functionalities from messaging to moderation.

    Completeness4/5

    The tool set provides comprehensive coverage for core Discord bot operations, including CRUD for messages, roles, and members, as well as moderation actions like kick and timeout. Minor gaps exist, such as no tools for editing roles or managing invites, but agents can still handle most common workflows effectively without significant dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that allows Claude to interact with Discord by providing tools for sending/reading messages and managing server resources through Discord's API.
      19
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An MCP server that provides native Discord tools for Claude Code, enabling bidirectional communication with remote agents or humans via the Discord REST API. It allows users to send messages, read channel history, and manage reactions directly from their local environment.
      6
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Comprehensive Discord MCP server with 66 tools that provides rich message context including emoji reactions, thread indicators, and attachment metadata inline. Enables AI assistants to interact with Discord servers for messaging, moderation, roles, channels, and more.
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A comprehensive Discord MCP server enabling AI assistants to run a Discord community through 111 tools for messaging, moderation, roles, channels, forums, webhooks, and more, plus a raw REST API passthrough for full Discord API access.
      MIT