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 "Install 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.
Capabilities
46 tools across six areas — control, guilds, channels, members, scaffolding, OAuth — all snake_case,
discord_-prefixed, schema-strict, and documented in TOOLS.md.Sovereign Control Guard: every destructive tool is
dry_runby default and must passdiscord_assert_sovereigntybefore executing withdry_run: false— enforced on the server side, not just in prompts.One-shot server scaffolding (
discord_scaffold_server): roles, categories, channels, and permission overwrites from a declarative template (minimal / community / mod / social), with guard-once, per-step failure isolation, and partial-failure reconciliation output.OAuth2 bootstrap for user-token mode (
npx discord-sovereign-mcp --oauth), plus a built-in/callbackhandler when running over HTTP transport.Both transports: stdio (MCP clients) and Streamable HTTP (
POST /mcp,GET /health).Safety rails: guild allowlist (
DISCORD_ALLOWED_GUILDS), audit-log reasons, idempotency checks,dry_runpreviews that return the exact API payload, and a read-only permission calculator/auditor.
Related MCP server: Discord Server Creator MCP
Quick start
# Option A — run directly (OAuth2 user-token bootstrap included)
npx discord-sovereign-mcp@latest --oauth
# Option B — from source
npm install
cp .env.example .env # then edit: DISCORD_TOKEN (or OAuth2 vars)
npm run build
npm test # 60 unit testsThen point your MCP client at the server — per-client configs live in examples/mcp/ (Claude Code, Codex, opencode, Cursor, Windsurf, Continue).
Option A — bot token (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=bot(orauto).
Option B — 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)Architecture
┌────────────────────────────┐ ┌──────────────────────────────────────────┐
│ MCP client │ MCP │ discord-sovereign-mcp (Node 20+) │
│ Claude Code / Codex / │◄──────►│ stdio or Streamable HTTP (POST /mcp) │
│ opencode / Cursor / ... │ │ │
└────────────────────────────┘ │ registry ── 46 strict-zod tools │
│ │ │
│ ▼ │
│ guard() ── ControlService.assertControl │
│ │ owner? (user token) │
│ │ #1 role? (bot token) │
│ │ DISCORD_ALLOWED_GUILDS? │
│ ▼ │
│ DiscordClient ── @discordjs/rest REST API │
│ PermissionService (read-only auditor) │
│ ScaffoldService (template planner) │
│ OAuthService (user-token bootstrap) │
└──────────────────────────────────────────┘Environment variables
Variable | Default | Description |
| — | 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. |
| — | OAuth2 application client ID. |
| — | 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. |
|
|
|
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 | mod | social
"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.
AI client configs
Client | Config file | Server invocation |
Claude Code |
|
|
Codex CLI |
|
|
opencode |
|
|
Cursor |
|
|
Windsurf |
|
|
Continue |
|
|
Ready-to-paste files: examples/mcp/.
Evaluation
npm run eval # offline: registry invariants (no token, no network)
npm run eval -- --live # spawns dist/ and runs protocol-level checks against real DiscordProject layout
src/
index.ts # entrypoint: stdio + HTTP transports, /health, /callback
config.ts # typed env config + guild allowlist
constants.ts # server identity, permission/color constants
client/ # Discord REST client + error translation
services/ # control (sovereignty), permissions, scaffolding, OAuth
tools/ # 46 RegisteredTools + registry wiring + shared zod schemas
utils/ # formatting (bigint-safe JSON)
tests/ # vitest suite (60 tests)
scripts/ # oauth bootstrap, eval runner, docs generatorDevelopment
npm run typecheck # tsc --noEmit
npm run test # vitest run
npm run test:watch
npm run test:coverage
npm run oauth # OAuth2 user-token bootstrap
npm run eval # offline registry checks (add --live for protocol checks)
npx tsx scripts/gen-tools-doc.ts # regenerate TOOLS.mdDocs
TOOLS.md — full reference for all 46 tools (generated).
SPEC.md — design spec: threat model, guard semantics, tool contracts.
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 installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityBmaintenanceEnables 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.8Apache 2.0
- Flicense-qualityBmaintenanceGives 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.
- Alicense-qualityDmaintenanceEnables LLMs to send and read messages in Discord channels, manage servers, channels, and roles via Discord's API.162MIT
- Flicense-qualityBmaintenanceEnables AI assistants to manage a Discord server, including creating channels, categories, roles, setting permissions, and assigning roles through natural language commands.
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP server for Gainium — manage trading bots, deals, and balances via AI assistants
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/1cz1/discord-sovereign-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server