discord-mcp
This server provides a bot-token-based interface to interact with the Discord REST API, enabling programmatic access to Discord guilds, channels, and messages. It does not support real-time message listening or replies without the optional companion reply bot.
Verify Bot Token (
verify): Confirm the bot token is valid and retrieve the bot's user info (id, username, discriminator, flags, etc.).List Guilds (
list_guilds): Retrieve all Discord servers the bot is a member of, with pagination vialimitandbeforecursor.Get Guild (
get_guild): Fetch detailed information about a specific guild by its ID.List Guild Channels (
list_guild_channels): List all channels in a guild (text, voice, categories, etc.).Get Channel (
get_channel): Retrieve details about a specific channel by its ID.List Channel Messages (
list_channel_messages): Fetch recent messages from a channel (newest first), with pagination usingbefore/aftermessage IDs and a configurablelimit(1–100). Requires Read Message History permission.Create Channel Message (
create_channel_message): Send a text message (up to 2000 characters) to a channel. Requires Send Messages permission.
For DM or @mention replies, you can optionally run the companion reply-bot, which forwards messages to an LLM backend and posts responses back to Discord.
Provides tools to interact with the Discord REST API, including listing guilds, channels, messages, and sending messages, as well as an optional reply bot for automatic responses.
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 list my Discord guilds"
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
MCP server that wraps a subset of the Discord REST API v10 using a bot token.
Security
Never commit the bot token. Pass
DISCORD_BOT_TOKENonly via your MCP clientenvblock (seeexamples/).If a token was pasted into chat or committed anywhere, reset it in the Discord Developer Portal and use the new token locally.
Related MCP server: discord-mcp
Tools
Tool | Description |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gateway intents (Presence, Server Members, Message Content) apply to the Gateway websocket. This MCP uses HTTP only; channel permissions still apply (e.g. Read Message History, Send Messages).
OpenClaw 公式の Discord(推奨)
OpenClaw と Discord をつなぐ正式な方法は、Gateway の channels.discord です。Bot トークンと openclaw config patch だけで Gateway が Discord に接続し、DM・サーバーでエージェントが応答します。手順は Discord — OpenClaw をそのまま実行してください。サンプルパッチは ../openclaw-mcp/examples/discord_channel.patch.json5 を参照。
同じ
DISCORD_BOT_TOKENで、下記のreply-bot(別プロセス)と同時に動かさないでください。WebSocket が二重になり競合します。HTTP の
/v1/chat/completions経由で返したい場合だけ、従来どおり reply-bot を使います(別経路)。
公式 Discord のみ使う: VM から discord-mcp(reply-bot)を削除する
OpenClaw の channels.discord だけ運用するなら、ゲスト上の clone + Docker / reply-bot は不要です。次で止めて消して構いません(パスは環境に合わせて読み替え)。
# ゲスト SSH 内
cd /root/discord-mcp # または clone したディレクトリ(例: ~/discord-mcp)
COMPOSE_PROFILES=prod docker compose down
docker rm -f discord-reply-bot 2>/dev/null || true
docker rmi discord-reply-bot:latest 2>/dev/null || true
cd .. && rm -rf discord-mcpOpenClaw Gateway(openclaw gateway / systemd)はそのまま。DISCORD_BOT_TOKEN は Gateway の環境(例: ~/.openclaw/.env)に残し、公式手順の config patch だけで Discord に接続します。
Reply bot(補助: HTTP で OpenClaw に転送)
The MCP alone cannot listen for messages. For DMs and @mentions (and replies to the bot when Discord fills the reference), run the optional Gateway bot:
In the Developer Portal → your app → Bot, enable Message Content Intent (Privileged Gateway Intents).
Install extras and start the process (keep this terminal open, or run under
tmux/ a process manager):
cd projects/discord-mcp
source .venv/bin/activate
pip install -e ".[reply-bot]"
export DISCORD_BOT_TOKEN='…' # same token as MCP
python -m discord_mcp.reply_bot
# or: discord-reply-botuvx のデフォルトでは reply-bot 用の discord.py は入りません。リポジトリを clone しない場合は例えば次でも可です。
pip install "discord-mcp[reply-bot] @ git+https://github.com/taka392/discord-mcp.git"
DISCORD_BOT_TOKEN='…' discord-reply-botBehavior:
既定は OpenClaw のみです。
OPENCLAW_GATEWAY_URLとOPENCLAW_GATEWAY_TOKEN(またはOPENCLAW_GATEWAY_PASSWORD)をdiscord-reply-botに渡すと、OpenClaw Gateway のPOST /v1/chat/completionsにユーザ文を送り、アシスタント本文を Discord に返信します。Cursor ゲートウェイには送りません(.envにCURSOR_AGENT_GATEWAY_URLが残っていても無視されます)。Gateway で
gateway.http.endpoints.chatCompletions.enabledを有効にしてください(無効だと HTTP 404 などになります)。主な環境変数:
OPENCLAW_GATEWAY_URL,OPENCLAW_GATEWAY_TOKEN, 任意でOPENCLAW_CHAT_MODEL(未指定時はgoogle/gemini-3.1-pro-preview)、OPENCLAW_SESSION_USER(未設定時はdiscord:<Discord ユーザー ID>)、OPENCLAW_MESSAGE_CHANNEL(既定discord)、OPENCLAW_SESSION_KEY,OPENCLAW_MODEL_HEADER,OPENCLAW_PROMPT_PREFIX,OPENCLAW_GATEWAY_TIMEOUT_SEC。Gemini を使うには Gateway 側に Google プロバイダの認証(GEMINI_API_KEY等)が必要です。Cursor の
mcp.jsonのopenclawのOPENCLAW_GATEWAY_TOKEN(または PASSWORD)を reply-bot の.envに同じ値で渡してください。URL は OpenClaw と同じホストならhttp://127.0.0.1:<gateway-port>(Mac の MCP が使う Tailscale URL と同じである必要はありません)。OpenClaw が未設定のときは、DM/メンションでも 設定不足の説明が返ります(旧来の短文エコーはしません)。
Cursor の HTTP ゲートウェイだけ使う場合(
cursor-cli-homelabを別ホスト/別 composeで動かしているとき):.envにDISCORD_LLM_BACKEND=cursorと、到達可能なCURSOR_AGENT_GATEWAY_URL(例:http://192.168.x.x:9888)を書いてください。**POST /v1/prompt** でagent -p` の標準出力を返します。ゲートウェイ側に
CURSOR_API_KEY、任意でAGENT_APPROVE_MCPS=trueなど。リポジトリ付属のdocker composeには agent-gateway は含みません(agent_gateway/は手動同期用の参照実装のまま残しています)。
DM と サーバー(@またはボットへの返信) の両方で上記のいずれかが使われます。
Discord の本文に含まれる <@…> 形式のメンションは、LLM に渡す前にプレースホルダへ置き換えます(モデルが「ユーザーIDは解決できない」と返すのを防ぐため)。
Docker(reply-bot を OpenClaw と同一 VM で動かす場合のみ・任意)
channels.discord だけで足りるなら VM に置く必要はありません(上の「VM から削除する」を参照)。docker compose は discord-reply-bot の 1 サービスのみです。OpenClaw Gateway 本体は 含みません(ホスト上の openclaw gateway / systemd と同居させます)。
network_mode: hostのため、.envのOPENCLAW_GATEWAY_URLはhttp://127.0.0.1:<port>(例:http://127.0.0.1:18789)。ポートはその VM で Gateway が待ち受けているものに合わせる。Mac で
docker compose upだけだとコンテナは立ちません(profileprod)。誤実行でリソースを食わないため。本番 VMでは
.envのCOMPOSE_PROFILES=prod(.env.exampleに同梱)か、./scripts/homelab_docker_up.sh。ローカル試験のみ:
COMPOSE_PROFILES=prod docker compose up -d --build(Linux が前提。Docker Desktop の挙動は環境による)。必須:
.envにDISCORD_BOT_TOKENとOPENCLAW_GATEWAY_URL(ループバック) /OPENCLAW_GATEWAY_TOKEN(またはPASSWORD)。Cursor 経路に切り替えるときだけ
.envにDISCORD_LLM_BACKEND=cursorと、到達可能なCURSOR_AGENT_GATEWAY_URL。DISCORD_BOT_TOKEN・OPENCLAW_GATEWAY_TOKENは Git に載せないこと。
旧構成(別 VM に Discord ボットだけ置く)をやめた場合: もう使わない VM 上で docker compose down のうえ、コンテナ/compose を削除してください。Tailscale 越し URL は不要になるため、.env の OPENCLAW_GATEWAY_URL はループバックに統一します。
ゲスト(OpenClaw VM)での手順例:
git clone https://github.com/taka392/discord-mcp.git
cd discord-mcp
./scripts/homelab_docker_up.sh
# 初回は .env が無いので .env.example がコピーされる → DISCORD_BOT_TOKEN と OPENCLAW_* を編集して再度手動でも同じです。
cp .env.example .env
# DISCORD_BOT_TOKEN, OPENCLAW_GATEWAY_URL=http://127.0.0.1:18789, OPENCLAW_GATEWAY_TOKEN
COMPOSE_PROFILES=prod docker compose up -d --build
docker compose logs -f停止・更新:
COMPOSE_PROFILES=prod docker compose down
COMPOSE_PROFILES=prod docker compose up -d --buildrestart: unless-stopped なのでゲスト再起動後もコンテナが戻る(Docker が起動時に有効な前提)。
Proxmox QEMU VM(ゲストエージェント)
OpenClaw Gateway を動かしている QEMU VM(Discord 専用 VM など 別 vmid ではない)に discord-mcp を clone し、Mac から .env を流し込んで docker compose まで実行します。
~/.cursor/mcp.jsonにmcpServers.discord.env.DISCORD_BOT_TOKENとopenclawのトークン(またはパスワード)を用意する。proxmox-mcpと同じPROXMOX_*をシェルにエクスポートする。--vmidには その OpenClaw ホストの vmid を渡す。毎回省略したい場合はexport OPENCLAW_QEMU_VMID=<vmid>。Gateway ポートが 18789 でないときは
OPENCLAW_GATEWAY_LOCAL_URLまたは--local-gateway-urlを指定。
cd projects/discord-mcp
export PROXMOX_BASE_URL=... PROXMOX_TOKEN_ID=... PROXMOX_TOKEN_SECRET=... PROXMOX_VERIFY_TLS=false
export OPENCLAW_QEMU_VMID=101 # OpenClaw が乗っている VM(例。100 とは限らない)
python3 scripts/push_gateway_env_guest_exec.py --vmid 101
# 例: python3 scripts/push_gateway_env_guest_exec.py --vmid 101 --repo-dir /root/discord-mcp --local-gateway-url http://127.0.0.1:18789Mac から OpenClaw VM へ SSH でデプロイ
scripts/deploy_remote.sh は リモートで git pull → scp で .env → homelab_docker_up.sh まで行います。生成する OPENCLAW_GATEWAY_URL はデフォルトで http://127.0.0.1:18789(OPENCLAW_GATEWAY_LOCAL_URL で変更可)。Gateway が別ホストのときは export DISCORD_USE_MCP_GATEWAY_URL=1 とすると mcp.json の OPENCLAW_GATEWAY_URL を書き込みます。
cd /path/to/discord-mcp
export HOMELAB_SSH='root@<OpenClaw-VM の IP or tailscale>'
# optional: export OPENCLAW_GATEWAY_LOCAL_URL='http://127.0.0.1:18789'
# optional: export DISCORD_USE_MCP_GATEWAY_URL=1 # Gateway が別マシン(MCP の URL を .env に)
# optional: export HOMELAB_REPO_DIR='/root/discord-mcp'
./scripts/deploy_remote.sh注意: DISCORD_BOT_TOKEN だけ export したモードでは、リモート .env にトークンとループバック URLだけ入り OPENCLAW_GATEWAY_TOKEN は手で追記してください。
Discord から 「ゲートウェイが利用できません (503)」 は DISCORD_LLM_BACKEND=cursor かつ CURSOR_API_KEY 未設定なときに出やすいです(Cursor 経路)。
OpenClaw 既定では、同一 VM 上で Gateway が待ち受けているか(ss -tlnp 等)、OPENCLAW_GATEWAY_URL / トークン、Gateway の chat completions 有効化を確認してください。
127.0.0.1:18789 に接続できない と出るときの整理:
**
127.0.0.1は「そのプロセスが動いているマシン自身」**です。Discord ボットが VM100 など別ホストで動いていて、OpenClaw が VM105 だけなら、.envのhttp://127.0.0.1:18789は VM100 の自分自身 を指し、OpenClaw には届きません。ボットも OpenClaw も VM105 に置くなら、同じゲストで
OPENCLAW_GATEWAY_URL=http://127.0.0.1:18789が正しく、VM105 上でss -tlnp | grep 18789に Gateway が見える必要があります。ボットだけ別 VM のままにするなら、
.envはhttp://<VM105 の tailscale IPv4>:18789(105 上でtailscale ip -4)か、mcp.json の HTTPS の Gateway URL(push_gateway_env_guest_exec.py --use-mcp-gateway-url)にしてください。VM105 に
discord-mcpを clone して compose する場合、ゲストに Docker(と compose プラグイン) が必要です。無いとdocker: command not foundで失敗します。
Local check
cd projects/discord-mcp
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
DISCORD_BOT_TOKEN='your token' python -m discord_mcp.checkCursor registration
After publishing to GitHub, merge the snippet from examples/cursor_mcp_config.example.json into ~/.cursor/mcp.json and reload Cursor.
License
MIT
Available Tools
7 toolscreate_channel_messageA
Send a text message to a channel.
Requires Send Messages. Respect server rules and rate limits; content is limited to 2000 characters for plain text.
Inputs: channel_id (required), content (required). Returns: result
get_channelB
Get a single channel object by id.
Inputs: channel_id (required). Returns: result
get_guildB
Get a guild by id. The bot must be a member of that guild.
Inputs: guild_id (required). Returns: result
list_channel_messagesA
List recent messages in a channel (newest first in the response).
Requires Read Message History and access to the channel. limit is
1–100. Use before / after message ids for pagination.
Inputs: channel_id (required), limit, before, after. Returns: result
list_guild_channelsB
List channels in a guild (text, voice, categories, etc.).
Inputs: guild_id (required). Returns: result
list_guildsA
List guilds the bot is in (GET /users/@me/guilds).
Args: limit: Max guilds per request (1–200). before: Optional guild id cursor for pagination.
Inputs: limit, before. Returns: result
verifyA
Verify the bot token by calling GET /users/@me.
Returns the bot user object (id, username, discriminator flags, etc.).
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct resource or action: guild, channel, message, and authentication. No two tools have overlapping purposes, making it easy for an agent to select the correct one.
Tool names consistently follow a verb_noun pattern in snake_case (e.g., create_channel_message, get_guild, list_guilds), with 'verify' being the only outlier but acceptable as a standalone action.
Seven tools is well-scoped for a Discord MCP server that covers basic guild, channel, and message operations plus authentication. The count feels neither too sparse nor overloaded.
The set covers reading guilds, channels, messages, and sending a message, but lacks important operations like editing/deleting messages, creating/deleting channels, or managing reactions. Notable gaps exist for common workflows.
Maintenance
Related MCP Connectors
- Discortics - Discord BotDeprecatedcom.discortics
Set up and manage your Discord server from MCP: channels, roles, verification, tickets and security.
An MCP server that integrates with Discord to provide AI-powered features.
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
MCP server for OpenAI API (chat completions, image generation, embeddings) via AceDataCloud
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server for interacting with Discord.1913MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Discord communications, enabling listing guilds and channels, reading and sending messages, creating threads, and adding reactions.MIT
- AlicenseBqualityDmaintenanceEnables MCP clients to interact with Discord servers, allowing operations such as sending messages and reading message history through the Discord API.23141 npmMIT
- AlicenseAqualityDmaintenanceA local MCP server for Discord that enables reading and sending messages through a bot account, with tools for server/channel listing, messaging, reactions, and member search.8MIT