Discord

io.github.willuhmjsv1.1.1更新於 Oct 3, 2026

Discord for LLM agents: 168 tools for messages, moderation, channels, roles, threads and AutoMod.

概覽

AI 產生的概覽

讓助手透過 168 個工具管理 Discord 伺服器,涵蓋訊息、審核、頻道、角色、討論串、活動、邀請、Webhook 和 AutoMod。

功能
提供 168 個 Discord 工具,涵蓋訊息、審核、頻道、角色、討論串、活動、邀請、Webhook 和 AutoMod。豐富訊息支援嵌入、Components V2、投票、檔案和回覆,並在送到 Discord 前驗證,錯誤會指出有問題的欄位。互動角色選單在重新啟動後仍然有效,並記錄誰點擊了什麼。可透過 stdio 或本機 HTTP 端點執行。
適用情境
適合讓助手管理或審核 Discord 伺服器:發布和編輯訊息、處理角色和頻道、執行討論串和活動,或設定 AutoMod。它面向機器人驅動的伺服器管理,而不是隨意讀取聊天內容。
執行需求
使用 npx 需要 Node.js 22+,HTTP 模式可用 Docker。需要 DISCORD_TOKEN 中的機器人權杖,並將機器人以啟用 Message Content 意圖的方式邀請到伺服器。DISCORD_GUILD_ID 設定預設伺服器。ENABLE_MEMBERS_INTENT 啟用成員清單工具。HTTP 模式預設綁定 127.0.0.1:8085。
安裝前請注意
DISCORD_TOKEN 是機器人憑證,可讓所有工具以機器人身分執行操作,不要放入共用設定。HTTP 端點沒有身分驗證,任何能存取它的人都能以機器人身分使用全部工具;請保持在回送位址、私有網路或 Unix 通訊端上。Docker 映像綁定 0.0.0.0。工具會寫入、傳送和刪除 Discord 資料,create_webhook 會一次性回傳憑證 URL。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Discord,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

discord-mcp

[npm] [CI] [License: MIT]

An MCP server that lets an LLM run a Discord server: 168 tools for messages, moderation, channels, roles, threads, events, invites, webhooks, AutoMod and more. Works with Claude, Cursor, VS Code, or any MCP client.

  • Rich messages: embeds, Components V2, polls, files, replies — validated before they reach Discord, with errors that name the bad field.
  • Interactions: role menus that survive restarts, plus a log of who clicked what.
  • Secure by default: binds to 127.0.0.1, SSRF-guarded URL fetching, webhook tokens never echoed.

Quick start

  1. Create a bot in the developer portal, invite it to your server, and enable the Message Content intent (Bot → Privileged Gateway Intents).
  2. Add this to your MCP client's config (mcp.json, claude_desktop_config.json, .cursor/mcp.json, ...):
json
{  "mcpServers": {    "discord": {      "command": "npx",      "args": ["-y", "@willuhmjs/discord-mcp", "--stdio"],      "env": {        "DISCORD_TOKEN": "your-bot-token",        "DISCORD_GUILD_ID": "your-server-id"      }    }  }}

VS Code uses "servers" instead of "mcpServers". On Windows, if the client can't find npx, use "command": "cmd" with "args": ["/c", "npx", "-y", "@willuhmjs/discord-mcp", "--stdio"].

Claude Code — one command:

bash
claude mcp add discord -e DISCORD_TOKEN=... -e DISCORD_GUILD_ID=... -- npx -y @willuhmjs/discord-mcp --stdio

Docker — a long-running HTTP server at http://127.0.0.1:8085/mcp:

bash
docker run --rm -e DISCORD_TOKEN=... -p 127.0.0.1:8085:8085 ghcr.io/willuhmjs/discord-mcp

Requires Node.js 22+ for npx.

Configuration

VariableDefaultMeaning
DISCORD_TOKEN— (required)Bot token.
DISCORD_GUILD_ID—Default server for tools when guildId is omitted.
ENABLE_MEMBERS_INTENToffEnables the privileged Server Members intent (also enable it in the portal). Member-list tools need it.
MCP_TRANSPORThttpstdio for stdin/stdout. The --stdio flag does the same.
HOST / PORT127.0.0.1 / 8085HTTP bind address and port.
MCP_SOCKET—Listen on a Unix socket instead of HOST:PORT (HTTP mode only).

In HTTP mode, POST /mcp serves MCP (stateful sessions via Mcp-Session-Id) and GET /health returns 200 once the bot is connected.

Keeping the HTTP endpoint private

The HTTP endpoint has no authentication: anyone who can reach it can use every tool as the bot. Keep it on loopback or a private network. On a shared machine, other accounts can still reach a loopback port, so use a Unix socket that only you can open:

bash
mkdir -m 700 ~/.mcpMCP_SOCKET=~/.mcp/discord.sock DISCORD_TOKEN=... npx @willuhmjs/discord-mcpcurl --unix-socket ~/.mcp/discord.sock http://localhost/health

The socket is created with mode 600. Avoid network file systems such as NFS. The Docker image binds 0.0.0.0, so keep that container on an internal network. stdio mode has no network exposure at all.

Tools

Every tool, with its parameters and the Discord permission it needs, is listed in docs/TOOLS.md, along with the conventions (string IDs, JSON-string payloads, reason for the audit log) and message/component formats.

Security

  • Every URL a tool fetches (emoji, stickers, files, avatars) goes through one guarded fetcher: http/https only, private/loopback/metadata IPs blocked before the request and after every redirect, size and time limits.
  • Webhook tokens are credentials: create_webhook returns the URL once, and no list/get tool shows it.
  • No tool reads the server's filesystem.

Development

bash
npm cinpm run build       # tsc -> dist/npm test            # vitest, no Discord token needednpm run typecheck

A contract test locks every tool name and parameter set against tests/fixtures/tool-contract.json. TESTING.md is the manual checklist for a run in a real test server.

Releases are automated: commits on main using Conventional Commits (feat:, fix:, feat!:) feed a release PR; merging it publishes to npm, the MCP Registry and GHCR.

License

MIT

來源:README.md,提交 68549cf

工具

0
工具後設資料尚未被收錄。

版本歷史

1
  1. v1.1.1最新Oct 3, 2026