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