mcp-discord

IQAIcom/mcp-discord

3.2

If you are the rightful owner of mcp-discord and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

A Discord MCP (Model Context Protocol) server that enables AI assistants to interact with the Discord platform.

Tools
18
Resources
0
Prompts
0

💬 Discord MCP Server

npm version License: MIT

Overview

The Discord MCP Server enables AI agents to interact with the Discord platform through the Model Context Protocol (MCP). This server provides comprehensive access to Discord's features including messaging, channel management, forum operations, reactions, and webhook management.

By implementing MCP, this server allows Large Language Models (LLMs) to read and send messages, manage channels and forums, handle reactions, and interact with webhooks directly through their context window, bridging the gap between AI and Discord communities.

The server supports bi-directional communication through a Sampling feature, allowing the bot to listen to messages and respond automatically when mentioned.

Features

  • Message Management: Send, read, and delete messages in Discord channels
  • Channel Operations: Create and delete text channels with custom topics
  • Forum Support: Create, read, reply to, and delete forum posts with tag support
  • Reaction Handling: Add single or multiple reactions to messages
  • Webhook Integration: Create, edit, delete, and send messages via webhooks
  • Server Information: Retrieve detailed server information including channels and member counts

Installation

Using npx (Recommended)

To use this server without installing it globally:

npx @iqai/mcp-discord --config ${DISCORD_TOKEN}

Build from Source

git clone https://github.com/IQAIcom/mcp-discord.git
cd mcp-discord
pnpm install
pnpm run build

Running with an MCP Client

Add the following configuration to your MCP client settings (e.g., claude_desktop_config.json).

Minimal Configuration

{
  "mcpServers": {
    "discord": {
      "command": "npx",
      "args": ["-y", "@iqai/mcp-discord", "--config", "YOUR_DISCORD_TOKEN"]
    }
  }
}

Advanced Configuration (Local Build)

{
  "mcpServers": {
    "discord": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-discord/dist/index.js"],
      "env": {
        "DISCORD_TOKEN": "your_discord_bot_token",
        "SAMPLING_ENABLED": "true",
        "TRANSPORT": "stdio"
      }
    }
  }
}

Configuration (Environment Variables)

VariableRequiredDescriptionDefault
DISCORD_TOKENYesDiscord bot token from the Developer Portal-
SAMPLING_ENABLEDNoEnables bi-directional message samplingtrue
TRANSPORTNoTransport method: stdio or httpstdio
HTTP_PORTNoPort for HTTP transport8080
DEFAULT_RATE_LIMIT_SECONDSNoRate limit (seconds) for sampling requests per user2
DEFAULT_MESSAGE_CHUNK_SIZENoMax message chunk size for sampling responses2000
RESPOND_TO_MENTIONS_ONLYNoOnly respond to messages that mention the bottrue
BLOCK_DMSNoBlock direct messages to the bottrue
BLOCKED_GUILDSNoComma-separated list of guild IDs to block""
BANNED_USERSNoComma-separated list of user IDs to ban""
REACTION_SAMPLING_ENABLEDNoEnable AI-generated contextual reactionsfalse
REACTION_TIMEOUT_MSNoTimeout (ms) for reaction sampling requests3000
REACTION_FALLBACK_EMOJINoFallback emoji when reaction sampling fails"🤔"

Prerequisites

Before using this MCP server, you need:

  1. A Discord bot with appropriate permissions from the Discord Developer Portal
  2. Enable these intents: Message Content, Server Members, Presence
  3. Add the bot to your server with required permissions (Administrator recommended, or specific permissions for channels, messages, webhooks)

Usage Examples

Message Operations

  • "Send a message to channel #general saying 'Hello everyone!'"
  • "Read the last 10 messages from the announcements channel"
  • "Delete the message with ID 123456789 from #spam-channel"

Channel Management

  • "Create a new text channel called 'project-updates' with topic 'Project status updates'"
  • "Delete the channel #old-channel"
  • "Get all the server information including channel list"

Forum Operations

  • "List all forum channels in this server"
  • "Create a new forum post titled 'Feature Request' with content about the new feature"
  • "Reply to the forum post about bugs with a status update"

Reaction Handling

  • "Add a thumbs up reaction to the latest message in #feedback"
  • "Add multiple reactions (🎉 🚀 ✅) to the announcement message"
  • "Remove my reaction from that message"

Webhook Management

  • "Create a webhook named 'Notifications Bot' in #alerts channel"
  • "Send a message via webhook to post as 'System Alert'"
  • "Delete the unused webhook from #old-notifications"

MCP Tools

discord_add_multiple_reactions

Adds multiple emoji reactions to a Discord message at once

ParameterTypeRequiredDescription
channelIdstring
messageIdstring
emojisarray

discord_add_reaction

Adds an emoji reaction to a specific Discord message

ParameterTypeRequiredDescription
channelIdstring
messageIdstring
emojistring

discord_create_category

Creates a new category in a Discord server.

ParameterTypeRequiredDescription
guildIdstring
namestring
positionnumber
reasonstring

discord_create_forum_post

Creates a new post in a Discord forum channel with optional tags

ParameterTypeRequiredDescription
forumChannelIdstring
titlestring
contentstring
tagsarray

discord_create_text_channel

Creates a new text channel in a Discord server with an optional topic

ParameterTypeRequiredDescription
guildIdstring
channelNamestring
topicstring

discord_create_webhook

Creates a new webhook for a Discord channel

ParameterTypeRequiredDescription
channelIdstring
namestring
avatarstring
reasonstring

discord_delete_category

Deletes a Discord category by ID.

ParameterTypeRequiredDescription
categoryIdstring
reasonstring

discord_delete_channel

Deletes a Discord channel with an optional reason

ParameterTypeRequiredDescription
channelIdstring
reasonstring

discord_delete_forum_post

Deletes a forum post or thread with an optional reason

ParameterTypeRequiredDescription
threadIdstring
reasonstring

discord_delete_message

Deletes a specific message from a Discord text channel

ParameterTypeRequiredDescription
channelIdstring
messageIdstring
reasonstring

discord_delete_webhook

Deletes an existing webhook for a Discord channel

ParameterTypeRequiredDescription
webhookIdstring
webhookTokenstring
reasonstring

discord_edit_category

Edits an existing Discord category (name and position).

ParameterTypeRequiredDescription
categoryIdstring
namestring
positionnumber
reasonstring

discord_edit_webhook

Edits an existing webhook for a Discord channel

ParameterTypeRequiredDescription
webhookIdstring
webhookTokenstring
namestring
avatarstring
channelIdstring
reasonstring

discord_get_forum_channels

Lists all forum channels in a specified Discord server (guild)

ParameterTypeRequiredDescription
guildIdstring

discord_get_forum_post

Retrieves details about a forum post including its messages

ParameterTypeRequiredDescription
threadIdstring

discord_get_server_info

Retrieves detailed information about a Discord server including channels and member count

ParameterTypeRequiredDescription
guildIdstring

discord_login

Logs in to Discord using the configured token

ParameterTypeRequiredDescription
tokenstring

discord_read_messages

Retrieves messages from a Discord text channel with a configurable limit

ParameterTypeRequiredDefaultDescription
channelIdstring
limitnumber50

discord_remove_reaction

Removes a specific emoji reaction from a Discord message

ParameterTypeRequiredDescription
channelIdstring
messageIdstring
emojistring
userIdstring

discord_reply_to_forum

Adds a reply to an existing forum post or thread

ParameterTypeRequiredDescription
threadIdstring
messagestring

discord_send

Sends a message to a specified Discord text channel

ParameterTypeRequiredDescription
channelIdstring
messagestring

discord_send_webhook_message

Sends a message to a Discord channel using a webhook

ParameterTypeRequiredDescription
webhookIdstring
webhookTokenstring
contentstring
usernamestring
avatarURLstring
threadIdstring

Development

Build Project

pnpm run build

Development Mode (Watch)

pnpm run watch

Linting & Formatting

pnpm run lint
pnpm run format

Project Structure

  • src/tools/: Individual tool handlers
  • src/tool-list.ts: MCP tool definitions
  • src/schemas.ts: Zod validation schemas
  • src/sampling.ts: Bi-directional sampling feature
  • src/index.ts: Server entry point

Resources

Disclaimer

This project is an unofficial tool and is not directly affiliated with Discord Inc. Users are responsible for ensuring their bot usage complies with Discord's Terms of Service and Developer Terms.

License