Discord MCP Server
A lightweight, multi-guild Discord MCP server with 95+ tools
接入你的智能体
发布者自己的命令。不是 PlugMCP 端点。
用我们的密钥与日志托管一份副本。
npx -y @pasympa/[email protected]Claude Code 没有针对本地命令的安装链接。复制下方命令并在终端中运行。
DISCORD_TOKEN=<secret> DISCORD_MCP_TOOLSETS=<value> DISCORD_MCP_READ_ONLY=<value> DISCORD_ALLOWED_GUILDS=<value> DISCORD_MESSAGE_CONTENT=<value> DISCORD_GUILD_MEMBERS=<value> DISCORD_MCP_TRANSPORT=<value> DISCORD_MCP_HTTP_TOKEN=<secret> DISCORD_MCP_HTTP_HOST=<value> DISCORD_MCP_HTTP_PORT=<value> DISCORD_MCP_HTTP_ALLOWED_HOSTS=<value> claude mcp add pasympa-discord-mcp-github -- npx -y @pasympa/discord-mcp@2.4.0在终端中运行。
{ "mcpServers": { "pasympa-discord-mcp-github": { "command": "npx", "args": [ "-y", "@pasympa/[email protected]" ], "env": { "DISCORD_TOKEN": "<secret>", "DISCORD_MCP_TOOLSETS": "<value>", "DISCORD_MCP_READ_ONLY": "<value>", "DISCORD_ALLOWED_GUILDS": "<value>", "DISCORD_MESSAGE_CONTENT": "<value>", "DISCORD_GUILD_MEMBERS": "<value>", "DISCORD_MCP_TRANSPORT": "<value>", "DISCORD_MCP_HTTP_TOKEN": "<secret>", "DISCORD_MCP_HTTP_HOST": "<value>", "DISCORD_MCP_HTTP_PORT": "<value>", "DISCORD_MCP_HTTP_ALLOWED_HOSTS": "<value>" } } }}claude_desktop_config.json
远程 URL 还是本机命令? 两种安装方式的区别
来自发布者
Discord MCP server for Claude, Codex, Cursor, VS Code and other MCP clients: read and send messages, moderate members, manage roles, channels, forums, webhooks and events. Toolset profiles, guild allow-list, dry-run for mass actions.
Manage your entire Discord server from Claude Desktop, Claude Code, Cursor, VS Code Copilot, or any MCP-compatible client. Messages, channels, roles, permissions, moderation, forums, webhooks, all through natural language.
GUILD_ID lock-inAdd this to your MCP client config and replace YOUR_TOKEN_HERE with your bot token:
{
"mcpServers": {
"discord": {
"command": "npx",
"args": ["-y", "@pasympa/discord-mcp"],
"env": {
"DISCORD_TOKEN": "YOUR_TOKEN_HERE"
}
}
}
}
No install needed, npx handles everything.
Don't have a bot yet? See Creating Your Discord Bot.
Add the config above to your claude_desktop_config.json:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonRestart Claude Desktop after saving.
claude mcp add discord -e DISCORD_TOKEN=YOUR_TOKEN_HERE -- npx -y @pasympa/discord-mcp
Add the config above to ~/.cursor/mcp.json. See Cursor MCP docs for details.
Add to your .vscode/mcp.json:
{
"inputs": [
{
"type": "promptString",
"id": "discord-token",
"description": "Discord Bot Token",
"password": true
}
],
"servers": {
"discord": {
"command": "npx",
"args": ["-y", "@pasympa/discord-mcp"],
"env": {
"DISCORD_TOKEN": "${input:discord-token}"
}
}
}
}
See VS Code MCP docs for details.
{
"mcpServers": {
"discord": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"-e",
"DISCORD_TOKEN=YOUR_TOKEN_HERE",
"pasympa/discord-mcp:latest"
]
}
}
}
git clone https://github.com/PaSympa/discord-mcp
cd discord-mcp
npm install && npm run build
{
"mcpServers": {
"discord": {
"command": "node",
"args": ["/absolute/path/to/discord-mcp/dist/index.js"],
"env": {
"DISCORD_TOKEN": "YOUR_TOKEN_HERE"
}
}
}
}
Instead of passing the token in the MCP config, create a .env file at the project root:
DISCORD_TOKEN=YOUR_TOKEN_HERE
The server loads .env automatically via dotenv.
Since 2.1.1 the server no longer requests the GuildMessages intent at all: nothing here subscribes to message events, and every message this server returns is fetched over REST, which connection intents do not gate. That intent used to make discord.js cache every message flowing through every channel, together with its author, which grew unbounded on a long-running server. Cache sweepers now bound what remains. DISCORD_MESSAGE_CONTENT therefore only affects whether the Message Content intent is requested at connect time; it does not change what any tool returns.
These flags only control which gateway intents the server requests when identifying. Requesting a privileged intent that is not enabled in the Developer Portal makes the connection fail at the first tool call (close code 4014); set the flag to false to connect anyway.
Data access is governed by the portal toggles, not by these flags: this server reads everything over the REST API, which Discord gates on the portal setting alone. So with the portal toggles on, setting these flags to false loses nothing. With a portal toggle off, the corresponding data is restricted regardless of the flags: message bodies come back empty (content, embeds, attachments; except the bot's own messages, DMs, and messages that mention the bot) and member listing fails; enable the toggle in the portal to restore it.
Toolsets (DISCORD_MCP_TOOLSETS): discovery, messages, channels, permissions, members, roles, moderation, screening, stats, forums, webhooks, scheduled_events, invites, dm. Example; DISCORD_MCP_TOOLSETS=discovery,messages,members exposes only the discovery, message, and member tools. Note: a toolset ships its whole module, including its destructive tools (messages includes bulk delete; members includes kick/ban); use DISCORD_ALLOWED_GUILDS and the dry-run defaults to bound them. Only the listed toolsets' tools are advertised and callable. Unknown names make the server fail at startup instead of silently exposing everything (an empty value counts as unset and exposes all).
New Application > give it a name
Bot tab > Reset Token > copy the token
Enable Privileged Gateway Intents (this server requests both by default, but new Discord apps have the portal toggles OFF):
Important: if the bot requests a privileged intent that is not enabled here, Discord closes the connection with code
4014and every tool call fails. Enable both, or stop requesting the ones you don't need via the environment variables above.
OAuth2 > URL Generator:
botSend Messages, Read Message History, Manage Channels, Manage Roles, Kick Members, Ban Members, Moderate Members, View Audit Log, Manage Messages, Manage Threads, Add Reactions, Manage Guild, Manage Webhooks, Manage Events, Create Events, Create Instant Invite, Manage Nicknames, Pin Messages, Embed Links, Create Public Threads, Send Messages in ThreadsCopy the generated URL and invite the bot to your server
"List all servers the bot is in"
"Read the last 10 messages in #general"
"Send 'Hello everyone!' to the announcements channel"
"Create a forum channel called 'feedback' with tags Bug, Feature, Question"
"Show the full permission audit for the server"
"Create a webhook on #notifications and send a test message"
"Ban user 112233445566778899 and delete their messages from the last 3 days"
"Create an event called 'Game Night' for next Friday at 8pm"
"List all upcoming events in the server"
"Create a permanent invite for #general"
"List all active invites and delete expired ones"
"Send a DM to user 112233445566778899 saying 'Your build passed!'"
"Search for members named 'john'"
"List all banned users in the server"
"Show all pinned messages in #general"
"Forward that message to #announcements"
Enable Developer Mode in Discord:
Settings > Advanced > Developer Mode
Then right-click on a server, channel, or user > Copy ID.
discord-mcp/
├── src/
│ ├── index.ts ← Entry point (MCP server + transport)
│ ├── client.ts ← Discord client + shared helpers
│ ├── constants.ts ← Shared constants (limits, defaults)
│ ├── embeds.ts ← Shared embed schema + builder
│ └── tools/
│ ├── index.ts ← Tool registry (toolset gating, dispatch)
│ ├── define.ts ← defineTool/defineModule + shared zod fields
│ ├── types.ts ← Shared TypeScript interfaces
│ ├── discovery.ts ← Guild/channel discovery
│ ├── messages.ts ← Message CRUD, reactions, threads, embeds
│ ├── channels.ts ← Channel management
│ ├── permissions.ts ← Permission overwrites
│ ├── members.ts ← Member management
│ ├── roles.ts ← Role CRUD and assignment
│ ├── moderation.ts ← Audit log
│ ├── screening.ts ← Membership screening
│ ├── stats.ts ← Server statistics
│ ├── forums.ts ← Forum channels, posts, tags
│ ├── webhooks.ts ← Webhook management
│ ├── scheduledEvents.ts ← Scheduled events
│ ├── invites.ts ← Invite management
│ └── dm.ts ← Direct messages
├── test/ ← node:test suite (schemas, gating, allow-list)
├── scripts/ ← sync-version.js (npm version hook)
├── .github/workflows/ ← CI/CD (build check + auto release)
├── Dockerfile
├── .dockerignore
├── .env.example
├── package.json
├── tsconfig.json
├── CHANGELOG.md
├── CONTRIBUTING.md
├── SECURITY.md
└── README.md
src/tools/ (e.g. events.ts)defineTool({ name, description, annotations, schema, handle }) and export defineModule([...]) as the defaultallToolsets in src/tools/index.ts (the key is its DISCORD_MCP_TOOLSETS name).env file (not versioned)DISCORD_ALLOWED_GUILDSbulk_ban, prune_members, bulk_delete_messages, delete_channel) default to a dry_run preview; pass dry_run:false to applyContributions are welcome!
git checkout -b feature/my-feature)MIT, see LICENSE for details.
Discord MCP server for Claude, Codex, Cursor, VS Code and other MCP clients: read and send messages, moderate members, manage roles, channels, forums, webhooks and events. Toolset profiles, guild allo
{ "mcpServers": { "pasympa-discord-mcp-github": { "command": "npx", "args": [ "-y", "@pasympa/[email protected]" ], "env": { "DISCORD_TOKEN": "<secret>", "DISCORD_MCP_TOOLSETS": "<value>", "DISCORD_MCP_READ_ONLY": "<value>", "DISCORD_ALLOWED_GUILDS": "<value>", "DISCORD_MESSAGE_CONTENT": "<value>", "DISCORD_GUILD_MEMBERS": "<value>", "DISCORD_MCP_TRANSPORT": "<value>", "DISCORD_MCP_HTTP_TOKEN": "<secret>", "DISCORD_MCP_HTTP_HOST": "<value>", "DISCORD_MCP_HTTP_PORT": "<value>", "DISCORD_MCP_HTTP_ALLOWED_HOSTS": "<value>" } } }}概览
Discord MCP server for Claude, Codex, Cursor, VS Code and other MCP clients: read and send messages, moderate members, manage roles, channels, forums, webhooks and events. Toolset profiles, guild allow-list, dry-run for mass actions.
工具
暂无工具列表。远程服务器在首次健康检查后会获得工具列表。
常见问题
在本页复制适用于 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 配置。它使用发布者的安装方式,而不是 PlugMCP 代理。
发布者列出了以下环境变量:DISCORD_TOKEN, DISCORD_MCP_TOOLSETS, DISCORD_MCP_READ_ONLY, DISCORD_ALLOWED_GUILDS, DISCORD_MESSAGE_CONTENT, DISCORD_GUILD_MEMBERS, DISCORD_MCP_TRANSPORT, DISCORD_MCP_HTTP_TOKEN, DISCORD_MCP_HTTP_HOST, DISCORD_MCP_HTTP_PORT, DISCORD_MCP_HTTP_ALLOWED_HOSTS。
Discord 通过 stdio 在本地运行。
上次检查时间:2026-11-16。 Discord MCP server for Claude, Codex, Cursor, VS Code and other MCP clients: read and send messages, moderate members, manage roles, channels, forums, webhooks and events. Toolset profiles, guild allow-list, dry-run for mass actions.