discord-mcp
Provides read-only tools to search message history in allowed Discord channels and threads by text query, with optional time bounds and pagination, and to retrieve the messages surrounding a copied message URL for context.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@discord-mcp Find '公開日' in channel 222 and show context around the latest match."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
discord-mcp
Codex から Discord の指定チャンネルやスレッドを検索し、元発言のリンクをたどって前後を読める、読み取り専用のローカル MCP サーバーです。Python の公式 MCP SDK と stdio を使います。履歴の照合はローカルプロセスで行い、Codex に渡す発言数と本文の長さを制限します。
Discord Bot の準備
Discord Developer Portal で Application を作り、Bot ページでトークンを発行します。同じページの Message Content Intent を有効にします。通常の会話の本文を取得するために必要です。
Guild Install の OAuth2 スコープで
botを選び、自分が管理できるサーバーにインストールします。対象のテキストチャンネルで Bot の実効権限を View Channel と Read Message History に絞ります。ロールや@everyoneから継承する権限も確認してください。プライベートスレッドは Bot をメンバーに追加します。Discord のユーザー設定で開発者モードを有効にし、対象チャンネルまたはスレッドの ID をコピーします。スレッドを読むにはそのスレッド自体の ID を登録します。フォーラム投稿には投稿のスレッド ID を使います。
この MCP はメッセージを取得するときだけ Discord REST API に接続します。ローカルに履歴を保存する機能はありません。検索結果や前後の本文は接続した Codex に渡ります。
Related MCP server: mcp-discord
Codex で使う
uv と Git を用意します。Codex を起動する環境に次の変数を設定してください。
環境変数 | 値 |
| Bot ページで発行したトークン本体 |
| 許可するチャンネル・スレッドの ID をカンマで区切ったもの |
例えば zsh では次のように入力します。トークンの入力は画面に表示されず、シェル履歴にも入りません。
read -rs 'DISCORD_BOT_TOKEN?Discord Bot token: ' && echo
export DISCORD_BOT_TOKEN
read 'DISCORD_CHANNEL_IDS?Allowed channel/thread IDs: '
export DISCORD_CHANNEL_IDS~/.codex/config.toml に以下を追加します。uvx が公開タグからパッケージを取得して起動します。初回は依存関係のダウンロードがあるため、起動の待ち時間を長めに設定しています。
[mcp_servers.discord]
command = "uvx"
args = ["--from", "git+https://github.com/etak64n/discord-mcp.git@v0.1.0", "discord-mcp"]
env_vars = ["DISCORD_BOT_TOKEN", "DISCORD_CHANNEL_IDS"]
startup_timeout_sec = 120同じシェルで codex を起動し、/mcp で find_messages と read_context を確認します。Codex から uvx が見つからない場合は command -v uvx の出力を command に指定してください。Codex の MCP 設定
利用例(ID は架空):
チャンネル 222 の直近100件から「公開日」を探して。最新の該当発言の前後2件を読み、決まったことを元発言リンク付きで教えて。
ツール
ツール | 入力 | 初期値と上限 |
|
| 調査件数 |
|
|
|
検索は指定先の表示可能な履歴を新しい順に調べ、大文字・小文字を区別せず本文の部分一致を探します。対象は本文のみです。長い本文でも該当箇所が抜粋に入ります。各結果に投稿者名、日時、本文の省略有無、元発言の URL が含まれます。
scanned は実際に照合した件数、newest_at と oldest_at はその範囲です。stop の読み方は次のとおりです。
| 意味 |
| 結果件数または調査件数の上限に到達。返された |
| 指定した期間・カーソルの境界に到達。 |
| Discord がこの範囲の履歴を返し終えました。履歴閲覧権限が不足していても空の結果になることがあります。 |
empty_text は調査したうち本文が空だった件数です。添付のみの発言などでも増えます。通常の発言まで空になる場合は Message Content Intent を確認してください。
前後取得は同じチャンネルまたはスレッドの発言を古い順に返します。anchor_index は元発言の位置(0始まり)、more_before と more_after は返した範囲の外側に発言を確認できたかを表します。
開発と検証
uv run --locked python -m unittest discover -s tests -vテストは架空の履歴、模擬 HTTP 応答、実際の stdio クライアントを使用します。Discord の認証情報は不要です。実サーバーでの確認は、設定後に許可したチャンネルの既知の発言を検索し、返された URL と前後の本文を照合してください。
Available Tools
2 toolsfind_messagesARead-onlyIdempotent
Search literal text, case-insensitively, newest first in one channel/thread. since is inclusive and until exclusive (ISO 8601 with timezone). Continue with next_before_id as before_id and the same filters. chars bounds each excerpt.
Inputs: query (required), channel_id (required), chars, limit, +4 more.
read_contextBRead-onlyIdempotent
Read a guild message and its immediate neighbors in chronological order. Supply the canonical Discord message URL. anchor_index is zero-based.
Inputs: message_url (required), after, chars, before.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
find_messages is a text search over a channel/thread, while read_context reads a neighborhood around a specific message URL; the purposes are largely distinct. There is mild overlap since both read messages, but the descriptions make the boundary clear.
Both tools follow a clean verb_noun pattern (find_messages, read_context) in snake_case with no deviation. Names are predictable and readable.
Only two tools for a Discord server is very thin; the surface covers just two narrow read operations. It feels like a partial slice of a much larger intended toolset.
There is no way to send or edit messages, list channels/guilds/threads, or fetch reactions, and no pagination/list primitive beyond next_before_id. Agents will hit dead ends for any write or discovery workflow.
Maintenance
Related MCP Connectors
Read Discord channels, threads and message history from an AI assistant via a read-only bot.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Discord MCP server for ChatGPT, Claude and any AI agent: list servers and channels, read channel messages, search messages, send message, reply to message, send DM, read mentions and assign role in your own Discord account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Discord yourself; Cotlet does not store your password and you need no Discord API key. About the official Discord API: Yes, Discord has an official API for bots and OAuth2 apps, but it acts as a bot that a server manager adds, not as you, and Discord has no official MCP server for it (checked 5 Nov 2026). The MCP server on Discord's docs site only searches documentation. Setup and FAQ: https://cotlet.dev/integrations/discord-api-mcp-server
Real-time YouTube transcripts, comments, channels & video search MCP. Local npx or hosted OAuth.
Related MCP Servers
- AlicenseAqualityDmaintenanceRead-only MCP server for finding Discord messages. It enables searching guild messages, locating messages from jump URLs, and reading context around results.71MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables searching Discord messages using Discord's native search API. Designed for use with Claude Code to find project decisions and communications in Discord.MIT
- FlicenseNot gradedqualityCmaintenanceEnables local AI agents to securely search and read Discord messages and channels visible to the current client, without requiring a bot or user token.-
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to read a Discord server’s text history through per-member Discord OAuth approval, with read-only channel, thread, message retrieval, and bounded search tools that enforce current member and bot permissions on every read.MIT