mcp-discord

mcp-discord

An MCP server providing 26 tools for Discord API interactions, enabling message management, moderation, channel operations, and server inspection through Claude Code, Paperclip agents, or other MCP-compatible clients.

Category
访问服务器

README

@devli13/mcp-discord

npm License: MIT

An MCP server for Discord. Send messages, moderate, manage channels, inspect servers — from Claude Code, Paperclip agents, Gemini CLI, or any MCP-compatible client.

Pure REST wrapper. No Gateway. No database. Just Discord's v10 API as 26 well-documented tools, with per-route rate limiting and structured error results.


Why

Discord's API is sprawling and agent-unfriendly when called via raw curl. Agents hit rate limits, mishandle 429s, fumble audit-log reasons, forget pagination cursors. This MCP fixes that once, so agents can focus on intent: "delete that spam message," "post the daily digest to #mod-log," "timeout @user for an hour."

Also great for humans. Connected to Claude Code, you can say "summarize the last 50 messages in my Discord #dev channel" and Claude just does it.


Install

npm install -g @devli13/mcp-discord

Or via npx (no install):

DISCORD_BOT_TOKEN=<your-token> npx -y @devli13/mcp-discord

Setup

1. Create a Discord bot

  1. Go to https://discord.com/developers/applicationsNew Application
  2. Add a Bot to the application
  3. Copy the bot token — this is your DISCORD_BOT_TOKEN
  4. Invite the bot to your server using the OAuth2 URL generator (scope: bot). Pick permissions based on what you need the MCP to do (e.g. Manage Messages for deletes, Moderate Members for timeouts)

2. Wire it to your MCP client

Claude Code:

claude mcp add discord \
  --env DISCORD_BOT_TOKEN=<your-token> \
  -- npx -y @devli13/mcp-discord

Paperclip mcp-gateway (.mcp.json):

{
  "mcpServers": {
    "discord": {
      "command": "npx",
      "args": ["-y", "@devli13/mcp-discord"],
      "env": {
        "DISCORD_BOT_TOKEN": "<your-token>"
      }
    }
  }
}

Gemini CLI (~/.gemini/config.json):

{
  "mcpServers": {
    "discord": {
      "command": "npx",
      "args": ["-y", "@devli13/mcp-discord"]
    }
  }
}

3. (Optional) Enable privileged intents

If you want to list server members (discord_list_members) or use this MCP alongside the companion plugin for inbound events, enable Server Members Intent and Message Content Intent in your bot's Developer Portal settings. These are not required for most MCP operations — only for specific endpoints.


Tool reference

All tools are prefixed discord_* and return either a JSON blob (on success) or a formatted error message (on failure). None throw — every tool returns a usable string result.

Messages (8)

Tool Purpose
discord_send_message Send to a channel. Supports embeds, replies, mention control
discord_edit_message Edit the bot's own message
discord_delete_message Delete one message (by bot or others, with Manage Messages)
discord_bulk_delete_messages Delete 2-100 messages (<14 days old) in one call
discord_get_message Fetch one message by ID
discord_list_messages Paginated channel history (before/after/around cursors)
discord_pin_message / discord_unpin_message Manage pins

Reactions (3)

Tool Purpose
discord_add_reaction Bot adds a reaction
discord_remove_reaction Remove bot's or user's reaction
discord_get_reactions List users who reacted with an emoji

Channels & Threads (5)

Tool Purpose
discord_list_channels All channels in a guild
discord_get_channel Single channel details
discord_create_thread Spawn a new thread (public or private, anchored or standalone)
discord_list_active_threads All active threads in a guild
discord_send_typing Trigger "bot is typing…" indicator

Moderation (6)

Tool Purpose
discord_get_member Member profile (roles, join date, timeout state)
discord_list_members Paginated member list (requires Server Members intent)
discord_timeout_user Mute via communication_disabled_until (max 28 days, 0 to clear)
discord_kick_user Remove from guild
discord_add_role / discord_remove_role Role management

Server info (4)

Tool Purpose
discord_list_guilds All guilds the bot is in
discord_get_guild Single guild details
discord_list_roles All roles, sorted by position
discord_get_audit_log Recent audit log entries (filter by user, action, etc.)

Not included (by design):

  • ban/unban — deliberate. Use Discord's UI; irreversible actions shouldn't be one agent-call away
  • Channel create/delete/edit — high blast radius, use the UI
  • Webhook CRUD — not needed for most agent flows; can add in a future release
  • Voice operations, sticker/emoji management — out of scope for v0.1

Example: summarize a channel via Claude Code

User: Summarize the last 30 messages in the #dev channel of my Discord server, guild ID 1234...

Claude (calls discord_list_channels → finds #dev → calls discord_list_messages → writes summary)

Example: Paperclip agent daily digest

// From an agent's prompt:
"Post the daily digest to channel 1234. Summarize the last 24h of activity
using discord_list_messages with limit=100, then format as an embed via
discord_send_message."

Error handling

Every tool returns a usable text result. On error:

Error (DISCORD_50001, HTTP 403): Missing Access
Details: [...]
(This error is transient and may succeed on retry.)

The MCP already handles retries internally for 429 (rate limits) and 5xx (server errors), with exponential backoff.


Rate limits

Discord has two rate-limit layers:

  1. Per-route — each API endpoint has independent buckets. This MCP serializes requests per (method + route template) to prevent bursting past a 429.
  2. Global — per-bot, across all endpoints. The MCP honors Retry-After headers globally.

You shouldn't need to think about this. If you do hit the global limit repeatedly, you're probably doing something that deserves a human in the loop.


Security

  • Never commit your bot token. This MCP reads it from DISCORD_BOT_TOKEN environment variable at startup.
  • Use least-privilege invite URLs. Don't give bots Administrator if you only need Manage Messages.
  • Audit log reasons — all moderation tools accept a reason argument that appears in Discord's audit log. Use it.

Development

git clone https://github.com/devli13/mcp-discord.git
cd mcp-discord
npm install
npm test           # smoke tests (no live Discord calls)
npm run lint       # syntax check all files
npm start          # boot server over stdio (needs DISCORD_BOT_TOKEN)

Companion project — inbound events

This MCP handles outbound REST calls (send, delete, moderate). It does not hold a Discord Gateway WebSocket, so it can't react to inbound events (a user @mentioning the bot, DMs, new members joining).

For inbound Discord events in a Paperclip setup, use @devli13/paperclip-plugin-discord — a fork of @mvanhorn/paperclip-plugin-discord with free-form @mention routing, DM support, a serialized per-context message queue, and downtime mention backfill.

The two projects are designed to work together: the plugin receives events, invokes your agent; the agent uses this MCP to respond and moderate. Use either or both depending on your setup.

Attribution

See ATTRIBUTION.md. Short version: built alongside the fork of paperclip-plugin-discord by @mvanhorn, whose Gateway handling inspired design patterns here.

License

MIT — see LICENSE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选