discord-mcp
Provides tools to manage a Discord server through a self-hosted bot. Current read-only tools can list guilds, get guild details, list channels and categories, list roles with permissions, list members in pages, and retrieve individual member details including roles and timeout status. Safety settings include read-only mode, allowed guild IDs, and disabled tools.
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-mcplist all channels in my Discord server"
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-mcp
A self-hosted MCP server that lets an AI assistant (Claude Code, Claude Desktop, any MCP client) manage a Discord server through your own bot. It runs locally in Docker, talks to Discord with your bot token, and nothing else.
Built with TypeScript, discord.js, the official MCP TypeScript SDK and Bun.
Tools
Tool | What it does |
| Servers the bot is in |
| Server details: owner, member count, verification, boosts |
| All channels and categories |
| All roles with permissions, highest first |
| Members in pages of up to 1000 |
| One member with roles and timeout status |
Every tool takes an optional guild_id. Without it, the server uses DISCORD_GUILD_ID, or the only server the bot is in.
All tools in this version are read-only. Management tools (channels, roles, moderation, messages) are coming, see CHANGELOG.md.
Related MCP server: MCP-Discord
Safety
The bot can only do what its Discord permissions allow. These settings narrow that down further:
Variable | What it does |
|
|
| Comma separated server IDs. Other servers the bot is in are hidden and refused. |
| Comma separated tool names to switch off, for example |
A typo in any of them stops the server at startup instead of being silently ignored: an unknown tool name, an ID that is not a server the bot is in, or a DISCORD_GUILD_ID that is not on the allowlist.
Every tool declares MCP annotations, and startup refuses a tool that doesn't: readOnlyHint on all of them, destructiveHint on anything that writes, and a reason argument for the audit log on anything destructive. Read-only mode is driven by those same annotations, so it can't drift from what the client is told.
Write tools check permissions and role order before calling Discord. When the bot lacks a permission, or a role or member sits at or above the bot's highest role, the error says which one and how to fix it instead of returning a bare 403.
Setup
1. Create the bot
Create an application at https://discord.com/developers/applications and add a bot under the Bot tab.
Copy the bot token.
Under Privileged Gateway Intents, enable Server Members Intent.
Invite the bot from OAuth2 > URL Generator with the
botscope and the permissions you want it to have.In your server settings, drag the bot's role above any role you want it to manage.
2. Configure
cp .env.example .env
chmod 600 .envPut the token in .env:
DISCORD_TOKEN=your-bot-token
DISCORD_GUILD_ID=optional-default-server-id
ALLOWED_GUILD_IDS=
READ_ONLY=false
DISABLED_TOOLS=
LOG_LEVEL=infoSee Safety for the three middle settings.
.env is git ignored and docker ignored. The token is passed to the container at runtime and is never baked into the image.
3. Build
docker build -t discord-mcp .4. Connect it to Claude Code
claude mcp add discord -s user -- docker run --rm -i --env-file /absolute/path/to/discord-mcp/.env discord-mcpRun /mcp in Claude Code to confirm it is connected.
For other MCP clients, use the same command:
{
"mcpServers": {
"discord": {
"command": "docker",
"args": ["run", "--rm", "-i", "--env-file", "/absolute/path/to/discord-mcp/.env", "discord-mcp"]
}
}
}Development
Requires Bun 1.4 or newer.
bun install
bun run dev # run locally with watch mode, reads .env automatically
bun run check # typecheck, lint, format check and testsTo try the tools by hand, use the MCP inspector:
bunx @modelcontextprotocol/inspector bun run src/index.tsLayout
src/
index.ts entry point: config, Discord login, MCP over stdio
config.ts environment validation
discord/ Discord client, guild resolution, permission checks, response shaping
tools/ one file per tool group, registered in tools/index.ts, policy.ts
enforces annotations, READ_ONLY and DISABLED_TOOLS
lib/ logger, shared schemas, tool result helpers
tests/ bun test suitesstdout carries the MCP protocol. Log through src/lib/logger.ts, which writes to stderr, never with console.log.
License
This server cannot be deployed
Maintenance
Related MCP Connectors
Build Discord communities with AI: roles, channels, modules, automations and reviewed announcements.
Read-only Google Search Console and Google Analytics for AI agents.
- mcpOAuthcom.vibgrate
Query your team's drift, vulnerability, and upgrade data from any AI assistant. OAuth 2.1, 51 tools.
Connect a Discord bot (bot token from the developer portal) to read/send messages, list guilds and c
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to interact with Discord through a bot, supporting server and member inspection, channel and role management, message and reaction handling, forum operations, and webhook administration.542 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to interact with Discord by managing servers, channels, roles, members, messages, forum posts, reactions, webhooks, and permissions.542 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to operate a chat server by reading, sending, and managing messages, direct messages, reactions, channels, roles, and members through bot tools.PolyForm Noncommercial 1.0.0
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to interact with the Discord platform through a bot login. Supports listing servers and members, managing channels, roles, forum posts, messages, reactions, and webhooks.542 npmMIT