MCP server for controlling Discord servers via bot token
About
MCP server for controlling Discord servers via bot token
Security Report
Valid MCP server (5 strong, 3 medium validity signals). No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry.
8 files analyzed · 1 issue found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
Permissions Required
This plugin requests these system permissions. Most are normal for its category.
What You'll Need
Set these up before or after installing:
Environment variable: DISCORD_BOT_TOKEN
Environment variable: TRANSPORT
Environment variable: PORT
Environment variable: HOST
How to Install
Add this to your MCP configuration file:
{
"mcpServers": {
"discord-mcpserver": {
"command": "npx",
"args": [
"-y",
"@mahesvara/discord-mcpserver@1.2.0"
],
"env": {
"HOST": "your-host-here",
"PORT": "your-port-here",
"TRANSPORT": "your-transport-here",
"DISCORD_BOT_TOKEN": "your-discord-bot-token-here"
}
}
}
}Some servers take additional arguments. See the repository for details.
Documentation
View on GitHubFrom the project's GitHub README.
Discord MCP Server
An MCP (Model Context Protocol) server that enables LLMs to control Discord servers via a bot token. This server provides comprehensive Discord management tools including sending messages, managing members, roles, channels, permissions, and more.
Features
Guild/Server Management
discord_list_guilds- List all servers the bot has access todiscord_get_guild- Get detailed info about a specific serverdiscord_edit_guild- Edit server settings (name, verification level, system channels, etc.)discord_leave_guild- Leave a server
Channel Management
discord_list_channels- List channels visible to the bot in a server (filter by type)discord_get_channel- Get channel details (includes forum tags for forum channels)discord_create_channel- Create text/voice/forum channels and categoriesdiscord_edit_channel- Edit channel name, topic, position, category, forum tags, and morediscord_delete_channel- Delete a channel or category
Forum Channel Features
- Create forum channels with
type: "forum" - Set default reaction emoji, sort order, and layout
- Manage forum tags (create, edit, delete)
- Tags support custom emojis and moderation settings
Forum Post Management
discord_create_forum_post- Create a forum post with a title, a rich opening message, applied tags, and an auto-archive durationdiscord_list_forum_posts- List posts in a forum channel (optionally including archived posts)discord_get_forum_post- Get a single post's details (tags, archived/locked/pinned status, message count)discord_edit_forum_post- Moderate a post: rename, retag, archive/reopen, lock/unlock, or pin/unpindiscord_delete_forum_post- Permanently delete a forum post- To reply within an existing post, use
discord_send_messagewith the post's ID as thechannel_id
Permission Management
discord_set_channel_permissions- Set permission overrides for roles/members on channelsdiscord_remove_channel_permissions- Remove permission overridesdiscord_get_channel_permissions- View all permission overrides on a channeldiscord_sync_channel_permissions- Sync channel permissions with parent categorydiscord_get_member_permissionsanddiscord_get_role_permissions- Get Discord's effective permissions for a member or role. Usescope: { "guild_id": "..." }for server permissions orscope: { "channel_id": "..." }for channel permissions. Setimplicit: falsein the channel scope to skip implicit permission masking.
Message Operations
discord_send_message- Send messages with optional replies, embeds, files, and link buttonsdiscord_get_messages- Retrieve channel messages (with pagination)discord_search_guild_messages- Search server messages by text, author, channel, and other filters. Requires the Message Content intent and Read Message History.discord_edit_message- Edit the bot's messages and their attachment descriptions or spoiler flagsdiscord_delete_message- Delete messagesdiscord_add_reaction- Add emoji reactionsdiscord_remove_reaction- Remove bot's reactionsdiscord_pin_message- Pin a messagediscord_unpin_message- Unpin a messagediscord_get_pinned_messages- Get the first 50 pinned messages. Passlimitorbeforeto receive pagination metadata, then usenext_beforeto retrieve the next page.
Rich messages and forum openings
discord_send_message and discord_create_forum_post accept content, embeds, link_buttons, and files. Each link button takes a label and HTTPS or HTTP url. Each file takes a filename, raw data_base64, and optional description and is_spoiler fields. You can upload up to 10 files totaling 20 MiB per call.
To ping only a release role, include its <@&ROLE_ID> mention in content and pass allowed_mentions with that role ID. An empty allowed_mentions object suppresses pings.
{
"channel_id": "123456789012345678",
"content": "<@&234567890123456789> The release is ready.",
"allowed_mentions": { "role_ids": ["234567890123456789"] },
"link_buttons": [{ "label": "Download", "url": "https://example.com/releases" }]
}
To change an existing file, find its ID in discord_get_messages under attachmentDetails, then pass attachment_updates with the attachment_id and a new description, is_spoiler, or both to discord_edit_message. A null description clears the alt text. New files are appended and existing files are retained.
Polls
discord_create_pollposts a native poll. Pass achannel_id, aquestion, and up to 10answerssuch as[{"text":"Friday"},{"text":"Saturday"}]. Setduration_hoursto change the 24-hour default orallow_multiselectto allow multiple choices.discord_get_pollreads the poll and its latest vote counts bychannel_idandmessage_id. Anullcount means Discord has yet to provide results.discord_end_pollcloses a poll the bot created. Usediscord_get_pollagain for the final tally if Discord is still counting votes.
Member Management
discord_list_members- List server members. Pass the highest returned user ID asafterto get the next page.discord_get_member- Get member detailsdiscord_kick_member- Kick a memberdiscord_ban_member- Ban a member (with message deletion option)discord_unban_member- Unban a userdiscord_set_nickname- Set/clear member nicknamediscord_move_member- Move member to a different voice channeldiscord_timeout_member- Timeout/mute a member (up to 28 days)
Role Management
discord_list_roles- List all server rolesdiscord_get_guild_role_member_counts- Get Discord's member counts for each server rolediscord_create_role- Create a new rolediscord_edit_role- Edit role name, color, permissions, and settingsdiscord_delete_role- Delete a rolediscord_add_role- Assign role to memberdiscord_remove_role- Remove role from memberdiscord_set_role_positions- Reorder role hierarchy
Server Administration
discord_list_bans- List all banned usersdiscord_prune_members- Remove inactive members (with dry-run option)discord_get_audit_log- Filter audit entries by user or by a numeric or namedaction_type, such asCHANNEL_POSITION_UPDATEorROLE_POSITION_UPDATE. Entries include Discord's event details, such as the count for merged reorder entries. Setinclude_pagination: trueon the first page, then passnext_beforeasbeforefor older entries ornext_afterasafterfor newer entries. To page from oldest to newest, start withafter: "0".
Community Features
discord_get_community_settings- View community settings (rules channel, features, etc.)discord_setup_community- Configure community channels (rules, updates, safety alerts)
Welcome Screen
discord_get_welcome_screen- Get welcome screen configurationdiscord_edit_welcome_screen- Edit welcome screen (description, channels, emojis)
Onboarding
discord_get_onboarding- Get onboarding configurationdiscord_edit_onboarding- Edit existing onboarding settingsdiscord_setup_onboarding- Setup onboarding from scratch (prompts, default channels, roles)
Auto Moderation
discord_list_automod_rules- List auto moderation rulesdiscord_get_automod_rule- Get details of an auto mod rulediscord_create_automod_rule- Create auto moderation rulediscord_edit_automod_rule- Edit auto moderation rulediscord_delete_automod_rule- Delete auto moderation rule
Emoji Management
discord_list_emojis- List custom emojisdiscord_create_emoji- Create emoji from image URLdiscord_delete_emoji- Delete a custom emoji
Sticker Management
discord_list_stickers- List custom stickersdiscord_delete_sticker- Delete a custom sticker
Invite Management
discord_list_invites- List active invitesdiscord_create_invite- Create channel invitediscord_list_invite_target_users- List the users eligible to accept a restricted invitediscord_edit_invite_target_users- Add or remove users from an invite usinginvite_code,action(addorremove), anduser_idsdiscord_delete_invite- Delete an invite
Pass target_user_ids to discord_create_invite to limit acceptance to up to 1,000 specified users. Pass role_ids to grant roles when users accept. Either option creates a fresh invite code. Granting roles requires Manage Roles and sufficient role hierarchy. Removing a target user affects future acceptance of the invite.
Webhook Management
discord_list_webhooks- List webhooks (guild or channel)discord_create_webhook- Create a webhookdiscord_edit_webhook- Edit webhook name or channeldiscord_delete_webhook- Delete a webhook
Scheduled Events
discord_list_events- List scheduled eventsdiscord_create_event- Create a scheduled event (stage, voice, or external)discord_delete_event- Delete a scheduled event
Bot Profile
discord_update_bot_profileupdates the bot's globalavatarandbanner.discord_update_bot_guild_profiletakes aguild_idand updates the bot'snickname,avatar, orbannerin that server. Changing its nickname requires Change Nickname in that server.
Provide at least one profile field per call. Omit a field to keep it or pass null to clear it. Each image can be a PNG, JPEG, or GIF up to 10 MiB, supplied as a base64 data URI or an HTTPS URL from cdn.discordapp.com or media.discordapp.net. For example, call discord_update_bot_guild_profile with {"guild_id":"123456789012345678","nickname":"Party Bot","banner":null} to set the nickname and clear the server banner.
Setup
1. Create a Discord Bot
- Go to the Discord Developer Portal
- Click "New Application" and give it a name
- Go to the "Bot" section and click "Add Bot"
- Copy the bot token (keep this secret!)
- Enable these Privileged Gateway Intents:
- Server Members Intent
- Message Content Intent
2. Invite the Bot to Your Server
-
Go to OAuth2 -> URL Generator
-
Select scopes:
bot,applications.commands -
Select bot permissions (choose based on features you need):
Core Permissions:
- Manage Channels
- Manage Roles
- Manage Messages
- Pin Messages (for pinning and unpinning messages)
- Read Message History
- Send Messages
- Send Polls (for creating polls)
- Add Reactions
Member Management:
- Kick Members
- Ban Members
- Change Nickname (for the bot's own server nickname)
- Manage Nicknames
- Moderate Members (for timeouts)
Server Administration:
- Manage Guild (for server settings)
- View Audit Log
- Create Expressions (for creating custom emoji)
- Manage Expressions (for managing custom emoji and stickers)
- Manage Webhooks
- Create Events (for creating scheduled events)
- Manage Events (for managing other scheduled events)
- Create Instant Invite
-
Copy the generated URL and open it to invite the bot
3. Install the MCP Server
Requires Node.js 20 or later.
Option A: Install globally from npm
npm install -g @mahesvara/discord-mcpserver
Option B: Run directly with npx (no install required)
npx @mahesvara/discord-mcpserver
Usage
MCP Client Configuration
Add to your MCP client configuration (e.g., Claude Desktop or Claude Code):
Using globally installed package:
{
"mcpServers": {
"discord": {
"command": "discord-mcpserver",
"env": {
"DISCORD_BOT_TOKEN": "your_bot_token_here"
}
}
}
}
Using npx (no install required):
{
"mcpServers": {
"discord": {
"command": "npx",
"args": ["-y", "@mahesvara/discord-mcpserver"],
"env": {
"DISCORD_BOT_TOKEN": "your_bot_token_here"
}
}
}
}
Environment Variables
The server supports loading environment variables from a .env file in the current directory:
DISCORD_BOT_TOKEN=your_bot_token_here
TRANSPORT=http
PORT=3000
HOST=localhost
| Variable | Description | Default |
|---|---|---|
DISCORD_BOT_TOKEN | Your Discord bot token (required) | - |
TRANSPORT | Transport mode: stdio or http | stdio |
PORT | HTTP server port (when using http transport) | 3000 |
HOST | HTTP server host (use 0.0.0.0 for remote access) | localhost |
HTTP Transport
For remote access, run the server with HTTP transport enabled:
Linux/macOS:
DISCORD_BOT_TOKEN=your_token TRANSPORT=http PORT=3000 HOST=0.0.0.0 discord-mcpserver
Windows (Command Prompt):
set DISCORD_BOT_TOKEN=your_token && set TRANSPORT=http && set PORT=3000 && set HOST=0.0.0.0 && discord-mcpserver
Windows (PowerShell):
$env:DISCORD_BOT_TOKEN="your_token"; $env:TRANSPORT="http"; $env:PORT="3000"; $env:HOST="0.0.0.0"; discord-mcpserver
Or use a .env file (works on all platforms):
discord-mcpserver
Then configure your MCP client to connect via HTTP:
{
"mcpServers": {
"discord": {
"type": "http",
"url": "http://your-server-ip:3000/mcp"
}
}
}
Tool Examples
Create a Forum Channel with Tags
{
"tool": "discord_create_channel",
"params": {
"guild_id": "1234567890123456789",
"name": "help-forum",
"type": "forum",
"topic": "Ask questions and get help",
"default_reaction_emoji": "✅",
"default_sort_order": "latest_activity",
"default_forum_layout": "list_view",
"available_tags": [
{ "name": "Solved", "emoji_name": "✅", "moderated": false },
{ "name": "Bug", "emoji_name": "🐛", "moderated": false },
{ "name": "Question", "emoji_name": "❓", "moderated": false },
{ "name": "Announcement", "emoji_name": "📢", "moderated": true }
]
}
}
Setup Server Onboarding
{
"tool": "discord_setup_onboarding",
"params": {
"guild_id": "1234567890123456789",
"default_channel_ids": ["1111111111111111111"],
"prompts": [
{
"type": "multiple_choice",
"title": "What are you interested in?",
"single_select": false,
"required": true,
"options": [
{ "title": "Gaming", "emoji_name": "🎮", "role_ids": ["2222222222222222222"] },
{ "title": "Tech", "emoji_name": "💻", "role_ids": ["3333333333333333333"] }
]
}
]
}
}
Configure Community Settings
{
"tool": "discord_setup_community",
"params": {
"guild_id": "1234567890123456789",
"rules_channel_id": "1111111111111111111",
"public_updates_channel_id": "2222222222222222222",
"description": "A friendly gaming community",
"preferred_locale": "en-US"
}
}
Edit Welcome Screen
{
"tool": "discord_edit_welcome_screen",
"params": {
"guild_id": "1234567890123456789",
"enabled": true,
"description": "Welcome to our server!",
"welcome_channels": [
{ "channel_id": "1111111111111111111", "description": "Read the rules", "emoji_name": "📜" },
{ "channel_id": "2222222222222222222", "description": "Introduce yourself", "emoji_name": "👋" }
]
}
}
Create a Category
{
"tool": "discord_create_channel",
"params": {
"guild_id": "1234567890123456789",
"name": "Bot Testing",
"type": "category"
}
}
Create a Channel in a Category
{
"tool": "discord_create_channel",
"params": {
"guild_id": "1234567890123456789",
"name": "bot-commands",
"type": "text",
"topic": "Channel for bot interactions",
"parent_id": "CATEGORY_ID_HERE"
}
}
Set Channel Permissions
{
"tool": "discord_set_channel_permissions",
"params": {
"channel_id": "1234567890123456789",
"target_id": "ROLE_ID_HERE",
"target_type": "role",
"allow": ["ViewChannel", "SendMessages", "ReadMessageHistory"],
"deny": ["CreatePublicThreads"]
}
}
Common Permission Names
View & Access:
ViewChannel- See the channel
Messages:
SendMessages,ReadMessageHistory,ManageMessagesEmbedLinks,AttachFiles,AddReactionsUseExternalEmojis,UseExternalStickersMentionEveryone
Threads:
CreatePublicThreads,CreatePrivateThreadsSendMessagesInThreads,ManageThreads
Voice:
Connect,Speak,StreamMuteMembers,DeafenMembers,MoveMembersUseVAD,PrioritySpeaker
Management:
ManageChannels,ManageRoles,ManageWebhooks
Send a Message
{
"tool": "discord_send_message",
"params": {
"channel_id": "1234567890123456789",
"content": "Hello from the MCP server!"
}
}
Assign a Role
{
"tool": "discord_add_role",
"params": {
"guild_id": "1234567890123456789",
"user_id": "9876543210987654321",
"role_id": "1111111111111111111"
}
}
Response Formats
Most read operations support two response formats:
- json (default): Structured data for programmatic processing
- markdown: Human-readable formatted output
Error Handling
All tools return clear error messages with suggestions when operations fail:
- Missing permissions
- Invalid IDs (guild, channel, user, role, message)
- Rate limiting
- Network issues
Security Notes
- Never commit your bot token - use environment variables
- The bot can only operate in servers it's been invited to
- Destructive operations (delete, kick, ban) are marked with
destructiveHint: true - All inputs are validated with Zod schemas
Required Bot Permissions
Depending on which tools you use, your bot needs these permissions:
| Tool Category | Required Permissions |
|---|---|
| Messages | Send Messages, Read Message History, Manage Messages |
| Channels | Manage Channels |
| Permissions | Manage Roles (for channel permission overrides) |
| Members | Kick Members, Ban Members, Manage Nicknames, Moderate Members |
| Roles | Manage Roles |
| Reactions | Add Reactions |
| Server Settings | Manage Guild |
| Emojis/Stickers | Manage Emojis and Stickers |
| Invites | Create Instant Invite, Manage Guild |
| Webhooks | Manage Webhooks |
| Events | Manage Events |
| Audit Log | View Audit Log |
| Community/Onboarding | Manage Guild |
Tool Examples
Edit Role Permissions
{
"tool": "discord_edit_role",
"params": {
"guild_id": "1234567890123456789",
"role_id": "1111111111111111111",
"name": "Moderators",
"color": 3447003,
"permissions": ["KickMembers", "BanMembers", "ManageMessages", "ModerateMembers"]
}
}
Reorder Role Hierarchy
{
"tool": "discord_set_role_positions",
"params": {
"guild_id": "1234567890123456789",
"positions": [
{ "role_id": "1111111111111111111", "position": 5 },
{ "role_id": "2222222222222222222", "position": 4 }
]
}
}
Timeout a Member
{
"tool": "discord_timeout_member",
"params": {
"guild_id": "1234567890123456789",
"user_id": "9876543210987654321",
"duration_minutes": 60,
"reason": "Spamming in chat"
}
}
Create an Invite
{
"tool": "discord_create_invite",
"params": {
"channel_id": "1234567890123456789",
"max_age": 86400,
"max_uses": 10,
"temporary": false
}
}
Create a Scheduled Event
{
"tool": "discord_create_event",
"params": {
"guild_id": "1234567890123456789",
"name": "Community Game Night",
"description": "Join us for games!",
"scheduled_start_time": "2024-12-01T20:00:00Z",
"entity_type": "voice",
"channel_id": "1111111111111111111"
}
}
Role Permission Names
When editing roles, use these permission names:
General:
Administrator- Full access (use with caution)ManageGuild,ManageRoles,ManageChannelsKickMembers,BanMembers,ModerateMembersViewAuditLog,ViewGuildInsights
Messages:
SendMessages,ManageMessages,ReadMessageHistoryEmbedLinks,AttachFiles,AddReactionsMentionEveryone,UseExternalEmojis
Voice:
Connect,Speak,StreamMuteMembers,DeafenMembers,MoveMembers
Other:
ManageWebhooks,ManageEmojisAndStickersManageEvents,CreateEvents
License
MIT
Reviews
No reviews yet
Be the first to review this server!
More Communication MCP Servers
Toleno
Freeby Toleno · Developer Tools
Toleno Network MCP Server — Manage your Toleno mining account with Claude AI using natural language.
MCP Marketplace
Freeby mcp-marketplace · Developer Tools
Search and install MCP servers from inside your AI client.
mcp-creator-python
Freeby mcp-marketplace · Developer Tools
Create, build, and publish Python MCP servers to PyPI — conversationally.
by Lharries · Communication
Read, search, and send WhatsApp messages through your AI assistant
FinAgent
Freeby mcp-marketplace · Finance
Free stock data and market news for any MCP-compatible AI assistant.
Memory
Freeby Modelcontextprotocol · Productivity
Knowledge graph-based persistent memory across sessions