Discord MCP
Enables managing Discord servers through a bot, including channel and role administration, messaging, and direct Discord API calls via MCP tools.
README
Discord MCP for Codex
<img src="./assets/icon.png" alt="Discord MCP icon" width="128">
Discord MCP is a local Codex plugin that exposes a Discord bot as MCP tools. Codex starts the bridge when needed; no always-running gateway service or public server is required.
[!IMPORTANT] This project is not affiliated with or endorsed by Discord. Discord is a trademark of Discord Inc. Use the bot only in servers where you are authorized to administer it.
Requirements
- Codex desktop with local plugin support
- Node.js 18 or newer
- A Discord application with a bot user
What it can do
- Check bot connectivity and generate an invite URL
- List accessible servers, channels, and roles
- Create, edit, and delete channels
- Send messages
- Create, edit, and delete roles
- Add and remove member roles
- Call any guild-scoped Discord API v10 JSON endpoint through guarded read/write fallback tools
The fallback layer covers moderation, bans, timeouts, AutoMod, threads, reactions, emojis, stickers, scheduled events, onboarding, soundboard, permissions, bot-managed webhooks, and new guild-scoped REST endpoints without waiting for a plugin update.
Discord still enforces the bot's permissions, enabled intents, and role hierarchy. Destructive tools require a target-specific confirmation token. Every generic write is previewed and requires a request-bound confirmation token before execution.
Setup
-
In the Discord Developer Portal, create an application and add a bot.
-
Reset/copy the bot token. Never paste it into chat or save it in this plugin folder.
-
Run PowerShell and execute:
& "$HOME\plugins\discord-mcp\scripts\configure.ps1"The script securely prompts for the token and optionally for a comma-separated guild ID allowlist. It stores the values in your Windows user environment so Codex can forward them to the MCP process.
-
Restart the Codex desktop app after configuration.
-
Install/enable Discord MCP from the Personal marketplace, then start a new task.
-
Ask: "Check my Discord bot status and give me its Administrator invite URL."
-
Open the Administrator invite URL and authorize the bot for the intended server. The status result also includes a least-privilege alternative.
To find a guild ID, enable Developer Mode in Discord, right-click the server icon, and choose Copy Server ID. Supplying DISCORD_ALLOWED_GUILD_IDS is strongly recommended; the bridge rejects every guild outside that list.
Install from source
- Clone this repository into your local Codex plugins directory as
discord-mcp. - Add the plugin to a local Codex marketplace or use the repository's plugin manifest with your existing local-plugin workflow.
- Configure the bot credentials as described below.
- Install or enable Discord MCP, restart Codex, and start a new task.
The plugin manifest is located at .codex-plugin/plugin.json, and the MCP
server definition is in .mcp.json.
Release downloads
Every push to main that passes the test suite creates a GitHub Release with:
- A versioned
discord-mcp-vX.Y.Z-build.N.zipplugin archive - A matching SHA-256 checksum file
- Automatically generated release notes
The archive extracts into a discord-mcp directory and can be placed directly
in a local Codex plugins directory. The semantic version comes from
package.json; the GitHub Actions run number makes every main-branch build
uniquely downloadable.
Configuration
DISCORD_BOT_TOKEN(required): Discord bot token.DISCORD_ALLOWED_GUILD_IDS(recommended): comma-separated Discord guild IDs.
Run scripts/configure.ps1 -Clear to remove both user environment variables.
On macOS or Linux, set the same variables in the environment used to launch Codex. For example:
export DISCORD_BOT_TOKEN='your-token'
export DISCORD_ALLOWED_GUILD_IDS='123456789012345678'
Do not put real values in a tracked file or paste them into a Codex task.
Administrator access
discord_status now returns:
administrator_invite_url, which requests Discord'sADMINISTRATORpermission bit (8)least_privilege_invite_url, which requests only the plugin's common management permissionsinvite_url, which points to the Administrator invite for convenience
For a bot already in the server, reauthorize it with administrator_invite_url or enable Administrator on its bot role in Server Settings → Roles. Move the bot role above every role it needs to manage. Administrator bypasses channel permission overwrites, but it does not bypass role hierarchy and cannot act on the server owner.
Architecture
Codex communicates with a dependency-free local Node.js MCP server over stdio. The MCP server calls Discord API v10 over HTTPS using the bot token. It does not listen on a network port, receive Discord messages, or require privileged gateway intents.
Coverage and limits
The guarded fallback tools support guild-scoped JSON REST endpoints using GET, POST, PUT, PATCH, and DELETE. They resolve guild ownership from guild, channel, stage, invite, or bot-authenticated webhook routes before making a request.
This on-demand local bridge does not implement Discord Gateway event listeners, persistent presence, voice/audio streaming, interaction callbacks that require temporary tokens, OAuth user flows, webhook-token execution routes, or multipart file uploads. Those features require a separate continuously running bot runtime or a purpose-built upload flow. Credential-bearing routes and JSON fields are deliberately blocked.
Security notes
- Administrator is extremely powerful. Use it only in servers you control, keep the guild allowlist enabled, and protect the bot token like a password.
- Keep the allowlist enabled.
- Discord audit-log reasons are sent for supported administrative changes.
- Raw writes are bound to their method, path, query, body, and audit reason; changing any of them invalidates the confirmation token.
- Credential-like fields are blocked in request bodies and recursively redacted from raw API responses.
- Rotate the bot token immediately in the Developer Portal if it is ever exposed.
See SECURITY.md for private vulnerability-reporting guidance.
Development
The MCP server has no runtime package dependencies. Run the local checks and protocol smoke test with:
npm test
The smoke test uses a placeholder token and does not call Discord. Pull requests are also checked by GitHub Actions. See CONTRIBUTING.md for contribution guidelines and CHANGELOG.md for release history.
License
The source code is available under the MIT License. Third-party names, logos, and trademarks remain the property of their respective owners.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。