Discord MCP Server

Discord MCP Server

Provides comprehensive administrative control over Discord communities through 128 operations covering moderation, messaging, and channel management. It enables AI assistants to manage server roles, events, and automations via the Model Context Protocol.

Category
访问服务器

README

Discord MCP Server

A Model Context Protocol (MCP) server that provides full administrative control over Discord communities. Enables AI assistants like Claude to manage Discord servers through 128 operations covering messages, moderation, channels, roles, events, and more.

Features

  • Messages: Send, read, edit, delete, pin messages and manage reactions
  • Moderation: Kick, ban, timeout members with audit log support
  • Channels: Create, edit, delete channels with permission management
  • Threads: Create and manage threads and forum posts
  • Roles: Full role CRUD with permission configuration
  • Members: List, search, edit members and manage their roles
  • Events: Create and manage scheduled events
  • Polls: Create polls with multiple choice options
  • Webhooks: Create and send messages via webhooks
  • AutoMod: Configure auto-moderation rules
  • Voice: Move and disconnect members from voice channels
  • And more: Emojis, stickers, invites, templates, onboarding, stage channels...

Prerequisites

  • Python 3.12+
  • uv package manager
  • A Discord account
  • A Discord server where you have admin permissions

Installation

  1. Clone the repository:
git clone https://github.com/glittercowboy/discord-mcp.git
cd discord-mcp
  1. Install dependencies:
uv sync

Discord Bot Setup

Follow these steps carefully to create and configure your Discord bot.

Step 1: Create a Discord Application

  1. Go to the Discord Developer Portal
  2. Log in with your Discord account
  3. Click the "New Application" button (top right)
  4. Enter a name for your application (e.g., "My MCP Bot")
  5. Accept the Terms of Service and click "Create"

Step 2: Create the Bot User

  1. In your application's settings, click "Bot" in the left sidebar
  2. Click "Add Bot" and confirm by clicking "Yes, do it!"
  3. Your bot is now created!

Step 3: Get Your Bot Token

IMPORTANT: Your bot token is like a password. Never share it or commit it to version control.

  1. In the Bot section, find the "Token" area
  2. Click "Reset Token" (or "Copy" if available)
  3. You may need to enter your Discord password or 2FA code
  4. Copy the token immediately - you can only see it once!
  5. Store it somewhere safe (you'll need it for configuration)

If you lose your token, you'll need to reset it, which invalidates the old one.

Step 4: Enable Privileged Intents

Still in the Bot section, scroll down to "Privileged Gateway Intents" and enable:

Intent Why It's Needed
Server Members Intent Required for listing members, managing roles, and member-related operations
Message Content Intent Required for reading message content (not just metadata)

Click "Save Changes" at the bottom.

Step 5: Generate the Bot Invite URL

  1. Click "OAuth2" in the left sidebar
  2. Click "URL Generator" under OAuth2

Select these scopes:

  • bot
  • applications.commands

Select bot permissions:

For full functionality, select "Administrator".

Or for minimal permissions, select these individually:

  • Manage Channels
  • Manage Roles
  • Kick Members
  • Ban Members
  • Manage Messages
  • Read Message History
  • Send Messages
  • Create Public Threads
  • Create Private Threads
  • Manage Threads
  • Embed Links
  • Attach Files
  • Add Reactions
  • Use External Emojis
  • Manage Webhooks
  • View Audit Log
  • Moderate Members (for timeouts)
  • Manage Events
  • Create Events
  • Send Polls
  1. Copy the generated URL at the bottom of the page

Step 6: Invite the Bot to Your Server

  1. Open the URL you copied in your browser
  2. Select the server you want to add the bot to (you need "Manage Server" permission)
  3. Review the permissions and click "Authorize"
  4. Complete any CAPTCHA if prompted
  5. The bot should now appear in your server's member list (it will show as offline until the MCP server runs)

Step 7: Get Your Server (Guild) ID

  1. Open Discord (desktop app or web)
  2. Go to User Settings (gear icon near your username)
  3. Navigate to App Settings > Advanced
  4. Enable "Developer Mode"
  5. Close settings
  6. Right-click on your server name in the server list
  7. Click "Copy Server ID"
  8. Save this ID - you'll need it for configuration

Configuration

You need two values:

  • Bot Token (from Step 3)
  • Server ID (from Step 7)

Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "discord": {
      "command": "uv",
      "args": ["--directory", "/path/to/discord-mcp", "run", "python", "-m", "src.server"],
      "env": {
        "DISCORD_BOT_TOKEN": "your-bot-token-here",
        "DISCORD_GUILD_ID": "your-server-id-here"
      }
    }
  }
}

Replace:

  • /path/to/discord-mcp with the actual path where you cloned the repo
  • your-bot-token-here with your bot token from Step 3
  • your-server-id-here with your server ID from Step 7

Claude Code

Add to your MCP settings (.claude/settings.json or via claude mcp add):

{
  "mcpServers": {
    "discord": {
      "command": "uv",
      "args": ["--directory", "/path/to/discord-mcp", "run", "python", "-m", "src.server"],
      "env": {
        "DISCORD_BOT_TOKEN": "your-bot-token-here",
        "DISCORD_GUILD_ID": "your-server-id-here"
      }
    }
  }
}

Verifying Setup

After configuration, restart Claude Desktop/Code and try:

  1. Ask Claude to discover available Discord operations
  2. Ask Claude to list channels in your server
  3. Ask Claude to send a test message to a channel

If you see errors:

  • Double-check your bot token is correct
  • Verify the bot is in your server
  • Ensure privileged intents are enabled in Developer Portal

Usage

Once configured, Claude can interact with your Discord server using these tools:

discord_discover

Browse all available operations organized by category.

discord_get_schema

Get detailed parameter schema for a specific operation.

discord_get_schema("messages.send")

discord_execute

Execute an operation with parameters.

discord_execute("messages.send", {
  "channel_id": "123456789",
  "content": "Hello from Claude!"
})

Operation Categories

Category Operations Description
messages 9 Send, read, edit, delete, pin messages
reactions 5 Add, remove, list reactions
threads 10 Create, manage, archive threads
channels 7 Create, edit, delete channels
members 6 List, search, edit members
moderation 7 Kick, ban, timeout members
roles 5 Create, edit, delete roles
invites 4 Create, list, delete invites
events 6 Scheduled event management
polls 2 Create and end polls
guild 4 Server settings and info
audit_log 1 View audit log
automod 5 Auto-moderation rules
webhooks 7 Webhook management
voice 2 Voice channel controls
emojis 5 Custom emoji management
stickers 3 Sticker management
forum 5 Forum posts and tags
stage 6 Stage channel instances
onboarding 3 New member onboarding
welcome_screen 2 Welcome screen settings
soundboard 5 Soundboard sounds
commands 5 Slash command management
integrations 2 Server integrations
widget 3 Server widget
vanity 2 Vanity URL
templates 6 Server templates
dm 1 Direct messages
bulk_ban 1 Bulk ban users

Examples

Send a message

discord_execute("messages.send", {
  "channel_id": "1234567890",
  "content": "Hello, Discord!"
})

Create a poll

discord_execute("polls.create", {
  "channel_id": "1234567890",
  "question": "What's your favorite color?",
  "answers": ["Red", "Blue", "Green"],
  "duration_hours": 24
})

Timeout a member

discord_execute("moderation.timeout", {
  "user_id": "9876543210",
  "duration_seconds": 3600,
  "reason": "Breaking server rules"
})

Create a scheduled event

discord_execute("events.create", {
  "name": "Community Meetup",
  "description": "Weekly community call",
  "start_time": "2025-01-25T18:00:00Z",
  "location": "https://meet.example.com"
})

Security Best Practices

  • Never commit your bot token to version control
  • Never share your bot token publicly
  • If your token is exposed, reset it immediately in the Developer Portal
  • Use environment variables for sensitive configuration
  • Grant only the permissions your bot actually needs
  • The bot can only manage resources below its highest role in the hierarchy
  • Review Discord's Bot Best Practices

Rate Limits

Discord enforces rate limits on API requests. This server handles rate limiting automatically, but be aware:

  • Global limit: 50 requests/second
  • Per-route limits vary by endpoint
  • Bulk operations are more efficient than individual calls

Troubleshooting

"401 Unauthorized" errors

  • Your bot token is incorrect or has been reset
  • Get a new token from the Developer Portal

"403 Forbidden" errors

  • The bot lacks required permissions
  • The bot's role is too low in the hierarchy to manage the target
  • Check channel-specific permission overrides

Bot appears offline

  • The MCP server only connects when Claude makes requests (REST API, not Gateway)
  • This is normal - the bot doesn't maintain a persistent connection

Can't read message content

  • Enable "Message Content Intent" in the Developer Portal Bot section
  • This is required to read the text content of messages

Can't list members

  • Enable "Server Members Intent" in the Developer Portal Bot section
  • This is required for member-related operations

Bot can't manage a user/role

  • The bot's highest role must be above the target user's highest role
  • Bots cannot manage the server owner
  • Check if there are channel-specific permission denies

License

MIT License - see LICENSE for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选