Get the FREE Ultimate OpenClaw Setup Guide →

discord

A Model Context Protocol (MCP) server for Discord integration - enables AI models to interact with Discord through secure authentication, message management, and content moderation.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio reesavgupta-discord-mcp-server ./bin/discord-mcp-server -config configs/config.yaml \
  --env API_KEY_1="Primary API key for access" \
  --env API_KEY_2="Optional additional API key" \
  --env JWT_SECRET="JWT signing secret" \
  --env LOGGING_LEVEL="Logging level (e.g., info, debug)" \
  --env LOGGING_FORMAT="Logging format (e.g., json, text)" \
  --env DISCORD_GUILD_ID="Discord guild/server ID" \
  --env DISCORD_BOT_TOKEN="Discord bot token"

How to use

This Discord MCP Server implements the Model Context Protocol (MCP) to expose a standardized JSON-RPC 2.0 interface for interacting with Discord. It enables automated moderation, message handling, channel information retrieval, and search capabilities via built-in tools. Clients communicate over stdio when paired with Claude Desktop or other MCP-compatible clients, issuing RPC calls to perform actions such as sending messages, fetching history, and moderating content. The server supports multi-tenancy, authentication with JWTs and API keys, and configurable logging for observability. To get started, configure your Discord bot token and guild, provide authentication credentials, and run the binary with the provided config file. You can then invoke MCP tools such as send_message, get_messages, get_channel_info, search_messages, and moderate_content through the JSON-RPC interface.

How to install

Prerequisites:

  • Go toolchain installed (go 1.20+ recommended)
  • Git
  • A Discord bot token and guild ID
  • Optional: TLS/SSL setup if exposing RPC externally
  1. Clone the repository: git clone https://github.com/yourusername/discord-mcp-server.git cd discord-mcp-server

  2. Install dependencies and build the server (Go typically handles dependencies via go mod during build): make deps # if the project defines a deps target make build # builds the binary and places it under bin/ (as per README root example)

  3. Prepare configuration:

    • Copy example config and edit with your values: cp configs/config.yaml.example configs/config.yaml

      or edit configs/config.yaml directly

  4. Run the server: ./bin/discord-mcp-server -config configs/config.yaml

  5. Optional: set environment variables (recommended to use a .env file or system env vars): export DISCORD_BOT_TOKEN=your-bot-token export DISCORD_GUILD_ID=your-guild-id export JWT_SECRET=your-jwt-secret export API_KEY_1=your-api-key export API_KEY_2=optional-key

  6. Verify operation by checking logs and using a Claude Desktop client or any MCP client to issue RPC calls.

Additional notes

Notes and tips:

  • The server uses YAML-based configuration with environment variable overrides; see configs/config.yaml for structure.
  • For security, avoid committing secrets; use environment variables or secret management.
  • Authentication can use JWTs and API keys; enable audit logging if you need activity trails.
  • Logging supports JSON or text formats and can be written to a file or stdout. Set logging.level (e.g., info, debug) to control verbosity.
  • If you run multiple Discord bots/servers, extend the mcpServers map with additional entries (each with its own config and env).
  • When debugging, set logging.level to debug in the config and review the logs for RPC requests, errors, and moderation actions.

Related MCP Servers

Sponsor this space

Reach thousands of developers