Get the FREE Ultimate OpenClaw Setup Guide →

discord

An MCP server for interacting with Discord

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio gustycube-discord-mcp node /path/to/discord-mcp/dist/index.js \
  --env ALLOW_GUILD_IDS="123456789,987654321" \
  --env ALLOW_CHANNEL_IDS="111111111,222222222" \
  --env DISCORD_BOT_TOKEN="your_bot_token_here"

How to use

This MCP server exposes a set of AI-assisted tools that interact with Discord via both REST API calls and real-time Gateway events. By wiring a Discord bot token and configuring allowlists for guilds and channels, you enable secure, granular access to Discord data and actions through declarative tools generated from the API catalog. Developers can route requests through the auto-generated tools to perform tasks such as sending messages, retrieving user or guild info, managing channels, sending rich content, and subscribing to live events. The tooling is designed to minimize accidental exposure (safe defaults, explicit allowlists) while offering a broad surface for automation and AI-assisted workflows.

To use, run the MCP server with a Node.js environment as described in the configuration. The Discord tools expose endpoints and commands that your AI or client can invoke. Ensure your environment variables are set (notably DISCORD_BOT_TOKEN and allowlists) to grant the necessary scope of access. The documentation site linked in the README provides examples, tool references, and security details to help you compose requests, build workflows, and handle events from Discord in real time.

How to install

Prerequisites:

  • Node.js (>= 14) and npm installed
  • Git installed
  • Access to a Discord bot token with the appropriate permissions

Step-by-step:

  1. Clone the repository git clone https://github.com/GustyCube/discord-mcp cd discord-mcp

  2. Install dependencies npm install

  3. Configure environment

    • Copy the example env and edit as needed cp .env.example .env

      Set DISCORD_BOT_TOKEN and any ALLOW_* values

  4. Build and run npm run build npm start

  5. Verify the MCP server is running and reachable, then consult the documentation for available tools and usage examples.

Additional notes

Tips and considerations:

  • Use allowlists (ALLOW_GUILD_IDS and ALLOW_CHANNEL_IDS) to restrict access to specific Discord guilds and channels for security.
  • The tools are generated from a declarative API catalog; new endpoints may appear as the catalog updates. Refer to the documentation for the latest tool set.
  • Monitor rate limits and bot permissions in Discord to avoid temporary blocks; ensure the bot has only the necessary permissions.
  • If you run in production, consider environment-based configurations and secrets management for DISCORD_BOT_TOKEN.
  • The example configuration uses a local path to the built index.js; adjust the path to your deployment layout if different.

Related MCP Servers

Sponsor this space

Reach thousands of developers