Skip to main content
Glama
erinlkolp

Discord MCP Server

by erinlkolp

Discord MCP Server

A Python MCP (Model Context Protocol) server that lets you interact with Discord directly from Claude Code sessions. Send messages, read channels, post rich embeds, and list server channels — all through natural conversation with Claude.

Prerequisites

  • Docker and Docker Compose installed

  • Claude Code CLI installed

  • A Discord bot token (setup guide below)

Related MCP server: Discord MCP Server

Discord Bot Setup

  1. Go to the Discord Developer Portal

  2. Click New Application, give it a name, and create it

  3. Go to Bot in the left sidebar

  4. Click Reset Token and copy the token — this is your DISCORD_BOT_TOKEN

  5. Under Privileged Gateway Intents, enable Message Content Intent

  6. Go to OAuth2 > URL Generator in the left sidebar

  7. Select scopes: bot

  8. Select bot permissions: Send Messages, Read Message History, View Channels

  9. Copy the generated URL and open it in your browser to invite the bot to your server

Installation

1. Clone the repository

git clone <your-repo-url>
cd discord-mcp-server

2. Set up environment variables

cp .env.example .env
# Edit .env and add your DISCORD_BOT_TOKEN and optionally DISCORD_DEFAULT_GUILD_ID

3. Build the Docker image

docker compose build

4. Register with Claude Code

Add the following to your Claude Code MCP settings. You can configure this in ~/.claude/settings.json (global) or .mcp.json (project-level):

{
  "mcpServers": {
    "discord-mcp": {
      "command": "docker",
      "args": [
        "compose",
        "-f", "/absolute/path/to/discord-mcp-server/docker-compose.yml",
        "run", "--rm", "-i", "discord-mcp"
      ],
      "env": {
        "DISCORD_BOT_TOKEN": "your-bot-token-here",
        "DISCORD_DEFAULT_GUILD_ID": "your-guild-id-here"
      }
    }
  }
}

Note: Replace /absolute/path/to/discord-mcp-server with the actual absolute path to this project on your machine. Replace the token and guild ID with your actual values.

Usage Examples

Once configured, you can use these tools in any Claude Code session:

List channels in a server:

"Show me all the channels in my Discord server"

Send a message:

"Send 'Deployment complete!' to the #general channel"

Read recent messages:

"What are the last 5 messages in #random?"

Send a rich embed:

"Send an embed to #updates with title 'Release v2.0' and a green color, with fields for 'Changes' and 'Breaking Changes'"

Tool Reference

discord_list_channels

Lists all text channels in a Discord server.

Parameter

Type

Required

Description

guild_id

string

Yes

Discord server/guild ID

discord_send_message

Sends a plain text message to a channel.

Parameter

Type

Required

Description

channel

string

Yes

Channel ID or name (e.g. "general")

content

string

Yes

Message text (max 2000 chars)

guild_id

string

No

Server ID. Required if channel is a name and no default is set.

discord_read_messages

Reads recent messages from a channel.

Parameter

Type

Required

Description

channel

string

Yes

Channel ID or name

guild_id

string

No

Server ID. Required if channel is a name and no default is set.

limit

integer

No

Number of messages (default: 10, max: 50)

discord_send_embed

Sends a rich embed message to a channel.

Parameter

Type

Required

Description

channel

string

Yes

Channel ID or name

title

string

Yes

Embed title (max 256 chars)

description

string

No

Embed body text (max 4096 chars)

color

integer

No

Color as decimal (e.g. 3447003 for blue)

fields

list

No

List of {name, value, inline} objects (max 25 fields)

content

string

No

Plain text alongside the embed

guild_id

string

No

Server ID. Required if channel is a name and no default is set.

Environment Variables

Variable

Required

Description

DISCORD_BOT_TOKEN

Yes

Bot token from Discord Developer Portal

DISCORD_DEFAULT_GUILD_ID

No

Default server ID for all tool calls

Architecture

Claude Code  ←stdio→  MCP Server (Python)  ←HTTPS→  Discord API v10
  • src/discord_mcp/types.py — Pydantic models with Discord API limit validation (Channel, Message, SendResult, Embed)

  • src/discord_mcp/discord_client.py — Async Discord REST API wrapper using httpx

  • src/discord_mcp/server.py — MCP tool definitions and handler functions

Key design decisions:

  • All Discord API interaction goes through DiscordClient — never call httpx directly from server.py

  • Tool handlers are separated from @mcp.tool() decorators for testability

  • Channel names are resolved case-insensitively via the Discord API

  • Guild ID follows a fallback chain: explicit parameter → DISCORD_DEFAULT_GUILD_ID env var → None

Security

  • Input validation — Guild IDs and channel IDs are validated as numeric Discord snowflakes before use in API URLs

  • Content length enforcement — Message content (2000 chars) and all embed fields (title 256, description 4096, field name 256, field value 1024, max 25 fields, 6000 total) are validated before sending to the Discord API

  • Embed sanitization — Embed fields are validated through Pydantic models (EmbedField), preventing injection of arbitrary embed properties

  • Error message hygiene — Failed channel lookups do not enumerate available channels, preventing server structure disclosure

  • Rate limit handling — The client retries once with backoff on 429 responses (capped at 5s)

  • Docker hardening — Container runs as a non-root appuser

  • Dependency pinning — All dependencies (production and dev) use compatible-release (~=) constraints

  • Reproducible buildsrequirements-lock.txt pins all transitive dependency versions; Docker builds install from the lock file

Development

Running locally (without Docker)

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

export DISCORD_BOT_TOKEN=your-token
export DISCORD_DEFAULT_GUILD_ID=your-guild-id

discord-mcp

Running tests

pip install -e ".[dev]"
pytest tests/ -v

Tests use respx to mock httpx requests — no real Discord API calls are made.

License

MIT

Available Tools

4 tools
discord_list_channelsA

List all text channels in a Discord server.

Args: guild_id: The Discord server/guild ID

ParametersJSON Schema
NameRequiredDescriptionDefault
guild_idYes

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It specifies 'text channels' (excluding voice/categories) but omits pagination behavior, required permissions, rate limits, and error handling for invalid guild IDs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Optimal structure: single sentence stating purpose, followed by Args section. No redundancy, front-loaded with key verb, appropriate length for tool complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Adequate for a simple single-parameter tool without output schema, but gaps remain regarding return format (channel objects structure), pagination, and permission requirements that would help agent invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage. Description compensates by defining guild_id as 'The Discord server/guild ID'. Could enhance with snowflake format note, but adequately covers the single required parameter.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear specific verb ('List') + resource ('text channels') + scope ('Discord server'). Distinguishes from siblings (read_messages, send_message) by operation type.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Implied usage through clear naming and verb choice, but lacks explicit guidance on when to prefer this over siblings or prerequisites like bot permissions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

discord_read_messagesA

Read recent messages from a Discord channel.

Args: channel: Channel ID or channel name guild_id: Server/guild ID. Required when channel is a name. Falls back to DISCORD_DEFAULT_GUILD_ID. limit: Number of messages to retrieve (default 10, max 50)

ParametersJSON Schema
NameRequiredDescriptionDefault
channelYes
guild_idNo
limitNo

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description carries the full burden. It discloses constraints like 'max 50' and fallback behavior to DISCORD_DEFAULT_GUILD_ID, but omits safety profile, permissions required, or response format details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a single-sentence purpose statement followed by a clean Args section. Every line provides essential information without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

While all input parameters are well-documented, the absence of an output schema and annotations leaves gaps regarding the return message structure and operational safety profile that the description does not fill.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description fully compensates by documenting all three parameters: channel (ID or name), guild_id (conditional requirement), and limit (default/max values).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb ('Read') and resource ('recent messages from a Discord channel'), clearly distinguishing it from siblings like discord_send_message and discord_list_channels.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear parameter-level guidance (e.g., 'Required when channel is a name' for guild_id), but lacks explicit comparison to sibling tools regarding when to read versus send messages.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

discord_send_embedA

Send a rich embed message to a Discord channel.

Args: channel: Channel ID or channel name title: Embed title description: Embed body text color: Embed color as decimal (e.g. 3447003 for blue) fields: List of field objects with name, value, and optional inline boolean content: Plain text to send alongside the embed guild_id: Server/guild ID. Required when channel is a name. Falls back to DISCORD_DEFAULT_GUILD_ID.

ParametersJSON Schema
NameRequiredDescriptionDefault
channelYes
titleYes
descriptionNo
colorNo
fieldsNo
contentNo
guild_idNo

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It successfully documents the fallback behavior for 'guild_id' to DISCORD_DEFAULT_GUILD_ID, but omits critical behavioral traits like required permissions, rate limits, error handling, or whether this creates a persistent public message.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear purpose statement followed by an Args block. Given the necessity to document 7 parameters with zero schema coverage, the length is appropriate and every line adds necessary value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description adequately covers the complex input schema (including the nested fields structure), but lacks information about return values (no output schema exists), error scenarios, or side effects that would be expected for a messaging tool with no annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage. The Args block compensates perfectly by documenting all 7 parameters with clear semantics and useful examples (e.g., '3447003 for blue' for the color parameter, and structure details for the fields array).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool sends a 'rich embed message' (specific verb + resource) to a Discord channel. It implicitly distinguishes from sibling 'discord_send_message' by specifying 'rich embed', though it doesn't explicitly contrast the two tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a conditional usage rule for 'guild_id' (required when channel is a name), but fails to specify when to choose this tool over the plain 'discord_send_message' alternative or mention any prerequisites like bot permissions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

discord_send_messageA

Send a plain text message to a Discord channel.

Args: channel: Channel ID or channel name (e.g. "general" or "123456789") content: The message text to send guild_id: Server/guild ID. Required when channel is a name. Falls back to DISCORD_DEFAULT_GUILD_ID.

ParametersJSON Schema
NameRequiredDescriptionDefault
channelYes
contentYes
guild_idNo

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full disclosure burden. It successfully documents the guild_id fallback behavior (DISCORD_DEFAULT_GUILD_ID) and conditional requirement logic, but fails to mention permission requirements, rate limits, or error handling patterns for this mutating operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is optimally structured with the core purpose in the first sentence followed by an Args section. Every line provides essential information without redundancy; the examples ('general' or '123456789') are high-value additions.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given three parameters and no output schema, the description thoroughly covers input semantics and validation logic. Minor gap: no mention of return value or success indicators, though the absence of output schema reduces the burden slightly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, requiring the description to compensate fully. The Args section excellently documents all three parameters: channel includes format examples (ID or name), content defines the payload, and guild_id explains conditional requirement and environment fallback behavior.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description opens with a specific verb ('Send') + resource ('plain text message') + target ('Discord channel'). The 'plain text' qualification effectively distinguishes it from sibling tool discord_send_embed, clarifying this is not for rich embeds.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying 'plain text,' suggesting discord_send_embed for rich content, but does not explicitly state when to use this tool versus siblings or provide explicit exclusions (e.g., 'do not use for embeds').

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

A3.9/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: listing channels, reading messages, sending plain messages, and sending rich embeds. There is no functional overlap between these operations, making tool selection straightforward for an agent.

Naming Consistency5/5

All tools follow a consistent 'discord_verb_noun' naming pattern with snake_case throughout. This predictable structure makes the tool set easy to navigate and understand at a glance.

Tool Count4/5

With 4 tools, the server covers core Discord operations well for its apparent scope of channel/message management. It's slightly lean but reasonable; additional tools like editing/deleting messages or managing reactions could enhance completeness without being essential.

Completeness3/5

The tool set covers basic read and send operations but has notable gaps for a full Discord interaction surface. Missing are tools for updating/deleting messages, managing reactions, or handling other Discord features like voice channels or user management, which could limit agent workflows.

Maintenance

ActivityInactive
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables LLMs to interact with Discord channels by sending and reading messages through Discord's API, with a focus on maintaining user control and security.
    32
    228
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables interaction with Discord through the Model Context Protocol, providing access to all Discord features like channels, messages, threads, reactions, and roles. Supports secure Discord bot operations with rate limiting, caching, and comprehensive API coverage for OpenAI, LangChain, and other MCP clients.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI models to interact with Discord using human-readable channel names and usernames through smart target resolution and automatic mention processing. It provides tools for sending messages, reading channel history, and searching for content without requiring manual snowflake ID lookups.
    Apache 2.0
  • A
    license
    A
    quality
    A
    maintenance
    Exposes the Discord REST API to AI agents via the Model Context Protocol, enabling message sending and other Discord interactions.
    209
    348
    72
    Apache 2.0

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/erinlkolp/discord-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server