Discord Management Mcp

io.github.TheStreamCode由 GitHub 帳號 TheStreamCode 發布v0.2.0更新於 Nov 7, 2026

Safe-by-default Discord management MCP with JSON backups, restore planning, and guarded mutations.

已驗證STDIO僅桌面效率與工作流溝通與協作

概覽

AI 產生的概覽

本機 stdio MCP 伺服器,讓助理檢視、備份並管理 Discord 伺服器,所有變更都經過確認與備份保護。

可以做什麼
  • 檢視伺服器、成員與稽核日誌,列出頻道與角色
  • 建立、比對本機 JSON 備份並產生還原計畫
  • 在保護機制下修改頻道、角色與伺服器設定
  • 執行審核與 AutoMod 操作,並設定緊急事件處置動作
  • 管理社群與探索等伺服器設定
適用情境
當你希望助理稽核 Discord 伺服器、在風險操作前先做快照,或從本機 MCP 用戶端執行頻道、角色與審核變更,並保留明確的確認與備份紀錄時使用。
執行需求
需要 Node.js 24 或更新版本,並透過 npx 執行 npm 套件。需要 DISCORD_TOKEN 中的機器人權杖,且機器人已以所需權限邀請到目標伺服器。可選 BACKUP_DIR、LOG_LEVEL、ENABLE_MESSAGE_CONTENT 與 ENABLE_GUILD_MEMBERS;後兩者還需在 Discord 開發者入口啟用對應的特權 intent。
安裝前請注意
機器人權杖是權限很高的憑證,應放在環境變數或本機環境檔案中,不要使用應用程式 ID、公開金鑰或 OAuth2 用戶端密鑰。約 31 個工具會修改 Discord 資料,包括審核與刪除操作,使用前請了解確認與備份保護規則。備份會移除邀請碼與 webhook 權杖,但仍包含伺服器結構;還原為盡力而為,無法還原 ID、訊息歷史或邀請碼。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

Discord Management MCP

Safe-by-default Discord management from any MCP client

[CI] [License] [npm]

[Discord Management MCP hero]

Discord Management MCP is a local Model Context Protocol (MCP) server for inspecting, backing up, and managing Discord guilds. It runs over stdio, keeps the bot token and backup files on the operator's machine, and places confirmation, backup, and restore guards in front of every mutation. The server exposes 54 tools across guild inventory, moderation, roles, channels, server settings, backups, and restore planning.

It works with any MCP client that supports local stdio servers, including Claude Desktop, Claude Code, Cursor, VS Code, Codex, Windsurf, and Cline. This independently developed project is not affiliated with, endorsed by, sponsored by, or approved by Discord Inc.

New to Discord bots? The setup and first use guide walks through creating the application, inviting the bot with the right permissions, copying the server ID, registering the client, verifying the connection, and running the first safe backup and restore.

Install

The published package runs with one command:

bash
npx --yes discord-management-mcp

The package is published on npm as discord-management-mcp and declares MCP registry metadata for io.github.TheStreamCode/discord-management-mcp through package.json and server.json.

Register with your client

Every client needs the same command, arguments, and DISCORD_TOKEN environment variable. Paste the equivalent of this entry into the client's MCP configuration:

json
{  "mcpServers": {    "discord-management": {      "command": "npx",      "args": ["--yes", "discord-management-mcp"],      "env": {        "DISCORD_TOKEN": "your_bot_token"      }    }  }}
ClientRegistration
Claude DesktopAdd the entry above to the MCP servers configuration.
Claude CodeAdd a local stdio server with the same command and arguments.
CursorAdd the entry above to the MCP configuration.
VS CodeAdd the same command and arguments in the client's MCP configuration.
CodexAdd a stdio server entry with the same command and arguments.
WindsurfAdd the entry above to the MCP configuration.
ClineAdd the server in the MCP settings panel.

Claude Desktop, Cursor, Windsurf, and Cline accept the mcpServers JSON shape shown above. Clients that use a different configuration schema accept the same command, args, and env values. See each client's own documentation for the exact file or command.

Set up

The short version, with the full walkthrough in setup and first use:

  1. Create the bot. Developer Portal > New Application > Bot > Reset Token. That token is the only credential the server needs. Do not use the Application ID, Public Key, or OAuth2 client secret.
  2. Invite it. OAuth2 > URL Generator > scope bot plus the permissions you need. Start with View Channels, Manage Channels, Manage Roles, Manage Server, View Audit Log, and the moderation permissions you plan to use. Then drag the bot role above the roles it must edit.
  3. Copy the server ID. Enable Developer Mode, right-click the server icon, Copy Server ID. This number is the guildId argument, not the bot's application ID.
  4. Register the client. Use the configuration in Register with your client with DISCORD_TOKEN in env, or put the token in .env.local in the working directory.
  5. Verify and back up. Ask the client to run discord_list_guilds, then discord_backup_create for your server, and read coverage.channels.complete.

Example first request:

text
Use discord_list_guilds, then discord_backup_create for the server I name, and report the backup ID and coverage.

Then change things only through the guarded path: create a backup, review the target objects, apply one small change, and confirm the result. Every mutation needs an audit reason:

json
{  "guildId": "123456789012345678",  "confirm": true,  "reason": "Create the approved community announcements channel"}

High-impact operations also require a guild-matched backupId unless the operator explicitly accepts allowWithoutBackup: true. The tool catalog lists the exact policy for every mutating tool.

Why this one

Many Discord MCP servers stop at read-only inspection or previewing a change, and some route the bot token through a hosted service. Discord Management MCP executes changes locally, but only through a guard and recovery path:

CapabilityTypical preview-only serverDiscord Management MCP
Read-only inspectionYesYes, 23 read-only tools
Execute changesNoYes, 31 mutating and moderation tools
Local backup before risky changesRarelyJSON schema v2 snapshots with channel coverage
RestoreNoPlan with plan hash, apply with pre-restore backup
Rollback guaranteeNot offeredBest effort, reported honestly with NOT_RESTORED warnings
Data pathOften hostedLocal stdio only

What that means in practice:

  • Local by design. The bot token, snapshots, restore plans, and stdio transport stay on the operator's machine. There is no hosted relay and no public HTTP listener.
  • Preview, then apply. Backups can be diffed and turned into a restore plan before anything changes, and plans carry a hash that apply can verify.
  • Backup to restore promise. A risky change can point at a same-guild snapshot; restore apply writes a fresh pre-restore backup before its first Discord mutation.
  • An explicit safety matrix. Every Discord mutation needs confirm: true and a reason. The listed high-impact tools need a same-guild backup. Emergency incident actions stay available without one.
  • Truthful recovery. Restore reports skipped, lossy, applied, and failed operations instead of promising an impossible full rollback.

Backup to restore

The recovery path has three steps:

  1. discord_backup_create writes a JSON snapshot to BACKUP_DIR atomically, strips invite codes, webhook tokens, and other secrets, and records channel coverage in coverage.channels.
  2. discord_backup_diff and discord_backup_restore_plan show what would change. A plan includes a planHash and NOT_RESTORED warnings for captured sections that Discord cannot recreate.
  3. discord_backup_restore_apply can verify an expectedPlanHash, creates a pre-restore backup, then applies supported role and channel fields conservatively. Deletes remain opt-in.

Discord cannot restore original IDs after delete and recreate, message or audit-log history, exact invite codes, webhook tokens, or every community and discovery setting. The server reports those limits instead of hiding them. See safety and backups for the full model.

Tool coverage

The server registers 54 tools. See the tool catalog for every name and the guard matrix for the backup policy.

DomainTools
Guild, member, and audit inventory17
Backups and restore6
Channels6
Roles7
Moderation and AutoMod13
Server configuration5
Total54

Read-only tools are annotated as read-only and never require confirmation. Mutating Discord tools require confirm: true plus a non-empty audit reason, and mutations run through a shared queue so they cannot interleave. discord_backup_create only writes a local snapshot and does not require confirmation.

Safety model

  • Every Discord mutation requires confirm: true and a non-empty reason; the reason is passed to Discord where audit-log reasons are supported.
  • High-impact tools require a backup from the same guild, or an explicit allowWithoutBackup: true acknowledgement.
  • discord_set_incident_actions is intentionally exempt: it is used during raids, and its changes are reversible.
  • Restore apply creates its own pre-restore backup and retains its ID on every error path.
  • Backup writes are atomic, and backup paths are confined to the project directory with symlink and junction rejection.
  • Read-only tools are implemented and annotated as read-only.

See safety and backups for the guard matrix, channel coverage, and restore behavior, and design and trust boundaries for the runtime model. Report vulnerabilities privately through SECURITY.md.

Requirements

  • Node.js 24 or newer.
  • A Discord application with a bot token.
  • The bot invited to the target guild with only the permissions required for the intended tools.

ENABLE_MESSAGE_CONTENT and ENABLE_GUILD_MEMBERS are opt-in and require the matching privileged intents in the Discord Developer Portal. Since 2026-06-10, Discord reviews privileged intent usage at 10,000 users rather than 100 servers, and approved apps must reapply annually. See configuration for details.

Configuration

Configuration is read from the process environment first, then from .env.local in the working directory. Boolean values accept true/false, yes/no, on/off, or 1/0.

VariablePurposeDefault
DISCORD_TOKENDiscord bot token from Developer Portal > Bot > TokenRequired
BACKUP_DIRRelative directory for local JSON backups; it must stay inside the project directorybackups
LOG_LEVELStderr log level: error, warn, info, or debug; logs are JSON linesinfo
ENABLE_MESSAGE_CONTENTEnables message-content tools and requires the Discord Message Content intentfalse
ENABLE_GUILD_MEMBERSEnables the Guild Members gateway intent for workflows that require itfalse

See the configuration reference for token rules, logging behavior, and privileged-intent setup.

Privacy and security

Everything runs locally over stdio: the bot token, backup files, restore plans, and the server process itself never leave the operator's machine. Mutations are guarded by explicit confirmation and by backups that are validated for size, depth, structure, symlinks, and guild identity before planning or restore. A restore creates a pre-restore backup before its first Discord mutation and stops truthfully on operation failure. See design and trust boundaries and safety and backups for the full model, and SECURITY.md for private vulnerability reporting.

Troubleshooting

The server exits because DISCORD_TOKEN is missing or invalid

Set the Bot Token in the process environment or in .env.local in the working directory. A value that looks like a Discord Application Public Key is rejected with an explicit message: use the Bot Token, not the Application ID, Public Key, or OAuth2 client secret.

Message content comes back empty

Message-content tools need both ENABLE_MESSAGE_CONTENT=true and the Message Content Intent enabled in the Discord Developer Portal. Without both, Discord can return empty content, embeds, and attachments fields. Restart the server after changing either side. If the app is approaching the review threshold, remember that privileged intent access is reviewed at 10,000 users and must be renewed annually.

A mutation is rejected before it reaches Discord

Mutating tools require confirm: true and a non-empty reason. High-impact tools additionally require a backupId from the same guild, or an explicit allowWithoutBackup: true acknowledgement. discord_set_incident_actions is the exception for emergency use. Check the guard matrix before retrying.

Channels are missing from a backup or channel list

The bot can only back up channels it can view. Starting 2026-11-16, Discord omits channels the bot cannot view from GET /guilds/{id}/channels, and gateway payloads can carry obfuscated channel objects. Backups record this in coverage.channels and warn when coverage is incomplete. Grant VIEW_CHANNEL where the channels matter, and treat complete: false as a partial rollback point. See channel coverage and obfuscation.

Restore reports skipped or lossy operations

Discord cannot recreate original IDs, message or audit-log history, exact invite codes, webhook tokens, managed integration objects, or every community and discovery setting. Check the plan's planHash and its NOT_RESTORED warnings, then review the reported operations before retrying.

Logs are too quiet or too noisy

Set LOG_LEVEL to error, warn, info, or debug. Logs are JSON lines on stderr, so stdout stays reserved for MCP protocol traffic. Use debug while diagnosing a tool call and error for quiet hosts.

Development

Requirements: Node.js 24 or newer and npm from the lockfile.

bash
git clone https://github.com/TheStreamCode/discord-management-mcp.gitcd discord-management-mcpnpm cinpm run lintnpm run typechecknpm testnpm run buildnpm run verify:mcpnpm run preflightnpm run pack:checknpm audit --omit=dev --audit-level=high

npm run verify:mcp starts the built server over stdio with a placeholder token and checks the advertised MCP surface: 54 tools, deterministic tool listing, titles, descriptions, input and output schemas, and annotation hints. It never calls the Discord API.

Tests use mocks and must not contact Discord. Live mutations are never part of routine verification. The repository keeps its engineering guidance in AGENTS.md; it is not shipped in the npm package. See CONTRIBUTING.md for contribution rules.

Support

See SUPPORT.md. Use GitHub Issues for reproducible bugs and feature proposals, and report vulnerabilities privately through GitHub Security Advisories.

Contributing

See CONTRIBUTING.md. Pull requests must pass npm run preflight, npm run verify:mcp, and the required CI checks.

License

MIT, see LICENSE. Copyright (c) 2026 Michael Gasperini (Mikesoft).

This independently developed project is not affiliated with, endorsed by, sponsored by, or approved by Discord Inc. Discord is a trademark of Discord Inc. See NOTICE for the applicable Discord terms and policies.


Maintained by Michael Gasperini (Mikesoft). If this project helps you manage Discord communities safely, consider sponsoring its maintenance.

來源:README.md,提交 42cb7b3

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:伺服器未能啟動。

版本歷史

1
  1. v0.2.0最新Oct 31, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分