Purpose
mcp-discord-bridge is an MCP (Model Context Protocol) server designed to let AI assistants control Discord servers through a standard protocol. MCP is an open standard that allows AI applications to communicate with external tools, and this project is one such tool, giving any AI assistant the ability to manage Discord servers.
Main Capabilities
Once connected, an AI assistant can perform the following operations:
- Channels: Create, delete, rename, and move channels and categories
- Messages: Read, send, edit, delete, and search messages, send direct messages, add/remove emoji reactions
- Forum Channels: List forums, create/read/reply to/delete forum posts
- Webhooks: Create, send via webhook, edit, and delete webhooks
- Members: List members, view profiles, check roles
- Roles: List, create, edit, delete, assign, and remove roles
- Moderation: Kick, ban, unban, and mute members, set nicknames
- Threads: Create, list, archive, unarchive, join, and delete threads
- Servers: List all servers the bot is in, view channel layout
In addition, it can run as a standalone Discord bot, providing the /ping, /info, and /serverinfo slash commands.
Usage
Quick Start (about 3 minutes)
Step 1: Create a Discord bot
- Go to the Discord Developer Portal
- Click New Application and give it a name
- Go to the Bot tab, click Reset Token, copy and securely save the token
Step 2: Invite the bot to a server
- In the Developer Portal, go to OAuth2 > URL Generator
- Check the following scopes: bot, applications.commands
- Check the following permissions: Send Messages, Read Message History, Manage Channels, Manage Roles, Manage Webhooks, Kick Members, Ban Members, Moderate Members, Manage Nicknames
- Open the generated URL, select the server, and authorize
Step 3: Add to an AI application Add the configuration to the application's MCP configuration; no cloning or installation is required. After restarting the AI application, you can see that the Discord tools are available. For example, you can ask: "List all channels in my Discord server".
Install from source (for contributors)
If you need to modify the code or run a standalone bot, you can install from source and then run it directly with ts-node.
Run as a standalone bot
If you only need slash commands and do not need MCP, you can run the bot standalone.
Docker deployment
By default, the Docker image runs the MCP server (stdio). If you need to run the standalone bot 24/7, you can uncomment the command: ["node", "dist/index.js"] line in docker-compose.yml, then run the deployment command.
Architecture overview
The MCP client communicates with mcp-server.ts via stdio (JSON-RPC). The server publishes tools (with read-only/destructive annotations), then dispatches each call through mcp-handlers.ts—a registry containing 44 tools that validates parameters, checks bot permissions, and enforces read-only mode. The handlers perform operations through the shared client in discord-client.ts, which is responsible for login and connection state. The standalone bot (index.ts) is a separate entry point that reuses the same client factory.
Editable source file: assets/architecture.excalidraw, which can be opened at excalidraw.com. CI runs automatically via GitHub Actions on every push and PR.
Use cases
- Users who want to automate Discord server management through an AI assistant
- Scenarios that require batch operations on channels, messages, roles, etc.
- Administrators who want to perform moderation actions (such as kick, ban) in natural language
- Developers who need to integrate Discord management into existing AI workflows
Limitations and security considerations
- This server can delete channels, ban members, and remove roles. If you only want the AI to read the server, you can set DISCORD_READONLY in the environment variables. In read-only mode, only 10 read tools (list_, get_, search_messages) are published and invoked, and all write/destructive tools are rejected.
- All tools carry MCP annotations (readOnlyHint / destructiveHint), so compatible clients can flag or confirm destructive operations before running them.
- Never commit the .env file—it is already in .gitignore.
- Treat DISCORD_TOKEN as a password—if it leaks, regenerate it immediately in the Developer Portal.
- The bot can only assign roles below its own role hierarchy (Discord enforces this restriction).
- Grant the bot only the permissions it needs—if you do not use moderation features, do not grant Ban/Kick permissions.
- Because the AI can read channel messages and perform actions on the server, untrusted message content should be treated as a prompt injection risk; for safer deployments, use read-only mode.
- For the full threat model and reporting policy, see SECURITY.md.
License
MIT—free to use.