Discord MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
pip install -r requirements.txt
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "DISCORD_TOKEN=${DISCORD_TOKEN}" discord-mcp-a3d1 -- python "<FULL_PATH_TO_DISCORD_MCP>/dist/index.js"

Replace <FULL_PATH_TO_DISCORD_MCP>/dist/index.js with the actual folder you prepared in step 1.

Required:DISCORD_TOKEN
README.md

A streamlined Model Context Protocol server for Discord with smart resolution.

Discord MCP Server

A streamlined Model Context Protocol server for Discord with smart target resolution. No more hallucinated IDs!

Features

  • 🎯 Smart Target Resolution: Use channel names, usernames, or IDs - no need to memorize snowflakes
  • 🧠 LLM-Friendly: Reduces hallucination by accepting human-readable names
  • πŸ’¬ Automatic Mention Processing: Converts @username to proper Discord <@id> format automatically
  • πŸ“¦ Streamlined API: Only 7 essential tools, no redundancy
  • πŸ’Ύ Smart Caching: Automatically caches nameβ†’ID mappings
  • πŸ”€ Ambiguity Handling: Detects when channel names collide and guides to use ServerName/channel format

Tools

  1. send_message - Send to channels or DMs (accepts names or IDs)
  2. edit_message - Edit or delete messages (empty content = delete)
  3. read_messages - Read channel history + channel info
  4. list_servers - List all accessible servers
  5. list_channels - List channels in a server
  6. search_messages - Search for messages in a channel
  7. add_reaction - React to messages with emoji

Setup

1. Create a Discord Bot

  1. Go to Discord Developer Portal
  2. Click "New Application" and give it a name
  3. Go to "Bot" section and click "Add Bot"
  4. Enable these Privileged Gateway Intents:
    • Message Content Intent
    • Server Members Intent
    • Presence Intent (optional)
  5. Click "Reset Token" and copy your bot token
  6. Go to "OAuth2" β†’ "URL Generator"
    • Select scopes: bot
    • Select permissions: Send Messages, Read Message History, Add Reactions, Manage Messages
  7. Use the generated URL to invite the bot to your server

2. Install Dependencies

pip install -r requirements.txt

3. Set Environment Variable

export DISCORD_TOKEN="your_bot_token_here"

Or on Windows:

set DISCORD_TOKEN=your_bot_token_here

4. Run the Server

python path/to/discord-mcp

Usage Examples

With Claude Desktop (config)

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "discord": {
      "command": "python",
      "args": ["/path/to/discord-mcp"],
      "env": {
        "DISCORD_TOKEN": "your_bot_token_here"
      }
    }
  }
}

Example Prompts for Claude

Send a message:

Send "Hello everyone!" to the general channel
Send "Meeting in 5 mins" to Work Server/announcements

Read messages:

Read the last 20 messages from announcements
Read messages from Gaming Server/general

Search:

Search for messages containing "meeting" in the team-chat channel
Search for "bug report" in Dev Team/bugs

Edit/Delete:

Edit message 123456789 to say "Updated: Meeting at 3pm"
Delete message 987654321

Smart Target Resolution

The server automatically handles both names and IDs:

Input Type Example How It Works
Channel name "general" Searches for channel by name
Server/Channel "MyServer/general" Searches in specific server (solves ambiguity)
Channel with # "#announcements" Strips # and searches by name
Username "john" Searches for user by username
Username with @ "@alice" Strips @ and searches by username
Snowflake ID "123456789012345678" Uses ID directly (17-20 digits)

Handling Ambiguous Channel Names

Since most Discord servers have channels with common names like "general" or "announcements", the server handles ambiguity intelligently:

If a channel name is unique: Just use the name

Send "Hello!" to announcements

If a channel name appears in multiple servers: The server will tell you which servers have that channel and ask you to specify:

Error: Multiple channels named 'general' found:
  β€’ My Gaming Server β†’ #general
  β€’ Work Team β†’ #general
  β€’ Friend Group β†’ #general

Please specify format: 'ServerName/channel' or use channel ID

Use the ServerName/channel format:

Send "Hello team!" to Work Team/general
Read the last 10 messages from My Gaming Server/general

This completely eliminates the need for the AI to remember or hallucinate long channel IDs!

Automatic User Mention Processing

Discord bots can only mention users using the <@user_id> format, but LLMs naturally want to use @username. The server automatically handles bidirectional conversion:

When SENDING messages (AI β†’ Discord):

AI writes: "Hey @john, can you check this?"
Discord receives: "Hey <@789012345678901234>, can you check this?"

When READING messages (Discord β†’ AI):

Discord has: "Meeting with <@789012345678901234> at 3pm"
AI sees: "Meeting with @john at 3pm"

Sending - Handles:

  • @username β†’ Looks up user and converts to <@id>
  • @123456789 β†’ Recognizes as ID and formats to <@123456789>
  • 123456789 β†’ Detects raw IDs and converts to <@123456789> if valid user
  • Non-existent users β†’ Left as

Tools (7)

send_messageSend to channels or DMs using names or IDs
edit_messageEdit or delete messages
read_messagesRead channel history and channel info
list_serversList all accessible servers
list_channelsList channels in a server
search_messagesSearch for messages in a channel
add_reactionReact to messages with emoji

Environment Variables

DISCORD_TOKENrequiredThe bot token from the Discord Developer Portal

Configuration

claude_desktop_config.json
{"mcpServers": {"discord": {"command": "python", "args": ["/path/to/discord-mcp"], "env": {"DISCORD_TOKEN": "your_bot_token_here"}}}}

Try it

β†’Send "Hello everyone!" to the general channel
β†’Read the last 20 messages from announcements
β†’Search for messages containing "meeting" in the team-chat channel
β†’Edit message 123456789 to say "Updated: Meeting at 3pm"
β†’Delete message 987654321

Frequently Asked Questions

What are the key features of Discord MCP Server?

Smart target resolution using human-readable names instead of snowflake IDs. Automatic conversion of @username to Discord mention format. Bidirectional mention processing for reading and sending messages. Intelligent ambiguity handling for common channel names across servers. Automatic caching of name-to-ID mappings.

What can I use Discord MCP Server for?

Automating daily status updates in specific Discord channels. Searching through historical project discussions without manual ID lookups. Managing community engagement by reacting to messages via AI. Streamlining communication across multiple servers using a single interface.

How do I install Discord MCP Server?

Install Discord MCP Server by running: pip install -r requirements.txt

What MCP clients work with Discord MCP Server?

Discord MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Discord MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare