Safe-by-default Discord management server for the Model Context Protocol (MCP). It lets MCP clients inspect and manage Discord guilds through a local stdio server, with JSON backups, restore planning, and explicit guardrails for risky operations.
Created by Michael Gasperini. Repository: TheStreamCode/discord-management-mcp.
- Local stdio MCP server: no public HTTP listener, no hosted service, no proxy.
- Discord-first tooling: guild, channel, role, member, AutoMod, scheduled event, invite, webhook, emoji, sticker, and application-command tools.
- Safe mutations: write operations require
confirm: trueand a non-emptyreason. - Destructive-operation guards: destructive tools require a valid backup ID or an explicit
allowWithoutBackup: true. - Guild-matched backups: destructive guards reject backups from a different Discord guild.
- Readable JSON backups: snapshots are stored locally and can be diffed or used for conservative restore planning.
- Conservative restore apply: role/channel create and update operations only by default; deletes are opt-in.
- Optional message reading:
Message Contentis disabled by default and must be explicitly enabled.
- Node.js
>=24 - A Discord application with a bot token
- The bot invited to the target guild with the permissions required for the tools you plan to use
This project does not require global packages. Install dependencies locally in the project.
Create .env.local from .env.example:
DISCORD_TOKEN=your_bot_token_here
LOG_LEVEL=info
BACKUP_DIR=backups
ENABLE_MESSAGE_CONTENT=false
ENABLE_GUILD_MEMBERS=falseUse the token from Discord Developer Portal > Application > Bot > Token. Do not use the Application ID or Public Key.
Install, build, and run:
npm install
npm run build
npm startDefault gateway intents avoid privileged intents so a new bot can start with minimal setup.
Optional privileged intents:
ENABLE_MESSAGE_CONTENT=true: enablesdiscord_list_channel_messages. You must also enable Message Content Intent in Discord Developer Portal > Bot > Privileged Gateway Intents.ENABLE_GUILD_MEMBERS=true: enables stronger member-listing behavior where Discord requires the Guild Members privileged intent.
If these toggles are enabled locally but disabled in the Developer Portal, Discord can reject the login or return empty message fields.
Use the built server as a stdio MCP server:
{
"mcpServers": {
"discord-management": {
"command": "node",
"args": [
"C:/path/to/discord-management-mcp/dist/index.js"
],
"cwd": "C:/path/to/discord-management-mcp"
}
}
}If installed as a package, the binary entry is:
discord-management-mcpRead-only tools do not require confirmation.
Mutating tools require:
{
"confirm": true,
"reason": "short audit-log reason"
}Destructive tools also require either:
{
"backupId": "2026-05-29T12-34-56-000Z-123456789012345678.json"
}or:
{
"allowWithoutBackup": true
}Use allowWithoutBackup only when you intentionally accept that rollback may be incomplete.
When a destructive action targets a known guild, the server reads the backup before acting and rejects the request if the backup belongs to a different guild.
Backups are JSON snapshots stored in backups/. They include guild metadata, roles, channels, permission overwrites, AutoMod rules, scheduled events, and available metadata for webhooks, invites, emojis, stickers, and application commands.
Recommended workflow:
- Run
discord_backup_create. - Inspect the guild with read-only tools.
- Ask your MCP client to produce a plan.
- Apply changes with
confirm: true,reason, and the backup ID. - If needed, use
discord_backup_restore_plan, thendiscord_backup_restore_apply.
Restore is best-effort. Discord cannot restore original IDs after recreation, message history, audit-log history, invite codes, webhook tokens, managed integration-owned roles, or every community/discovery setting.
discord_backup_restore_apply is intentionally conservative: it creates a pre-restore backup automatically, applies role/channel create and update operations, and skips deletes unless includeDeletes: true is set.
See docs/tools.md for the full tool list. Configuration details are in docs/configuration.md, and the safety model is expanded in docs/safety-and-backups.md.
Main groups:
- Guild inventory and audit tools
- Channel management tools
- Role management tools
- Member moderation tools
- AutoMod and scheduled-event tools
- Invite and webhook tools
- Backup, diff, restore-plan, and restore-apply tools
npm run typecheck
npm test
npm run build
npm run check
npm audit --omit=devThe test runner copies source files to a temporary directory before running Vitest. This keeps tests stable even when the repository path contains special characters such as #.
- Never commit
.env.local, backups, logs,node_modules/, ordist/. - The bot token is never printed by the server.
- Webhook URLs are not returned by list/read tools because they contain tokens.
- Backups can contain sensitive server structure and invite metadata; keep them private.
- User tokens and selfbots are not supported.
For release preparation, see docs/github-publishing.md.
If this MCP server helps you manage Discord communities safely, support continued maintenance through GitHub Sponsors: github.com/sponsors/TheStreamCode.
MIT
Copyright (c) 2026 Michael Gasperini.
