discord-mcp
Provides tools for managing Discord communities, including guilds, channels, messages, members, roles, scheduled events, audit logs, analytics, scheduled announcements, moderation actions, reactions, crossposts, and bot account operations such as identity lookup and direct messages.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
discord-mcp
A Model Context Protocol server for Discord communities: 50 tools, 4 prompts and 6 resource templates for guilds, channels, messages, members, roles, scheduled events, audit logs, analytics, scheduled announcements and the bot account itself (identity, global user lookup, opt-in direct messages, leave guild, prune, bulk delete, reactions, crossposts).
It is platform neutral: standard Node.js (22.13 or newer), stdio or self-hosted Streamable HTTP, SQLite or in-memory storage, no vendor-specific runtime. It runs on Linux, macOS and Windows, bare metal, a container or any Node host.
How it is organised
Layer | Package | Role |
Contracts |
| Tool catalog (Zod schemas), permission bits, ports, error codes |
Adapters |
| Discord REST v10 client, SQLite / memory storage, Gateway worker |
Domain |
| Authorization chain, audit trail, daily metrics, scheduled announcements |
Core |
| Tool executor, 37 handlers, resources, prompts, job runner |
Transport |
| MCP server factory, HTTP pipeline, auth, configuration, composition root |
Apps |
| Entry points |
The design is described in docs/plan-and-architecture.md, the reasons behind it in docs/decisions.md, and day-to-day operation in docs/runbook.md.
Related MCP server: discord-mcp
Security model in one paragraph
Every tool call passes the same chain: authenticated caller → MCP scope → guild allowlist → profile ceiling → feature flag → channel allowlist → per-caller overrides → confirmation for destructive actions → the bot's own Discord permissions → the Discord API. An empty guild allowlist denies every guild. The default profile is read_only, moderation is off, @everyone and mass role mentions are denied, and a confirmation token bound to the exact arguments is required before any destructive tool runs. Write tools additionally need a verified bot identity: if Discord rejects the token or cannot be reached, they abort with DISCORD_AUTH_INVALID or DISCORD_API_UNAVAILABLE instead of skipping a check; read tools are unaffected. Stored per-principal policy rows can only narrow scopes (* in a row never widens them), and OIDC principals never receive the * wildcard. tools/list is filtered by the caller's MCP scopes for visibility; the policy engine and executor remain the authorization boundary. There is no raw Discord proxy tool. Audit records never contain the bot token or message content.
Quick start
npm ci
cp .env.example .env # fill in DISCORD_BOT_TOKEN
npm run check # typecheck, lint, format check, testsInvite the bot with only the permissions your profile needs (read tools: View Channels, Read Message History; community_ops: Send Messages, Create Public Threads, Pin Messages, Manage Channels for channel edits, Create Events / Manage Events for events; admin: Manage Roles, Moderate Members, Kick Members, Ban Members, View Audit Log).
stdio (Claude Desktop, Claude Code, Cursor, other local clients)
{
"mcpServers": {
"discord": {
"command": "node",
"args": ["/absolute/path/to/discord-mcp/apps/mcp-stdio/dist/index.js"],
"env": {
"DISCORD_BOT_TOKEN": "...",
"DISCORD_ALLOWED_GUILD_IDS": "123456789012345678",
"DISCORD_ALLOWED_CHANNEL_IDS": "234567890123456789",
"DISCORD_DEFAULT_PROFILE": "community_ops",
"STORAGE_PATH": "/home/you/.discord-mcp/state.sqlite"
}
}
}
}For development from the TypeScript sources: npm run dev:stdio.
Streamable HTTP
DISCORD_BOT_TOKEN=... DISCORD_ALLOWED_GUILD_IDS=123 STORAGE_PATH=/var/lib/discord-mcp/state.sqlite \
MCP_HTTP_HOST=0.0.0.0 MCP_HTTP_PORT=3000 MCP_HTTP_PUBLIC_URL=https://mcp.example.com/mcp \
MCP_AUTH_MODE=static MCP_STATIC_TOKENS=/etc/discord-mcp/tokens.json \
node apps/mcp-http/dist/index.jsClient configuration for HTTP clients (for example Claude Code):
claude mcp add --transport http discord https://mcp.example.com/mcp --header "Authorization: Bearer <token>"MCP_AUTH_MODE=none is refused unless the host is loopback. Static tokens are a JSON array [{"token":"<at least 16 chars>","principal":"alice","scopes":["discord.guilds.read","discord.channels.read"]}] or a path to a file with that JSON. MCP_AUTH_MODE=oidc accepts access tokens from your identity provider (MCP_OIDC_ISSUER, optional MCP_OIDC_AUDIENCE); the server publishes the protected-resource metadata under /.well-known/oauth-protected-resource. Callers authenticated by OIDC never receive the * wildcard.
Docker
docker build -t discord-mcp .
docker run -p 3000:3000 --env-file .env -v discord-mcp-data:/data discord-mcpConfiguration reference
Variable | Default | Meaning |
| required | Bot token; sent only to |
| unset | Application id, informational |
|
| Ceiling for every caller: |
| empty | Guild allowlist; empty denies all |
| empty | Channel allowlist; empty allows every channel of an allowed guild |
|
|
|
|
| Timeout, kick, ban, unban, prune |
|
| Direct-message tools (personal data; admin profile only) |
|
|
|
|
| HTTP bind address and endpoint |
| derived | External endpoint URL (behind a proxy) |
| loopback values | Extra accepted |
|
| Request limits |
|
| Run the announcement scheduler in the HTTP process |
|
|
|
| unset | Static bearer tokens (JSON or file path) |
| unset | OIDC verification |
|
| Scopes of the local operator identity |
| empty | SQLite file; empty or |
|
| Retention |
|
| Lifetime of a confirmation token (single use) |
|
| How far an announcement may be scheduled |
|
| Scheduler tick |
|
| Required for the Gateway worker app |
|
| Privileged intents (also enabled in the developer portal) |
| refused | The server does not use presence data |
|
| Logs go to stderr only |
Unknown values, an empty token, none auth on a non-loopback host, static mode without tokens and http:// OIDC issuers on a non-loopback address all stop the process with a list of problems.
Tools
Account-level and completion tools (13, on top of the 37 guild tools)
Account-level tools act on the bot account, not on a server, so the guild allowlist does not apply
to them; MCP scopes, the profile ceiling and feature flags still do. Direct-message tools hold
personal data and stay hidden until DISCORD_ENABLE_DIRECT_MESSAGES=true, and they also need the
admin profile. Every destructive tool follows the standard confirmation flow.
Tool | Risk | Profile | Scope |
| read | read_only |
|
| read | read_only |
|
| read | admin + DM flag |
|
| write | admin + DM flag |
|
| write | admin + DM flag |
|
| destructive | admin + confirmation |
|
| destructive | admin + confirmation + moderation flag |
|
| destructive | admin + confirmation |
|
| destructive | admin + confirmation |
|
| write | community_ops |
|
| write | admin |
|
| write | community_ops |
|
Limits the tools enforce before Discord rejects the call: bulk delete takes 2-100 messages that are at most 14 days old (a Discord API limit); prune uses 1-30 inactive days and by default only removes members with no roles; crosspost only works in announcement channels and only for messages the bot itself posted; follow requires Manage Webhooks on the target channel; the reaction tools only ever touch the bot's own reactions.
Read: list_guilds, get_guild, get_guild_metrics, get_audit_log, list_channels, get_channel, list_messages, get_message, get_member, list_members, list_roles, get_role, list_scheduled_events, get_activity_summary, get_growth_summary, list_announcement_jobs.
Community: send_message, edit_message, delete_message, create_thread, pin_message, create_channel, edit_channel, delete_channel, create_scheduled_event, edit_scheduled_event, delete_scheduled_event, schedule_announcement, cancel_announcement_job.
Admin: create_role, edit_role, assign_role, remove_role, timeout_member, kick_member, ban_member, unban_member.
(All names carry the discord_ prefix.) Every tool returns { ok, data | error, confirmation? } and validates its output against a schema; text read from Discord is returned with an untrusted-content note.
Client compatibility
The server speaks stdio and the MCP Streamable HTTP transport (spec 2026-07-28) through the official TypeScript SDK, which negotiates a mutually compatible protocol version with older clients, so it works with current clients: Claude Desktop and Claude Code over stdio, and Claude for the web, Cursor, VS Code or any MCP 2025-06-18+ HTTP client over Streamable HTTP. Clients that only speak the removed HTTP+SSE transport are not supported; they need an upgrade, not a server change.
Beyond the wire protocol, for agent and client compatibility:
the
initializeresult carriesinstructionsthat explain the envelope format, the gate order and the confirmation flow, so an LLM that never read this README still behaves correctly;every tool has a
title, adescription, aninputSchema, anoutputSchemaand MCP annotations (readOnlyHint,destructiveHint,idempotentHint), so clients can sort and warn without calling anything;every result is JSON with
structuredContent(the envelope:ok, thendataorerrorwith a stable code and a readable message), and tool failures areisErrorresults rather than protocol errors, so agents can read them and recover;tools/listis deterministic (sorted by name): 50 tools total, 15 visible at the defaultread_onlyprofile, and clients can page the list;prompts expose argument metadata, and resources are standard
discord://templates.
Verification
This delivery was checked on Linux with Node v24.22.2. npm run check is green in all four stages: the TypeScript compiler reports 0 errors, eslint reports 0 problems, Prettier finds no differences, and vitest passes 139 of 139 tests across 29 files (about 64.5% statement coverage), including the security, protocol, retention, tools/list and shutdown suites. npm run build bundles all three apps with esbuild, and both transports answer smoke requests: stdio and HTTP both return instructions and list tools (15 at the default read_only profile), and HTTP serves GET /healthz, returns 401 for a wrong bearer token and completes initialize and tools/list with a static token. No request was sent to the live Discord API: the REST client is tested against a mock fetch and the executor against a fake REST port, so real rate limiting, permissions and intents are covered only as far as the documented behaviour goes.
Run npm run check. Individually: npm run typecheck, npm run lint, npm run format:check, npm test; npm run build and npm run test:coverage are separate. After building, node apps/mcp-http/dist/index.js --run-due-jobs applies pending migrations and processes due announcements once. npm run storage:migrate migrates a SQLite file without starting a server.
Scope limits
No live Discord call is made by the test-suite (a fake REST port and a mock fetch stand in for Discord). The Gateway worker needs the privileged intents enabled in the developer portal. Analytics are daily aggregates stored locally; nothing leaves the host except requests to the Discord API.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect assistants to your company tools with per-person, per-action grants and a full audit log.
Connect, monitor, and control AI agents — tasks, approvals, schedules, and governance.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
One place to build, share, and govern the skills and tools your AI agents use at work.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables 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.11Apache 2.0
- FlicenseAqualityCmaintenanceEnables AI clients to manage Discord servers, including channels, messages, roles, members, permissions, threads, invites, events, webhooks, and emoji, through natural language commands.551-
- -licenseNot gradedqualityNot gradedmaintenanceEnables AI clients to securely manage and automate Discord servers through natural language, covering channel and role administration, messaging, moderation, invites, and audit log inspection via 27 tools and 3 resources.-
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to interact with Discord by managing servers, channels, roles, members, messages, forum posts, reactions, webhooks, and permissions.1,560 npmMIT