Skip to main content
Glama

MCP-Discord

by IQAIcom
MIT License
17
1

MCP-Discord

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

Overview

MCP-Discord provides the following Discord-related functionalities:

  • Login to Discord bot
  • Get server information
  • Read/delete channel messages
  • Send messages to specified channels (using either channel IDs or channel names)
  • Retrieve forum channel lists
  • Create/delete/reply to forum posts
  • Create/delete text channels
  • Add/remove message reactions
  • Create/edit/delete/use webhooks

Table of Contents

Prerequisites

Note:
According to Discord's security model, a bot can only access information from servers it has been explicitly added to.
If you want to use this MCP server to access a specific Discord server, you must add the bot to that server first.
Use the invite link below to add the bot to your target server.

Installation

Installing via NPM

You can use it with the following command:

npx mcp-discord --config ${DISCORD_TOKEN}

For more details, you can check out the NPM Package.

Manual Installation

# Clone the repository git clone https://github.com/IQAICOM/mcp-discord.git cd mcp-discord # Install dependencies npm install # Compile TypeScript npm run build

Configuration

All configuration is now handled via the src/config.ts file, which supports both environment variables and command-line arguments. The following options are available:

OptionTypeDefaultDescription
DISCORD_TOKENstringRequired. Discord bot token.
SAMPLING_ENABLEDbooleantrueEnables bi-directional message sampling (see Sampling).
TRANSPORTstringstdioTransport method: stdio (default) or http.
HTTP_PORTnumber8080Port for HTTP transport (only if TRANSPORT is http).
DEFAULT_RATE_LIMIT_SECONDSnumber2Rate limit (seconds) for sampling requests per user.
DEFAULT_MESSAGE_CHUNK_SIZEnumber2000Max message chunk size for sampling responses.

You can set these options via environment variables or command-line arguments:

Environment variables:

DISCORD_TOKEN=your_discord_bot_token SAMPLING_ENABLED=false TRANSPORT=http HTTP_PORT=3000 DEFAULT_RATE_LIMIT_SECONDS=5 DEFAULT_MESSAGE_CHUNK_SIZE=1500

Command-line arguments:

node build/index.js --config "your_discord_bot_token" --sampling --transport http --port 3000 --rate-limit 5 --message-chunk-size 1500

If both are provided, command-line arguments take precedence.


Sampling

The Sampling feature enables bi-directional communication between Discord and the MCP server, allowing the bot to listen to messages and respond automatically. This is controlled by the SAMPLING_ENABLED config option (enabled by default).

How it works:

  • When enabled, the bot listens for new messages and bot mentions in Discord channels.
  • If a user sends a message, the bot can process it and respond using the MCP protocol.
  • The bot adds a 🤔 reaction when mentioned.
  • Rate limiting is enforced per user (see DEFAULT_RATE_LIMIT_SECONDS).
  • Long responses are split into chunks (see DEFAULT_MESSAGE_CHUNK_SIZE).

Disabling Sampling:

  • Set SAMPLING_ENABLED=false in your environment or omit the --sampling flag.
  • The bot will not listen to or respond to messages automatically.

Advanced options:

  • DEFAULT_RATE_LIMIT_SECONDS: Minimum seconds between sampling responses per user.
  • DEFAULT_MESSAGE_CHUNK_SIZE: Maximum size of each message chunk sent in response.

Tools Documentation

Basic Functions

  • discord_send: Send a message to a specified channel (supports both channel ID and channel name)
  • discord_get_server_info: Get Discord server information

Channel Management

  • discord_create_text_channel: Create a text channel
  • discord_delete_channel: Delete a channel

Forum Functions

  • discord_get_forum_channels: Get a list of forum channels
  • discord_create_forum_post: Create a forum post
  • discord_get_forum_post: Get a forum post
  • discord_reply_to_forum: Reply to a forum post
  • discord_delete_forum_post: Delete a forum post

Messages and Reactions

  • discord_read_messages: Read channel messages
  • discord_add_reaction: Add a reaction to a message
  • discord_add_multiple_reactions: Add multiple reactions to a message
  • discord_remove_reaction: Remove a reaction from a message
  • discord_delete_message: Delete a specific message from a channel

Webhook Management

  • discord_create_webhook: Creates a new webhook for a Discord channel
  • discord_send_webhook_message: Sends a message to a Discord channel using a webhook
  • discord_edit_webhook: Edits an existing webhook for a Discord channel
  • discord_delete_webhook: Deletes an existing webhook for a Discord channel

Development

# Development mode pnpm run dev
-
security - not tested
A
license - permissive license
-
quality - not tested

A Discord Model Context Protocol server that enables AI assistants to interact with Discord by sending messages, managing channels, handling forum posts, managing webhooks, and processing reactions.

  1. Overview
    1. Table of Contents
      1. Prerequisites
        1. Installation
          1. Installing via NPM
          2. Manual Installation
        2. Configuration
          1. Sampling
            1. Tools Documentation
              1. Basic Functions
              2. Channel Management
              3. Forum Functions
              4. Messages and Reactions
              5. Webhook Management
            2. Development

              Related MCP Servers

              • -
                security
                A
                license
                -
                quality
                A Model Context Protocol server that enables AI assistants to interact with Telegram, allowing them to search channels, list available channels, retrieve messages, and filter messages by regex patterns.
                Last updated -
                7
                18
                JavaScript
                MIT License
                • Apple
              • -
                security
                F
                license
                -
                quality
                A comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.
                Last updated -
                16
                1
                TypeScript
              • A
                security
                A
                license
                A
                quality
                A Discord Model Context Protocol server that enables AI assistants to interact with Discord, providing functionality for sending messages, managing channels, handling forum posts, and working with reactions.
                Last updated -
                15
                26
                32
                TypeScript
                MIT License
                • Linux
                • Apple
              • A
                security
                A
                license
                A
                quality
                A server implementing Model Context Protocol that enables AI assistants to interact with Slack API through a standardized interface, providing tools for messaging, channel management, user information retrieval, and more.
                Last updated -
                9
                53
                JavaScript
                Apache 2.0

              View all related MCP servers

              MCP directory API

              We provide all the information about MCP servers via our MCP API.

              curl -X GET 'https://glama.ai/api/mcp/v1/servers/IQAIcom/mcp-discord'

              If you have feedback or need assistance with the MCP directory API, please join our Discord server