Discord MCP server

Provides a bridge between Discord and AI assistants, enabling comprehensive server management, channel operations, message handling, and community engagement through discord.js integration.
Back to servers
Setup instructions
Provider
jar285
Release date
May 16, 2025
Language
Go
Stats
1 star

MCP-Discord is a server implementation of the Model Context Protocol that allows AI assistants to interact with Discord. It provides comprehensive functionality for managing Discord servers, channels, messages, forum posts, and webhooks through a standardized interface.

Installation

Prerequisites

  • Node.js (v16.0.0 or higher)
  • npm (v7.0.0 or higher)
  • A Discord bot with appropriate permissions
    • Bot token from the Discord Developer Portal
    • Message Content Intent enabled
    • Server Members Intent enabled
    • Presence Intent enabled
  • Discord server permissions:
    • Send Messages
    • Create Public Threads
    • Send Messages in Threads
    • Manage Threads
    • Manage Channels
    • Add Reactions

Automated Installation

The easiest way to install MCP-Discord for Claude Desktop is via Smithery:

npx -y @smithery/cli install @barryyip0625/mcp-discord --client claude

Manual Installation

# Clone the repository
git clone https://github.com/barryyip0625/mcp-discord.git
cd mcp-discord

# Install dependencies
npm install

# Compile TypeScript
npm run build

Configuration

A Discord bot token is required for proper operation. You can provide it in two ways:

Using Environment Variables

DISCORD_TOKEN=your_discord_bot_token
DEFAULT_SERVER_ID=your_default_server_id  # Optional
DEFAULT_CHANNEL_ID=your_default_channel_id  # Optional

Using the --config Parameter

node path/to/mcp-discord/build/index.js --config "{\"DISCORD_TOKEN\":\"your_discord_bot_token\"}"

Enhanced Startup Script

For better debugging and error handling, use the included startup script:

node start-discord.js

This script provides:

  • Environment variable loading from .env file
  • Default server and channel ID configuration
  • Console log redirection to stderr
  • Discord connection testing before MCP server start
  • Detailed error reporting

Integration with AI Assistants

Claude Configuration

{
    "mcpServers": {
        "discord": {
            "command": "node",
            "args": [
                "path/to/mcp-discord/start-discord.js"
            ],
            "env": {
                "DISCORD_TOKEN": "your_discord_bot_token",
                "DEFAULT_SERVER_ID": "your_default_server_id",
                "DEFAULT_CHANNEL_ID": "your_default_channel_id"
            }
        }
    }
}

Cursor Configuration

{
    "mcpServers": {
        "discord": {
            "command": "cmd",
            "args": [
                "/c",
                "node",
                "path/to/mcp-discord/start-discord.js"
            ],
            "env": {
                "DISCORD_TOKEN": "your_discord_bot_token",
                "DEFAULT_SERVER_ID": "your_default_server_id",
                "DEFAULT_CHANNEL_ID": "your_default_channel_id"
            }
         }
     }
}

Available Tools

Basic Functions

  • discord_login: Authenticates with Discord
  • discord_list_guilds: Lists all available Discord servers with their channels
  • discord_send: Sends a message to a specified channel
  • discord_get_server_info: Retrieves Discord server information

Channel Management

  • discord_create_text_channel: Creates a new text channel
  • discord_delete_channel: Deletes an existing channel

Forum Functions

  • discord_get_forum_channels: Lists all forum channels
  • discord_create_forum_post: Creates a new forum post
  • discord_get_forum_post: Retrieves a forum post
  • discord_reply_to_forum: Replies to a forum post
  • discord_delete_forum_post: Deletes a forum post

Messages and Reactions

  • discord_read_messages: Retrieves channel messages
  • discord_add_reaction: Adds a reaction to a message
  • discord_add_multiple_reactions: Adds multiple reactions to a message
  • discord_remove_reaction: Removes a reaction from a message
  • discord_delete_message: Deletes a specific message

Webhook Management

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

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "discord" '{"command":"node","args":["path/to/mcp-discord/start-discord.js"],"env":{"DISCORD_TOKEN":"your_discord_bot_token","DEFAULT_SERVER_ID":"your_default_server_id","DEFAULT_CHANNEL_ID":"your_default_channel_id"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "discord": {
            "command": "node",
            "args": [
                "path/to/mcp-discord/start-discord.js"
            ],
            "env": {
                "DISCORD_TOKEN": "your_discord_bot_token",
                "DEFAULT_SERVER_ID": "your_default_server_id",
                "DEFAULT_CHANNEL_ID": "your_default_channel_id"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

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

2. Add this to your configuration file:

{
    "mcpServers": {
        "discord": {
            "command": "node",
            "args": [
                "path/to/mcp-discord/start-discord.js"
            ],
            "env": {
                "DISCORD_TOKEN": "your_discord_bot_token",
                "DEFAULT_SERVER_ID": "your_default_server_id",
                "DEFAULT_CHANNEL_ID": "your_default_channel_id"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later