Skip to main content
Glama

Discord MCP Server

License: MIT Python 3.12+ Discord

A comprehensive Model Context Protocol (MCP) server for Discord integration. This server exposes all Discord functionality as MCP tools, enabling seamless integration with AI assistants like OpenAI, LangChain, Cursor, and Claude.

🌟 Features

  • Complete Discord API Coverage: Channels, messages, threads, reactions, roles, webhooks, and more

  • MCP Standard Compliance: JSON-RPC 2.0 based standardized API

  • High Performance: Redis caching, rate limiting, automatic retries with exponential backoff

  • Security First: Mention filtering, minimal permissions, audit logging

  • Production Ready: Docker support, CI/CD pipeline, comprehensive monitoring

  • Advanced AI Features: Message summarization, activity analysis, intelligent filtering

Related MCP server: MCP-Discord

πŸš€ Quick Start

Prerequisites

  • Python 3.12+

  • Discord Bot Token

  • Redis 6.0+ (optional - uses in-memory cache if not available)

Installation

  1. Clone the repository

    git clone https://github.com/tristan-kkim/discord-mcp.git
    cd discord-mcp
  2. Install dependencies

    pip install -r requirements.txt
  3. Configure environment

    cp .env.example .env
    # Edit .env with your Discord Bot Token
  4. Run the server

    python run.py

Docker Deployment

# Using Docker Compose (recommended)
export DISCORD_BOT_TOKEN=your_bot_token_here
docker-compose up -d

# Or using Docker directly
docker build -t discord-mcp .
docker run -d -p 8000:8000 -e DISCORD_BOT_TOKEN=your_token discord-mcp

πŸ”§ MCP Client Integration

Cursor IDE

  1. Open Cursor Settings β†’ MCP Servers

  2. Add server: http://localhost:8000/mcp

  3. Start using Discord tools in your AI conversations

OpenAI ChatGPT

  1. Create a Custom GPT

  2. Add Action with URL: http://your-server:8000/mcp

  3. Configure with your Discord server details

Claude Desktop

Add to your MCP configuration:

{
  "mcpServers": {
    "discord-mcp": {
      "command": "uvx",
      "args": ["discord-mcp@latest"],
      "env": {
        "DISCORD_BOT_TOKEN": "your_bot_token"
      }
    }
  }
}

πŸ“š Available MCP Tools

Channel & Guild Management

  • discord.list_guilds - List all guilds the bot is member of

  • discord.list_channels - List channels in a guild

  • discord.get_channel - Get channel information

  • discord.create_channel - Create a new channel

  • discord.update_channel - Update channel settings

  • discord.delete_channel - Delete a channel

Message Management

  • discord.list_messages - List messages in a channel

  • discord.get_message - Get specific message

  • discord.send_message - Send a message

  • discord.edit_message - Edit a message

  • discord.delete_message - Delete a message

  • discord.search_messages - Search messages with filters

Thread Management

  • discord.create_thread - Create a thread

  • discord.list_threads - List active/archived threads

  • discord.archive_thread - Archive a thread

  • discord.unarchive_thread - Unarchive a thread

Reactions, Pins & Webhooks

  • discord.add_reaction - Add reaction to message

  • discord.remove_reaction - Remove reaction

  • discord.list_reactions - List all reactions

  • discord.pin_message - Pin a message

  • discord.unpin_message - Unpin a message

  • discord.create_webhook - Create webhook

  • discord.send_via_webhook - Send message via webhook

Role & Permission Management

  • discord.list_roles - List guild roles

  • discord.add_role - Assign role to member

  • discord.remove_role - Remove role from member

  • discord.get_permissions - Get permission information

Advanced AI Features

  • discord.summarize_messages - AI-powered message summarization

  • discord.rank_messages - Intelligent message ranking

  • discord.sync_since - Delta synchronization

  • discord.analyze_channel_activity - Channel activity analysis

πŸ” API Reference

Endpoints

  • GET / - Server status

  • GET /health - Health check

  • GET /metrics - Prometheus-compatible metrics

  • POST /mcp - MCP JSON-RPC endpoint

Example Usage

# List available tools
curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "method": "mcp_list_tools", "id": 1}'

# Send a message
curl -X POST http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "mcp_call_tool",
    "params": {
      "tool": "discord.send_message",
      "params": {
        "channel_id": "123456789",
        "content": "Hello from MCP!"
      }
    },
    "id": 1
  }'

πŸ”’ Security

Bot Token Security

  • Never expose your bot token - Treat it like a password

  • Use environment variables - Never hardcode in source code

  • Minimal permissions - Only grant necessary Discord permissions

Required Discord Permissions

  • Send Messages - Send messages to channels

  • Read Message History - Read message history

  • Manage Messages - Edit/delete messages

  • Add Reactions - Add reactions to messages

  • Manage Channels - Create/modify channels (if needed)

  • Manage Roles - Manage roles (if needed)

Built-in Security Features

  • Automatic @everyone and @here mention filtering

  • Rate limiting with Discord API compliance

  • Audit logging for all operations

  • Input validation and sanitization

πŸ“Š Monitoring & Observability

Health Checks

curl http://localhost:8000/health

Metrics

curl http://localhost:8000/metrics

Logging

All logs are structured JSON with fields:

  • request_id - Unique request identifier

  • tool - MCP tool being called

  • channel_id - Discord channel context

  • latency_ms - Response time

  • success - Operation success status

πŸš€ Production Deployment

Environment Variables

Variable

Description

Default

Required

DISCORD_BOT_TOKEN

Discord Bot Token

-

βœ…

REDIS_URL

Redis connection URL

redis://localhost:6379

❌

LOG_LEVEL

Logging level

INFO

❌

RATE_LIMIT_ENABLED

Enable rate limiting

true

❌

CACHE_TTL

Cache TTL in seconds

300

❌

HOST

Server host

0.0.0.0

❌

PORT

Server port

8000

❌

Cloud Deployment

Heroku

heroku create your-discord-mcp
heroku config:set DISCORD_BOT_TOKEN=your_token
git push heroku main

Railway

railway login
railway init
railway add redis
railway deploy

AWS ECS/Fargate

# Use provided Dockerfile
docker build -t discord-mcp .
# Deploy to ECS with environment variables

πŸ§ͺ Testing

# Install test dependencies
pip install pytest pytest-asyncio pytest-cov

# Run unit tests
pytest tests/test_tools/

# Run integration tests
pytest tests/test_integration/

# Run with coverage
pytest --cov=. --cov-report=html

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“š Documentation

πŸ†˜ Support

πŸ”„ Changelog

v1.0.0 (2024-10-29)

  • πŸŽ‰ Initial release

  • βœ… Complete Discord API integration

  • βœ… MCP standard compliance

  • βœ… Docker support

  • βœ… Advanced AI features

  • βœ… Security enhancements

  • βœ… Comprehensive documentation


ν•œκ΅­μ–΄ λ¬Έμ„œ

Discord MCP μ„œλ²„

Discord와 ν†΅μ‹ ν•˜λŠ” Model Context Protocol(MCP) μ„œλ²„μž…λ‹ˆλ‹€. λͺ¨λ“  Discord κΈ°λŠ₯을 MCP Tool ν˜•νƒœλ‘œ λ…ΈμΆœν•˜μ—¬ OpenAI, LangChain, Cursor λ“±μ˜ MCP ν΄λΌμ΄μ–ΈνŠΈμ—μ„œ μ•ˆμ „ν•˜κ²Œ μ‚¬μš©ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

🌟 μ£Όμš” κΈ°λŠ₯

  • μ™„μ „ν•œ Discord API 지원: 채널, λ©”μ‹œμ§€, μŠ€λ ˆλ“œ, λ¦¬μ•‘μ…˜, μ—­ν• , μ›Ήν›… λ“± λͺ¨λ“  Discord κΈ°λŠ₯

  • MCP ν‘œμ€€ μ€€μˆ˜: JSON-RPC 2.0 기반의 ν‘œμ€€ν™”λœ API

  • κ³ μ„±λŠ₯: Redis 캐싱, Rate limit 관리, μ§€μˆ˜ λ°±μ˜€ν”„ μž¬μ‹œλ„

  • λ³΄μ•ˆ μš°μ„ : λ©˜μ…˜ 필터링, μ΅œμ†Œ κΆŒν•œ, 감사 둜그

  • ν”„λ‘œλ•μ…˜ μ€€λΉ„: Docker 지원, CI/CD νŒŒμ΄ν”„λΌμΈ, 포괄적 λͺ¨λ‹ˆν„°λ§

  • κ³ κΈ‰ AI κΈ°λŠ₯: λ©”μ‹œμ§€ μš”μ•½, ν™œλ™ 뢄석, μ§€λŠ₯ν˜• 필터링

πŸš€ λΉ λ₯Έ μ‹œμž‘

사전 μš”κ΅¬μ‚¬ν•­

  • Python 3.12+

  • Discord Bot Token

  • Redis 6.0+ (선택사항 - μ—†μœΌλ©΄ λ©”λͺ¨λ¦¬ μΊμ‹œ μ‚¬μš©)

μ„€μΉ˜

  1. μ €μž₯μ†Œ 클둠

    git clone https://github.com/tristan-kkim/discord-mcp.git
    cd discord-mcp
  2. μ˜μ‘΄μ„± μ„€μΉ˜

    pip install -r requirements.txt
  3. ν™˜κ²½ μ„€μ •

    cp .env.example .env
    # .env νŒŒμΌμ— Discord Bot Token μ„€μ •
  4. μ„œλ²„ μ‹€ν–‰

    python run.py

Docker 배포

# Docker Compose μ‚¬μš© (ꢌμž₯)
export DISCORD_BOT_TOKEN=your_bot_token_here
docker-compose up -d

# λ˜λŠ” Docker 직접 μ‚¬μš©
docker build -t discord-mcp .
docker run -d -p 8000:8000 -e DISCORD_BOT_TOKEN=your_token discord-mcp

πŸ”§ MCP ν΄λΌμ΄μ–ΈνŠΈ 톡합

Cursor IDE

  1. Cursor μ„€μ • β†’ MCP μ„œλ²„ μ—΄κΈ°

  2. μ„œλ²„ μΆ”κ°€: http://localhost:8000/mcp

  3. AI λŒ€ν™”μ—μ„œ Discord 도ꡬ μ‚¬μš© μ‹œμž‘

OpenAI ChatGPT

  1. Custom GPT 생성

  2. Action μΆ”κ°€: http://your-server:8000/mcp

  3. Discord μ„œλ²„ μ„ΈλΆ€μ‚¬ν•­μœΌλ‘œ ꡬ성

Claude Desktop

MCP ꡬ성에 μΆ”κ°€:

{
  "mcpServers": {
    "discord-mcp": {
      "command": "uvx",
      "args": ["discord-mcp@latest"],
      "env": {
        "DISCORD_BOT_TOKEN": "your_bot_token"
      }
    }
  }
}

πŸ“š μ‚¬μš© κ°€λŠ₯ν•œ MCP 도ꡬ

채널 및 κΈΈλ“œ 관리

  • discord.list_guilds - 봇이 μ†ν•œ λͺ¨λ“  κΈΈλ“œ λͺ©λ‘

  • discord.list_channels - κΈΈλ“œμ˜ 채널 λͺ©λ‘

  • discord.get_channel - 채널 정보 쑰회

  • discord.create_channel - μƒˆ 채널 생성

  • discord.update_channel - 채널 μ„€μ • μ—…λ°μ΄νŠΈ

  • discord.delete_channel - 채널 μ‚­μ œ

λ©”μ‹œμ§€ 관리

  • discord.list_messages - μ±„λ„μ˜ λ©”μ‹œμ§€ λͺ©λ‘

  • discord.get_message - νŠΉμ • λ©”μ‹œμ§€ 쑰회

  • discord.send_message - λ©”μ‹œμ§€ 전솑

  • discord.edit_message - λ©”μ‹œμ§€ νŽΈμ§‘

  • discord.delete_message - λ©”μ‹œμ§€ μ‚­μ œ

  • discord.search_messages - ν•„ν„°λ‘œ λ©”μ‹œμ§€ 검색

μŠ€λ ˆλ“œ 관리

  • discord.create_thread - μŠ€λ ˆλ“œ 생성

  • discord.list_threads - ν™œμ„±/μ•„μΉ΄μ΄λΈŒλœ μŠ€λ ˆλ“œ λͺ©λ‘

  • discord.archive_thread - μŠ€λ ˆλ“œ μ•„μΉ΄μ΄λΈŒ

  • discord.unarchive_thread - μŠ€λ ˆλ“œ μ–Έμ•„μΉ΄μ΄λΈŒ

λ¦¬μ•‘μ…˜, ν•€ 및 μ›Ήν›…

  • discord.add_reaction - λ©”μ‹œμ§€μ— λ¦¬μ•‘μ…˜ μΆ”κ°€

  • discord.remove_reaction - λ¦¬μ•‘μ…˜ 제거

  • discord.list_reactions - λͺ¨λ“  λ¦¬μ•‘μ…˜ λͺ©λ‘

  • discord.pin_message - λ©”μ‹œμ§€ κ³ μ •

  • discord.unpin_message - λ©”μ‹œμ§€ κ³ μ • ν•΄μ œ

  • discord.create_webhook - μ›Ήν›… 생성

  • discord.send_via_webhook - μ›Ήν›…μœΌλ‘œ λ©”μ‹œμ§€ 전솑

μ—­ν•  및 κΆŒν•œ 관리

  • discord.list_roles - κΈΈλ“œ μ—­ν•  λͺ©λ‘

  • discord.add_role - λ©€λ²„μ—κ²Œ μ—­ν•  λΆ€μ—¬

  • discord.remove_role - λ©€λ²„μ—μ„œ μ—­ν•  제거

  • discord.get_permissions - κΆŒν•œ 정보 쑰회

κ³ κΈ‰ AI κΈ°λŠ₯

  • discord.summarize_messages - AI 기반 λ©”μ‹œμ§€ μš”μ•½

  • discord.rank_messages - μ§€λŠ₯ν˜• λ©”μ‹œμ§€ μˆœμœ„

  • discord.sync_since - 델타 동기화

  • discord.analyze_channel_activity - 채널 ν™œλ™ 뢄석

πŸ”’ λ³΄μ•ˆ

Bot Token λ³΄μ•ˆ

  • Bot 토큰을 μ ˆλŒ€ λ…ΈμΆœν•˜μ§€ λ§ˆμ„Έμš” - λΉ„λ°€λ²ˆν˜Έμ²˜λŸΌ μ·¨κΈ‰

  • ν™˜κ²½λ³€μˆ˜ μ‚¬μš© - μ†ŒμŠ€μ½”λ“œμ— ν•˜λ“œμ½”λ”© κΈˆμ§€

  • μ΅œμ†Œ κΆŒν•œ - ν•„μš”ν•œ Discord κΆŒν•œλ§Œ λΆ€μ—¬

ν•„μš”ν•œ Discord κΆŒν•œ

  • Send Messages - 채널에 λ©”μ‹œμ§€ 전솑

  • Read Message History - λ©”μ‹œμ§€ 기둝 읽기

  • Manage Messages - λ©”μ‹œμ§€ νŽΈμ§‘/μ‚­μ œ

  • Add Reactions - λ©”μ‹œμ§€μ— λ¦¬μ•‘μ…˜ μΆ”κ°€

  • Manage Channels - 채널 생성/μˆ˜μ • (ν•„μš”μ‹œ)

  • Manage Roles - μ—­ν•  관리 (ν•„μš”μ‹œ)

λ‚΄μž₯ λ³΄μ•ˆ κΈ°λŠ₯

  • @everyone 및 @here λ©˜μ…˜ μžλ™ 필터링

  • Discord API μ€€μˆ˜ Rate limiting

  • λͺ¨λ“  μž‘μ—…μ— λŒ€ν•œ 감사 둜그

  • μž…λ ₯ 검증 및 μ •μ œ

πŸ“Š λͺ¨λ‹ˆν„°λ§ 및 κ΄€μ°°μ„±

ν—¬μŠ€μ²΄ν¬

curl http://localhost:8000/health

λ©”νŠΈλ¦­

curl http://localhost:8000/metrics

λ‘œκΉ…

λͺ¨λ“  λ‘œκ·ΈλŠ” λ‹€μŒ ν•„λ“œκ°€ ν¬ν•¨λœ κ΅¬μ‘°ν™”λœ JSONμž…λ‹ˆλ‹€:

  • request_id - 고유 μš”μ²­ μ‹λ³„μž

  • tool - ν˜ΈμΆœλ˜λŠ” MCP 도ꡬ

  • channel_id - Discord 채널 μ»¨ν…μŠ€νŠΈ

  • latency_ms - 응닡 μ‹œκ°„

  • success - μž‘μ—… 성곡 μƒνƒœ

πŸš€ ν”„λ‘œλ•μ…˜ 배포

ν™˜κ²½ λ³€μˆ˜

λ³€μˆ˜

μ„€λͺ…

κΈ°λ³Έκ°’

ν•„μˆ˜

DISCORD_BOT_TOKEN

Discord Bot Token

-

βœ…

REDIS_URL

Redis μ—°κ²° URL

redis://localhost:6379

❌

LOG_LEVEL

λ‘œκΉ… 레벨

INFO

❌

RATE_LIMIT_ENABLED

Rate limiting ν™œμ„±ν™”

true

❌

CACHE_TTL

μΊμ‹œ TTL (초)

300

❌

HOST

μ„œλ²„ 호슀트

0.0.0.0

❌

PORT

μ„œλ²„ 포트

8000

❌

ν΄λΌμš°λ“œ 배포

Heroku

heroku create your-discord-mcp
heroku config:set DISCORD_BOT_TOKEN=your_token
git push heroku main

Railway

railway login
railway init
railway add redis
railway deploy

AWS ECS/Fargate

# 제곡된 Dockerfile μ‚¬μš©
docker build -t discord-mcp .
# ν™˜κ²½ λ³€μˆ˜μ™€ ν•¨κ»˜ ECS에 배포

πŸ§ͺ ν…ŒμŠ€νŠΈ

# ν…ŒμŠ€νŠΈ μ˜μ‘΄μ„± μ„€μΉ˜
pip install pytest pytest-asyncio pytest-cov

# λ‹¨μœ„ ν…ŒμŠ€νŠΈ μ‹€ν–‰
pytest tests/test_tools/

# 톡합 ν…ŒμŠ€νŠΈ μ‹€ν–‰
pytest tests/test_integration/

# 컀버리지와 ν•¨κ»˜ μ‹€ν–‰
pytest --cov=. --cov-report=html

🀝 κΈ°μ—¬ν•˜κΈ°

κΈ°μ—¬λ₯Ό ν™˜μ˜ν•©λ‹ˆλ‹€! μžμ„Έν•œ λ‚΄μš©μ€ κΈ°μ—¬ κ°€μ΄λ“œλ₯Ό μ°Έμ‘°ν•˜μ„Έμš”.

  1. μ €μž₯μ†Œ 포크

  2. κΈ°λŠ₯ 브랜치 생성 (git checkout -b feature/amazing-feature)

  3. 변경사항 컀밋 (git commit -m 'Add amazing feature')

  4. λΈŒλžœμΉ˜μ— ν‘Έμ‹œ (git push origin feature/amazing-feature)

  5. Pull Request μ—΄κΈ°

πŸ“„ λΌμ΄μ„ μŠ€

이 ν”„λ‘œμ νŠΈλŠ” MIT λΌμ΄μ„ μŠ€ ν•˜μ— λ°°ν¬λ©λ‹ˆλ‹€. μžμ„Έν•œ λ‚΄μš©μ€ LICENSE νŒŒμΌμ„ μ°Έμ‘°ν•˜μ„Έμš”.

πŸ“š λ¬Έμ„œ

πŸ†˜ 지원

πŸ”„ λ³€κ²½ 둜그

v1.0.0 (2024-10-29)

  • πŸŽ‰ 초기 릴리즈

  • βœ… μ™„μ „ν•œ Discord API 톡합

  • βœ… MCP ν‘œμ€€ μ€€μˆ˜

  • βœ… Docker 지원

  • βœ… κ³ κΈ‰ AI κΈ°λŠ₯

  • βœ… λ³΄μ•ˆ κ°•ν™”

  • βœ… 포괄적 λ¬Έμ„œν™”

A
license - permissive license
-
quality - not tested
D
maintenance

Maintenance

–Maintainers
–Response time
–Release cycle
–Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    A Discord Model Context Protocol server that enables AI assistants to interact with Discord, providing functionality for sending messages, managing channels, handling forum posts, and working with reactions.
    Last updated
    22
    731
    100
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    A Discord Model Context Protocol server that enables AI assistants to interact with Discord by sending messages, managing channels, handling forum posts, managing webhooks, and processing reactions.
    Last updated
    22
    209
    5
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    A comprehensive Model Context Protocol server that enables interaction with Discord for channel management, message searching, and automated communication. It features enterprise-grade security with multi-tenant authentication, rate limiting, and real-time monitoring via a built-in inspector dashboard.
    Last updated
    14
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    Enables direct interaction with Discord servers to send messages, read channel history, and post rich embeds through natural conversation. It provides tools for listing channels and managing communication within Discord guilds using the Model Context Protocol.
    Last updated
    4

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

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/tristan-kkim/discord-mcp'

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