discord-sovereign-mcp
Provides full-lifecycle Discord server management, including guilds, channels, members, roles, permission overwrites, and declarative server scaffolding, with a sovereignty guard that enforces role hierarchy before any destructive action.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@discord-sovereign-mcpScaffold a new community server for my gaming guild."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Why a sovereignty guard? Discord's permission model is hierarchical: role position, not permission flags, decides who can do what. The single most common cause of
Missing Permissionsfailures in LLM-driven admin bots is acting from a role that thinks it has permissions but sits below the roles it tries to manage. This server refuses to act until the client provably sits at the top of the ladder.
One-click install
npx discord-sovereign-mcp@latest --installThat's it. The installer wires the server into Claude Code, Claude Desktop, Codex, opencode,
Cursor, Windsurf, Continue, Google Antigravity, and VS Code: interactive picker by default,
--all if you want everything, backups before every write, idempotent on re-run.
npx discord-sovereign-mcp@latest --install --all: every client, no promptsnpx discord-sovereign-mcp@latest --install --client codex,opencode --dry-run: previewFull guide: docs/INSTALL.md
Prefer manual setup? Copy the ready-made config for your client from
examples/mcp/: every file, every client, the same npx invocation.
Related MCP server: Discord Server Creator MCP
What you get
46 tools across control, guilds, channels, members, scaffolding, and OAuth: snake_case,
discord_-prefixed, schema-strict, documented in TOOLS.md.Sovereign Control Guard: every destructive tool is
dry_runby default and must passdiscord_assert_sovereigntybefore executing withdry_run: false, enforced server-side.One-shot server scaffolding:
discord_scaffold_serverbuilds roles, categories, channels, and permission overwrites from a declarative template (minimal / community / gaming / support).OAuth2 bootstrap for user-token mode (
--oauth) and safety rails: guild allowlist, audit-log reasons, idempotency checks, anddry_runpreviews that return the exact API payload.
Quick start
# run directly (stdio)
npx discord-sovereign-mcp@latest
# run with OAuth2 user-token bootstrap
npx discord-sovereign-mcp@latest --oauth
# from source
npm install
cp .env.example .env # then edit: DISCORD_TOKEN (or OAuth2 vars)
npm run build
npm test # 80 unit testsToken setup: bot (recommended for servers you own)
Create an application at https://discord.com/developers/applications.
Under Bot: create the bot, copy the token, enable SERVER MEMBERS INTENT and MESSAGE CONTENT INTENT.
Under OAuth2 -> URL Generator: scope
bot, permissionsAdministrator, invite the bot to your server. (Administrator is required for server-scoped operations; the guard still enforces role position.)DISCORD_TOKEN=<token>in.env:DISCORD_TOKEN_TYPE=autodetects bot vs user.
Token setup: user token via OAuth2
Create an application; under OAuth2 -> General add a redirect
http://localhost:8788/callback.Set
DISCORD_OAUTH2_CLIENT_ID,DISCORD_OAUTH2_CLIENT_SECRET,DISCORD_OAUTH2_REDIRECT_URIin.env.npx discord-sovereign-mcp@latest --oauth: opens the authorization URL, waits for the callback, and writes the user token into.env(DISCORD_TOKEN_TYPE=oauth2).
Run
npm run dev # tsx, stdio transport
npm run start # built dist/, stdio transport
TRANSPORT=http npm run start # HTTP transport (POST /mcp, GET /health)The Sovereignty Guard
discord_assert_sovereignty: read-only verdict: prints the full role ladder with positions and flags the client role. Controlled = client owns the guild (user mode) or holds the #1 role (bot mode).discord_elevate_control: moves the client role to the top of the ladder, then re-verifies. Never fails silently: if the API rejects the reorder, the error explains that a human must drag the role above the roles it couldn't outrank.Every destructive tool runs the same gate (
assertControl) before its first mutating call whendry_run: false: awaited server-side, so a guard failure can never be dropped.
Scaffolding
discord_scaffold_server builds a whole server from a template in one call:
{
"guild_id": "1234567890",
"template": "community", // minimal | community | gaming | support
"dry_run": false
}It executes in safe order: roles lowest-first, then categories, then channels (with parent
wiring), then permission overwrites, guarding once before the first step. Each step is
isolated: on failure the tool returns steps_total / steps_completed / steps_failed plus the
already-created role/channel IDs so a partial scaffold can be reconciled by hand.
Environment variables
Variable | Default | Description |
| none | Bot or OAuth2 user token (required). |
|
|
|
| (empty = all) | Comma-separated guild IDs. When set, every tool refuses guilds outside the list, even if sovereignty is held. |
|
|
|
|
| HTTP transport bind address/port. |
| none | OAuth2 application client ID. |
| none | OAuth2 application client secret. |
|
| Must match the redirect registered in the Discord developer portal. |
|
| Local callback port used by |
|
| Audit-log reason stamped on actions. |
|
|
|
AI client configs
Client | Config file | Where it goes |
Claude Code |
|
|
Claude Desktop |
| menu: Claude -> Settings -> Developer |
Codex CLI |
|
|
opencode |
|
|
Cursor |
|
|
Windsurf |
|
|
Continue |
|
|
Google Antigravity |
| Project MCP settings |
Ready-to-paste files: examples/mcp/. Every client invokes the server the same
way: npx discord-sovereign-mcp@latest.
Development
npm run typecheck # tsc --noEmit
npm run test # vitest run
npm run install:mcp # run the installer locally (tsx)
npm run oauth # OAuth2 user-token bootstrap
npm run eval # offline registry checks (add --live for protocol checks)Docs
TOOLS.md: full reference for all 46 tools (generated).
docs/INSTALL.md: the installer: flags, token resolution, what gets written.
docs/SPEC.md: design spec: architecture, threat model, guard semantics, tool contracts.
docs/RECIPES.md: end-to-end recipes for common workflows.
SECURITY.md: threat model, token handling, and reporting policy.
License
MIT: see LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Build Discord communities with AI: roles, channels, modules, automations and reviewed announcements.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Kite is a no-code Discord bot builder that hosts your bot. Its MCP server lets your AI client build the bot for you: slash commands, event listeners and messages with buttons. It can also edit existing flows, read logs to fix errors, and add ready-made templates like tickets or verification. Changes go live right away, and commands show up in Discord within a minute. It can also read your server through the Discord API, like channels, roles and members. Claude, ChatGPT, Claude Code, Codex and VS Code connect by signing in. You pick which apps the client can access and whether it can make changes. Other clients like Cursor use a Kite API token. Earlier versions of every flow can be restored in Kite.
Provides capabilities that let LLM agents perform a range of infrastructure management tasks.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables AI clients to manage Discord servers through natural language, offering tools for guilds, channels, messages, roles, members, webhooks, invites, and automations. Includes a conversational agent that responds to @mentions in Discord.10Apache 2.0
- FlicenseNot gradedqualityDmaintenanceGives AI agents full control over Discord server creation and configuration. Exposes 36 tools covering guild lifecycle, channels, roles, members, content, messages, templates, and a declarative blueprint engine.-
- AlicenseAqualityCmaintenanceEnables AI clients to manage Discord servers, including channels, messages, roles, members, permissions, threads, invites, events, webhooks, and emoji, through natural language commands.55131 npm1MIT
- AlicenseNot gradedqualityBmaintenanceEnables autonomous Discord server administration via natural language, allowing users to delegate tasks like channel/role creation, permission checks, and automations to an AI agent with safety gates and audit trails.MIT