discord-mcp

repository·main·Indexed 19 days ago

https://github.com/saseq/discord-mcp

A Model Context Protocol (MCP) server using the JDA library to bridge Discord bots with AI assistants like Claude and ChatGPT. It enables AI-driven Discord automation, including managing channels, sending messages, and user management. The server can be deployed via Docker, Docker Compose, or manually via Maven, and supports connection to clients such as Claude Desktop, Cursor, Codex CLI, and n8n.

Tokens
5K
Snippets
7
Records
8
Agent score
15%

What's inside discord-mcp

  1. Connect discord-mcp to Claude Desktop

    main

    You can connect to Claude Desktop using either local STDIO or a remote connector.

    STDIO (Local/Legacy)

    Add this to your claude_desktop_config.json:

    {
      "mcpServers": {
        "discord-mcp": {
          "command": "docker",
          "args": [
            "run",
            "--rm",
            "-i",
            "-e",
            "DISCORD_TOKEN=<YOUR_DISCORD_BOT_TOKEN>",
            "-e",
            "DISCORD_GUILD_ID=<OPTIONAL_DEFAULT_SERVER_ID>",
            "saseq/discord-mcp:latest"
          ]
        }
      }
    }

    Remote MCP Connector

    1. Open Claude Desktop -> Settings -> Connectors.
    2. Add a custom connector with the MCP URL (e.g., https://<PUBLIC_HOST>/mcp).
    3. Note: Remote connectors require the endpoint to be exposed via public HTTPS (e.g., via a tunnel or reverse proxy).
  2. Connect discord-mcp to various AI clients

    main

    Depending on your client, use the following connection methods. The HTTP singleton mode is recommended for most users as it runs a single persistent server.

    Claude Code

    Recommended (HTTP): claude mcp add discord-mcp --transport http http://localhost:8085/mcp

    Legacy (stdio): claude mcp add discord-mcp -- docker run --rm -i -e DISCORD_TOKEN=<TOKEN> -e DISCORD_GUILD_ID=<ID> saseq/discord-mcp:latest

    Codex CLI

    codex mcp add discord-mcp --url http://localhost:8085/mcp

    OpenClaw

    Via CLI: openclaw mcp set discord-mcp '{"url":"http://localhost:8085/mcp","transport":"streamable-http"}'

    Via config (~/.openclaw/config.json):

    {
      "mcp": {
        "servers": {
          "discord-mcp": {
            "url": "http://localhost:8085/mcp",
            "transport": "streamable-http"
          }
        }
      }
    }

    Cursor

    Add a new global MCP server in Settings -> Cursor Settings -> MCP. Alternatively, add to ~/.cursor/mcp.json:

    {
      "mcpServers": {
        "discord-mcp": {
          "url": "http://localhost:8085/mcp"
        }
      }
    }

    n8n

    1. Add an MCP Client node.
    2. Choose HTTP or Streamable HTTP transport.
    3. Set URL to http://localhost:8085/mcp (or http://discord-mcp:8085/mcp if n8n is in Docker).
    // Example Cursor/Standard config.json
    {
      "mcpServers": {
        "discord-mcp": {
          "url": "http://localhost:8085/mcp"
        }
      }
    }
  3. Install discord-mcp via Docker (Recommended)

    main

    The recommended way to run the discord-mcp server is using Docker. This method uses the http profile, providing a single long-running server instance.

    1. Set the required environment variables:

      • DISCORD_TOKEN: Your Discord bot token.
      • DISCORD_GUILD_ID: (Optional) Your default Discord server ID. Providing this allows tools to omit the guildId parameter.
      • SPRING_PROFILES_ACTIVE: Must be set to http.
    2. Run the container:

    docker run -d -i \
      --name discord-mcp \
      --restart unless-stopped \
      -p 8085:8085 \
      -e SPRING_PROFILES_ACTIVE \
      -e DISCORD_TOKEN \
      -e DISCORD_GUILD_ID \
      saseq/discord-mcp:latest

    Default MCP endpoint: http://localhost:8085/mcp

    export DISCORD_TOKEN="YOUR_DISCORD_BOT_TOKEN"
    export DISCORD_GUILD_ID="OPTIONAL_DEFAULT_SERVER_ID"
    export SPRING_PROFILES_ACTIVE=http
    
    docker run -d -i \
      --name discord-mcp \
      --restart unless-stopped \
      -p 8085:8085 \
      -e SPRING_PROFILES_ACTIVE \
      -e DISCORD_TOKEN \
      -e DISCORD_GUILD_ID \
      saseq/discord-mcp:latest
  4. Install discord-mcp via Docker Compose

    main

    To use Docker Compose for managing the server:

    1. Clone the repository: git clone https://github.com/SaseQ/discord-mcp
    2. Navigate to the directory: cd discord-mcp
    3. Create a .env file with your configuration:
    cat > .env <<EOF
    SPRING_PROFILES_ACTIVE=http
    DISCORD_TOKEN=<YOUR_DISCORD_BOT_TOKEN>
    DISCORD_GUILD_ID=<OPTIONAL_DEFAULT_SERVER_ID>
    EOF
    1. Start the container: docker compose up -d --build

    Verify the installation using the health endpoint: http://localhost:8085/actuator/health

    git clone https://github.com/SaseQ/discord-mcp
    cd discord-mcp
    
    cat > .env <<EOF
    SPRING_PROFILES_ACTIVE=http
    DISCORD_TOKEN=<YOUR_DISCORD_BOT_TOKEN>
    DISCORD_GUILD_ID=<OPTIONAL_DEFAULT_SERVER_ID>
    EOF
    
    docker compose up -d --build
    
    # Verify
    docker ps --filter name=discord-mcp
    curl -fsS http://localhost:8085/actuator/health
  5. Install discord-mcp manually via Maven

    main

    If you prefer not to use Docker, you can build and run the project manually using Maven.

    1. Clone the repository and build the JAR: mvn clean package (The JAR will be in the /target directory).
    2. Run the JAR as a long-running server:
    DISCORD_TOKEN=<YOUR_DISCORD_BOT_TOKEN> \
    DISCORD_GUILD_ID=<OPTIONAL_DEFAULT_SERVER_ID> \
    SPRING_PROFILES_ACTIVE=http \
    java -jar /absolute/path/to/discord-mcp-1.0.0.jar

    Default MCP endpoint: http://localhost:8085/mcp

    cd discord-mcp
    mvn clean package
    
    DISCORD_TOKEN=<YOUR_DISCORD_BOT_TOKEN> \
    DISCORD_GUILD_ID=<OPTIONAL_DEFAULT_SERVER_ID> \
    SPRING_PROFILES_ACTIVE=http \
    java -jar /absolute/path/to/discord-mcp-1.0.0.jar
  6. Deploy discord-mcp using Docker Compose

    main

    You can deploy the discord-mcp service using Docker Compose. The service exposes port 8085 and requires specific environment variables to function correctly, such as a Discord token. The container is configured to restart unless explicitly stopped.

    services:
      discord-mcp:
        container_name: discord-mcp
        build:
          context: .
        image: saseq/discord-mcp:latest
        restart: unless-stopped
        ports:
          - "8085:8085"
        environment:
          SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE:-http}
          DISCORD_TOKEN: ${DISCORD_TOKEN}
          DISCORD_GUILD_ID: ${DISCORD_GUILD_ID:-}
  7. Configure discord-mcp environment variables

    main

    The discord-mcp container uses the following environment variables for configuration:

    VariableDefaultDescription
    DISCORD_TOKENRequiredYour Discord bot token.
    DISCORD_GUILD_ID(empty)The ID of the Discord guild (server) to operate in.
    SPRING_PROFILES_ACTIVEhttpThe active Spring profile.
  8. Reference the available Discord MCP tools

    main

    The discord-mcp server provides a wide range of tools for interacting with Discord servers (guilds). These tools are categorized by functionality, including server information, user management, message management, channel/category management, webhooks, roles, moderation, voice/stage channels, scheduled events, permissions, invites, forums, and emojis.

    Note on guildId: If the DISCORD_GUILD_ID environment variable is set, the guildId parameter becomes optional for all tools listed below.

    #### Server Information
    - [`get_server_info`](): Get detailed discord server information
    
    #### User Management
    - [`get_user_id_by_name`](): Get a Discord user's ID by username in a guild for ping usage `<@id>`
    - [`send_private_message`](): Send a private message to a specific user
    - [`edit_private_message`](): Edit a private message from a specific user
    - [`delete_private_message`](): Delete a private message from a specific user
    - [`read_private_messages`](): Read private message history from a specific user (includes attachment metadata, supports `count` 1-100 and optional cursor: `before` or `after` or `around`)
    
    #### Message Management
    - [`send_message`](): Send a message to a specific channel
    - [`edit_message`](): Edit a message from a specific channel
    - [`delete_message`](): Delete a message from a specific channel
    - [`read_messages`](): Read message history from a specific channel (includes attachment metadata, supports `count` 1-100 and optional cursor: `before` or `after` or `around`)
    - [`add_reaction`](): Add a reaction (emoji) to a specific message
    - [`remove_reaction`](): Remove a specified reaction (emoji) from a message
    
    #### Channel Management
    - [`create_text_channel`](): Create a new text channel
    - [`edit_text_channel`](): Edit settings of a text channel (name, topic, nsfw, slowmode, category, position)
    - [`delete_channel`](): Delete a channel
    - [`find_channel`](): Find a channel type and ID using name and server ID
    - [`list_channels`](): List of all channels
    - [`get_channel_info`](): Get detailed information about a channel
    - [`move_channel`](): Move a channel to another category and/or change its position
    
    #### Category Management
    - [`create_category`](): Create a new category for channels
    - [`edit_category`](): Edit a category (rename or move position)
    - [`delete_category`](): Delete a category
    - [`find_category`](): Find a category ID using name and server ID
    - [`list_channels_in_category`](): List channels in a specific category
    
    #### Webhook Management
    - [`create_webhook`](): Create a new webhook on a specific channel
    - [`delete_webhook`](): Delete a webhook
    - [`list_webhooks`](): List webhooks on a specific channel
    - [`send_webhook_message`](): Send a message via webhook
    
    #### Role Management
    - [`list_roles`](): Get a list of all roles on the server with their details
    - [`create_role`](): Create a new role on the server
    - [`edit_role`](): Modify an existing role's settings
    - [`delete_role`](): Permanently delete a role from the server
    - [`assign_role`](): Assign a role to a user
    - [`remove_role`](): Remove a role from a user
    
    #### Moderation and User Management
    - [`kick_member`](): Kicks a member from the server
    - [`ban_member`](): Bans a user from the server
    - [`unban_member`](): Removes a ban from a user
    - [`timeout_member`](): Disables communication for a member for a specified duration
    - [`remove_timeout`](): Removes a timeout (unmute) from a member before it expires
    - [`set_nickname`](): Changes a member's nickname on the server
    - [`get_bans`](): Returns a list of banned users on the server with ban reasons
    
    #### Voice & Stage Channel Management
    - [`create_voice_channel`](): Create a new voice channel in a guild
    - [`create_stage_channel`](): Create a new stage channel for audio events
    - [`edit_voice_channel`](): Edit settings of a voice or stage channel (name, bitrate, user limit, region)
    - [`move_member`](): Move a member to another voice channel
    - [`disconnect_member`](): Disconnect a member from their current voice channel
    - [`modify_voice_state`](): Server mute or deafen a member in voice channels
    
    #### Scheduled Events Management
    - [`create_guild_scheduled_event`](): Schedule a new event on the server (voice, stage, or external)
    - [`edit_guild_scheduled_event`](): Modify event details or change its status (start, complete, cancel)
    - [`delete_guild_scheduled_event`](): Permanently delete a scheduled event
    - [`list_guild_scheduled_events`](): List all active and scheduled events on the server
    - [`get_guild_scheduled_event_users`](): Get list of users interested in a scheduled event
    
    #### Channel Permission Overwrites
    - [`list_channel_permission_overwrites`](): List all permission overwrites for a channel with role/member breakdown
    - [`upsert_role_channel_permissions`](): Create or update permission overwrite for a role on a channel
    - [`upsert_member_channel_permissions`](): Create or update permission overwrite for a member on a channel
    - [`delete_channel_permission_overwrite`](): Delete a permission overwrite for a role or member from a channel
    
    #### Invite Management
    - [`create_invite`](): Create a new invite link for a specific channel
    - [`list_invites`](): List all active invites on the server with their statistics
    - [`delete_invite`](): Delete (revoke) an invite so the link stops working
    - [`get_invite_details`](): Get details about a specific invite (works for any public invite)
    
    #### Forum Management
    - [`create_forum_channel`](): Create a new forum channel
    - [`edit_forum_channel`](): Edit settings of a forum channel (name, topic, nsfw, slowmode, category, position, default sort, default layout)
    - [`list_forum_channels`](): List all forum channels in the server
    - [`get_forum_channel_info`](): Get detailed information about a forum channel including tags and settings
    - [`list_forum_tags`](): List all available tags in a forum channel
    - [`create_forum_post`](): Create a new forum post (thread) with an initial message in a forum channel
    - [`list_forum_posts`](): List active posts (threads) in a forum channel
    - [`modify_forum_post`](): Modify a forum post: lock/unlock, archive/unarchive, pin/unpin, or change applied tags
    
    #### Emoji Management
    - [`list_emojis`](): List all custom emojis on the server
    - [`get_emoji_details`](): Get detailed information about a specific custom emoji
    - [`create_emoji`](): Upload a new custom emoji to the server (base64 or image URL, max 256KB)
    - [`edit_emoji`](): Edit an existing emoji's name or role restrictions
    - [`delete_emoji`](): Permanently delete a custom emoji from the server