discord-bot-mcp
Provides tools for operating a Discord bot via the Discord REST API, enabling management of messages, channels, threads, roles, members, and other guild administration tasks.
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-bot-mcp send a welcome message to #general"
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.
Discord Bot MCP
A local Model Context Protocol (MCP) server that lets an MCP client operate your Discord bot through Discord's REST API. It provides focused messaging tools, grouped administration tools, guild scoping, opt-in writes, and secret redaction.
This is a wrapper aroundDiscord bot capabilities. It does not sign in as you, impersonate your personal Discord account, or send messages from your user identity. Every action is performed by the bot account you create, with that bot's name, avatar, roles, and Discord permissions.
What it can do
The server exposes 20 MCP tools:
Area | Tools and capabilities |
Everyday use | Get the server, list channels, read/send messages, create threads, add reactions |
Server structure | Server settings, channels, categories, permission overwrites, roles |
Community administration | Members, bans, timeouts, scheduled events, AutoMod, emojis, stickers |
Content administration | Edit/delete/pin messages, threads and membership, invites, webhooks |
Oversight | Audit-log queries and a guarded raw Discord REST request tool |
See TOOLS.md for every tool, operation, and safety gate.
Related MCP server: Discord MCP Server
Safety model
One instance is pinned to one
DISCORD_GUILD_ID.An optional channel allowlist narrows ordinary channel-scoped operations.
Writes are off unless
DISCORD_ALLOW_WRITES=true.Destructive/admin mutations additionally require
DISCORD_ALLOW_DESTRUCTIVE_ADMIN=true.Cross-guild raw API paths, full URLs, and traversal are rejected.
Token-, secret-, and password-like response fields are redacted.
Outgoing messages disable automatic
@everyone, role, and user mention parsing.Credentials stay in each operator's environment or macOS Keychain.
Guild-wide administration tools are intentionally guild-wide; for example, listing roles or members is not filtered by a channel allowlist. These controls supplement Discord permissions rather than replacing them. Give the bot only the Discord role permissions it actually needs.
Start here: macOS + Codex
1. Install prerequisites
A Discord server where you can add a bot
An MCP-capable client such as Codex
Check the command-line tools:
node --version
pnpm --version2. Create your Discord application and bot
Open the Discord Developer Portal → Applications.
Select New Application, give it a recognizable name, and create it.
Open Bot in the left sidebar. Discord creates the bot user for the app.
Set the bot's username and avatar. This is the identity people will see.
Under Privileged Gateway Intents, enable only intents your use case requires. This MCP currently uses the REST API, so most installations do not need privileged gateway intents.
Useful official references:
3. Install the bot in your server
In the Developer Portal, open OAuth2 → URL Generator.
Select the
botscope.Select the smallest required bot permissions.
Open the generated URL, choose your server, and authorize the bot.
For ordinary use, start with View Channels, Read Message History, Send Messages, Create Public Threads, and Add Reactions. Add Manage Channels, Manage Roles, Manage Messages, or other permissions only when you intend to use those admin operations. Administrator is convenient for a private test server but is not the recommended default.
Review Discord's permissions reference before granting administration rights.
4. Copy the server ID
In Discord, open User Settings → Advanced and enable Developer Mode.
Then right-click the server icon and select Copy Server ID. Discord calls a
server a guild in its API, so this value becomes DISCORD_GUILD_ID.
Discord's official guide to copying IDs
5. Store the bot token safely
On the application's Bot page, select Reset Token and copy the new token once. Never paste it into a chat, README, issue, Codex configuration, or Git repository.
On macOS, store it in Keychain without echoing it to the terminal:
security add-generic-password \
-U \
-s discord-bot-mcp-my-bot \
-a "$USER" \
-wThe command prompts for the token. Each teammate uses a different Keychain entry and preferably their own Discord bot; sharing this repository never shares a bot identity or token.
If a token is exposed, immediately reset it in the Developer Portal. Deleting the text later does not make the old token safe.
6. Clone and build
git clone https://github.com/diocata/discord-bot-mcp.git
cd discord-bot-mcp
pnpm install --frozen-lockfile
pnpm verifypnpm verify type-checks the code, runs unit and MCP integration tests, and
builds dist/index.js.
7. Register it with Codex
Find the absolute paths you will use:
which node
pwdAdd the following to ~/.codex/config.toml, replacing the example paths, guild
ID, Keychain service, and macOS account:
[mcp_servers.discord]
command = "/absolute/path/from/which/node"
args = ["/absolute/path/to/discord-bot-mcp/dist/index.js"]
[mcp_servers.discord.env]
DISCORD_GUILD_ID = "your_server_id"
DISCORD_KEYCHAIN_SERVICE = "discord-bot-mcp-my-bot"
DISCORD_KEYCHAIN_ACCOUNT = "your-macos-account-name"
DISCORD_ALLOW_WRITES = "false"
DISCORD_ALLOW_DESTRUCTIVE_ADMIN = "false"
DISCORD_ALLOWED_CHANNEL_IDS = ""Restart Codex or open a new task so the MCP tools are discovered. Start in read-only mode and ask it to list the Discord server and channels. After that works, opt into ordinary writes:
DISCORD_ALLOW_WRITES = "true"Only enable destructive administration when you intentionally need it:
DISCORD_ALLOW_DESTRUCTIVE_ADMIN = "true"8. Try it
Example requests to your MCP client:
List the Discord channels you can access.
Read the latest 10 messages in #general.
Send “Hello from my bot” in #bot-testing.
Create a thread called “MVP feedback” in #product.Use a dedicated test channel first. Confirm in Discord that messages show the
bot's name and BOT badge—not your personal user identity.
Other operating systems and clients
On Linux, Windows, containers, or CI, inject DISCORD_BOT_TOKEN into the MCP
process through the platform's secret manager. Do not put a real token in a
tracked .env file. All other variables are identical.
The server uses standard MCP over stdio and is not tied to Codex. Configure the same executable and environment variables in any MCP client that supports a local stdio server.
Configuration reference
Variable | Required | Default | Meaning |
| Yes | — | The only Discord server this instance may operate |
| macOS option | — | Keychain service containing the token |
| No | — | Narrows the Keychain lookup to one account |
| Non-Keychain option | — | Bot token supplied by the process environment |
| No |
| Enables messaging and other ordinary mutations |
| No |
| Enables admin/destructive and raw non-GET operations |
| No | all guild channels | Comma-separated IDs for ordinary channel-scoped tools |
If DISCORD_KEYCHAIN_SERVICE is set, the Keychain token takes precedence over
DISCORD_BOT_TOKEN.
Development and tests
pnpm check # TypeScript without emitting files
pnpm test:unit # HTTP behavior and security boundaries
pnpm test:integration # Real MCP client/server protocol interaction
pnpm test:live # Optional read-only test against your configured bot
pnpm build # Production JavaScript and declarations
pnpm verify # All gates aboveThe integration suite uses in-memory MCP transports and a mock Discord API. It does not require a real token and never sends a live Discord message. CI runs the complete verification matrix on Node.js 20, 22, and 24.
pnpm test:live is an optional, read-only smoke test. It requires the same
Discord environment variables as the MCP server and verifies the configured
bot can retrieve exactly one guild and its allowed channels. It forcibly
disables writes regardless of the supplied write flags.
Troubleshooting
DISCORD_GUILD_ID is required— add the server ID to the MCP environment.No token was found in macOS Keychain — make the service and account match the
security add-generic-passwordcommand exactly.Missing Access/Missing Permissions— give the bot's Discord role the specific permission needed and ensure its role is high enough in the role list.Writes are disabled — set
DISCORD_ALLOW_WRITES=trueand restart the MCP client.Destructive administration is disabled — enable its separate flag only for the operation, then turn it off again.
Tools do not appear — run
pnpm build, verify both absolute paths, and restart the MCP client.
License
Available Tools
20 toolsdiscord_add_reactionAIdempotent
Add a reaction as the configured bot. Writes must be enabled locally.
Inputs: emoji (required), channelId (required), messageId (required).
discord_admin_audit_logBRead-only
Read the server audit log with Discord's standard filters.
Inputs: after, limit, before, userId, +1 more.
discord_admin_automodBDestructive
List, get, create, update, or delete AutoMod rules.
Inputs: operation (required), data, itemId, reason.
discord_admin_channelsBDestructive
List, create, update, delete, reorder, or change permission overwrites for rooms and categories.
Inputs: operation (required), data, reason, targetId, +1 more.
discord_admin_emojisCDestructive
List, get, create, update, or delete server emojis.
Inputs: operation (required), data, itemId, reason.
discord_admin_eventsCDestructive
List, create, update, or delete scheduled server events.
Inputs: operation (required), data, itemId, reason.
discord_admin_invitesADestructive
List or create invites for the server/channels. Deletion is available through the guarded raw admin tool.
Inputs: operation (required), data, reason, channelId.
discord_admin_membersCDestructive
Inspect or administer members, roles, timeouts, voice state, kicks, and bans.
Inputs: operation (required), data, after, limit, +4 more.
discord_admin_messagesCDestructive
Get, edit, delete, bulk-delete, pin, unpin, or list pinned messages.
Inputs: channelId (required), operation (required), data, reason, +1 more.
discord_admin_requestADestructive
Advanced access to any Discord REST endpoint scoped to the configured guild, its channels, or its webhooks. Non-GET calls require destructive admin to be enabled locally. Full URLs and cross-guild paths are rejected; returned secrets are redacted.
Inputs: path (required), method (required), data, reason.
discord_admin_rolesBDestructive
List, create, update, reorder, or delete server roles.
Inputs: operation (required), data, reason, roleId.
discord_admin_serverCDestructive
Read or modify the configured Discord server's settings.
Inputs: operation (required), data, days, reason, +1 more.
discord_admin_stickersBDestructive
List, get, create, update, or delete server stickers using JSON-capable endpoints.
Inputs: operation (required), data, itemId, reason.
discord_admin_threadsCDestructive
List active threads or update and manage thread membership.
Inputs: operation (required), data, reason, userId, +1 more.
discord_admin_webhooksADestructive
List, create, update, or delete webhooks. Returned webhook tokens are always redacted.
Inputs: operation (required), data, reason, channelId, +1 more.
discord_create_threadA
Create a public thread in an allowed text channel. Writes must be enabled locally.
Inputs: name (required), channelId (required), autoArchiveMinutes.
discord_get_serverARead-only
Get the Discord server configured for this local MCP instance.
Inputs: no named parameters.
discord_list_channelsARead-only
List channels visible through this local MCP instance. A local allowlist may narrow the result.
Inputs: no named parameters.
discord_read_messagesARead-only
Read recent messages from an allowed channel.
Inputs: channelId (required), limit.
discord_send_messageA
Send a Discord message or reply as the configured bot. Writes must be enabled locally.
Inputs: content (required), channelId (required), replyToMessageId.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Most tools have clearly distinct purposes, but there is overlap between basic interaction tools and admin tools, e.g., discord_list_channels vs discord_admin_channels both list channels, and discord_read_messages vs discord_admin_messages both read messages. The admin prefix helps, but an agent might still misselect when a simple action could be done by either.
The naming is largely consistent: basic tools use discord_verb_noun (e.g., discord_list_channels, discord_send_message), while admin tools uniformly use discord_admin_resource (e.g., discord_admin_roles, discord_admin_webhooks). The main inconsistency is discord_get_server vs discord_admin_server, and 'read' vs 'list' verbs, but the overall pattern is predictable.
20 tools is borderline heavy. The count is justified by the broad admin scope covering many Discord resources, but it feels somewhat large for a single MCP server. The basic interaction tools are only 5, while the admin tools take up 15, making the set feel imbalanced.
The tool set covers a comprehensive range of Discord server operations: channels, roles, members, messages, threads, events, automod, emojis, stickers, webhooks, invites, and audit logs. Basic bot interactions (send, read, react, thread) are included, and the raw admin request tool fills any remaining gaps, leaving no obvious dead ends.
Maintenance
Related MCP Connectors
An MCP server that integrates with Discord to provide AI-powered features.
Discord MCP server for ChatGPT, Claude and any AI agent: list servers and channels, read channel messages, search messages, send message, reply to message, send DM, read mentions and assign role in your own Discord account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Discord yourself; Cotlet does not store your password and you need no Discord API key. About the official Discord API: Yes, Discord has an official API for bots and OAuth2 apps, but it acts as a bot that a server manager adds, not as you, and Discord has no official MCP server for it (checked 5 Nov 2026). The MCP server on Discord's docs site only searches documentation. Setup and FAQ: https://cotlet.dev/integrations/discord-api-mcp-server
- Discortics - Discord BotDeprecatedcom.discortics
Set up and manage your Discord server from MCP: channels, roles, verification, tickets and security.
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceLets any MCP-compatible AI client interact with Discord — send messages, manage channels, create webhooks, assign roles, and more.95 npm2MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables LLMs to control Discord servers via a bot token, providing comprehensive management tools for messages, members, roles, channels, permissions, and more.6758 npmMIT
- FlicenseCqualityDmaintenanceAn MCP server that exposes Discord bot actions as tools for LLM clients.291-
- AlicenseNot gradedqualityFmaintenanceMCP server that gives AI agents first-class access to Discord, enabling discovery, messaging, channel management, moderation, and arbitrary REST calls through typed, consent-aware tools.3MIT