discord-mcp

discord-mcp

Control your Discord server with AI. Lets you manage channels, roles, members, messages, and more through natural language.

Category
访问服务器

README

discord-mcp

Control your Discord server with AI. Connect this MCP server to Claude, Cursor, Copilot, or any MCP-compatible AI tool and manage your server through conversation — no Discord dashboard required.

What you can do

Once connected, just ask your AI assistant naturally:

  • Set up a server from scratch — create channels, categories, and roles with a consistent layout and style
  • Manage members — search members, assign roles, issue timeouts, kick or ban users, view ban lists
  • Send and manage messages — post to channels, edit messages, pin important posts, add reactions, purge messages
  • Moderate automatically — create and manage AutoMod rules to filter content
  • Schedule events — create and manage scheduled events, stage instances, and announcements
  • Organize channels — reorder channels and categories, set permissions per role, manage threads
  • Customize your server — update server settings, manage emojis, stickers, and soundboard sounds
  • Create invites and webhooks — generate invite links, set up webhooks for integrations
  • Review activity — read audit logs to see who did what and when

Destructive actions (deleting channels, banning members, purging messages) always require explicit confirmation before anything happens.

Requirements

  • Bun — the JavaScript runtime that runs this server
  • A Discord bot token and application ID (create one here)

Setup

1. Install dependencies

bun install

2. Create your config file

cp .env.example .env

3. Fill in your Discord credentials

Open .env and set at minimum:

DISCORD_TOKEN=your_bot_token_here
DISCORD_APPLICATION_ID=your_app_id_here

Make sure your bot has been invited to your server with the necessary permissions.

4. Start the server

bun run start

The MCP server is now running at http://127.0.0.1:3456/mcp.

Connect to your AI tool

Claude Desktop

Open Claude Desktop settings → MCP → Add server:

  • URL: http://127.0.0.1:3456/mcp
  • Transport: Streamable HTTP

Restart Claude Desktop after saving.

Claude Code

claude mcp add --transport http discord-mcp http://127.0.0.1:3456/mcp

Cursor

Create .cursor/mcp.json in your project (or ~/.cursor/mcp.json globally):

{
  "mcpServers": {
    "discord-mcp": {
      "url": "http://127.0.0.1:3456/mcp"
    }
  }
}

Restart Cursor, then verify tools are available in Agent chat.

VS Code (Copilot / Agent Mode)

Create .vscode/mcp.json in your project:

{
  "servers": {
    "discord-mcp": {
      "type": "http",
      "url": "http://127.0.0.1:3456/mcp"
    }
  }
}

Then run MCP: List Servers from the command palette to verify.

GitHub Copilot CLI

Edit ~/.copilot/mcp-config.json:

{
  "mcpServers": {
    "discord-mcp": {
      "type": "http",
      "url": "http://127.0.0.1:3456/mcp",
      "tools": ["*"]
    }
  }
}

Safety

A few built-in guardrails:

  • Guild allowlist — set DISCORD_GUILD_ALLOWLIST to a comma-separated list of server IDs to restrict which servers the bot can touch
  • Dry run mode — set DISCORD_DRY_RUN=true to preview what would happen without actually making any changes
  • Confirmation required — delete and ban operations require confirm: true to execute

Optional: keep your bot online (Gateway mode)

By default the server uses Discord's REST API only — no persistent connection. If you want the bot to appear online and enable presence features, add this to your .env:

DISCORD_GATEWAY_ENABLED=true
DISCORD_GATEWAY_INTENTS=Guilds

Advanced configuration

All available environment variables:

Variable Default Description
DISCORD_TOKEN required Your bot token
DISCORD_APPLICATION_ID required Your application ID
DISCORD_BOT_ID optional Bot user ID
DISCORD_GUILD_ALLOWLIST optional Comma-separated list of allowed guild IDs
DISCORD_DRY_RUN false Block all mutations, return previews instead
DISCORD_GATEWAY_ENABLED false Enable live Gateway connection
DISCORD_GATEWAY_INTENTS Guilds Comma-separated intent names or numeric bitfield
MCP_HTTP_HOST 127.0.0.1 Host to bind to
MCP_HTTP_PORT 3456 Port to listen on
MCP_HTTP_PATH /mcp URL path for the MCP endpoint
MCP_SESSION_TTL_MS 3600000 How long an idle session lives (ms)
MCP_SESSION_CLEANUP_MS 300000 How often stale sessions are cleaned up (ms)

For developers

To run in dev mode with auto-reload:

bun --watch run src/index.ts

Type-check and build:

bun run check   # type-check only
bun run build   # compile to dist/
bun test src    # run tests

Health check:

curl http://127.0.0.1:3456/health

See ARCHITECTURE.md for how the codebase is structured and how to add new tools.

<details> <summary>Full tool list</summary>

Guild: discord_list_guilds, discord_get_guild_settings, discord_update_guild_settings, discord_get_guild_preview, discord_get_guild_inventory, discord_get_guild_widget_settings, discord_update_guild_widget_settings, discord_get_guild_vanity_url, discord_get_guild_prune_count, discord_begin_guild_prune, discord_list_guild_integrations, discord_get_guild_welcome_screen, discord_update_guild_welcome_screen, discord_list_guild_templates, discord_create_guild_template, discord_sync_guild_template, discord_update_guild_template, discord_delete_guild_template, discord_list_guild_voice_regions, discord_list_voice_regions

Channels: discord_create_channel, discord_update_channel, discord_delete_channel, discord_list_channel_permission_overwrites, discord_set_channel_permission_overwrite, discord_delete_channel_permission_overwrite, discord_modify_guild_channel_positions

Roles: discord_create_role, discord_update_role, discord_delete_role, discord_get_role_member_counts, discord_modify_guild_role_positions

Members: discord_list_members, discord_search_members, discord_fetch_member, discord_edit_member, discord_set_member_timeout, discord_kick_member, discord_ban_member, discord_bulk_ban_members, discord_unban_member, discord_fetch_guild_ban, discord_list_guild_bans, discord_add_member_role, discord_remove_member_role, discord_set_current_member_voice_state, discord_set_member_voice_state

Messages: discord_list_channel_messages, discord_list_pinned_messages, discord_fetch_message, discord_send_message, discord_edit_message, discord_crosspost_message, discord_pin_message, discord_unpin_message, discord_delete_message, discord_purge_messages, discord_add_reaction, discord_remove_own_reaction, discord_remove_user_reaction, discord_list_reaction_users, discord_clear_reactions, discord_clear_emoji_reactions, discord_end_poll, discord_list_poll_answer_voters

Threads: discord_create_thread, discord_update_thread, discord_join_thread, discord_leave_thread, discord_lock_thread, discord_unlock_thread, discord_remove_thread_member, discord_delete_thread, discord_list_active_threads

Webhooks: discord_list_guild_webhooks, discord_list_channel_webhooks, discord_create_webhook, discord_update_webhook, discord_delete_webhook, discord_execute_webhook_by_token, discord_fetch_webhook_message_by_token, discord_edit_webhook_message_by_token, discord_delete_webhook_message_by_token

Scheduled events: discord_list_scheduled_events, discord_fetch_scheduled_event, discord_create_scheduled_event, discord_update_scheduled_event, discord_delete_scheduled_event, discord_list_scheduled_event_users

Stage: discord_create_stage_instance, discord_fetch_stage_instance, discord_update_stage_instance, discord_delete_stage_instance

Invites: discord_list_guild_invites, discord_create_channel_invite, discord_delete_invite, discord_get_invite_target_users, discord_get_invite_target_user_job_status, discord_update_invite_target_users

AutoMod: discord_list_automod_rules, discord_create_automod_rule, discord_update_automod_rule, discord_delete_automod_rule

Emojis & stickers: discord_list_guild_emojis, discord_create_guild_emoji, discord_update_guild_emoji, discord_delete_guild_emoji, discord_list_guild_stickers, discord_create_guild_sticker, discord_update_guild_sticker, discord_delete_guild_sticker, discord_list_sticker_packs, discord_get_sticker_pack, discord_get_sticker, discord_list_application_emojis, discord_create_application_emoji, discord_update_application_emoji, discord_delete_application_emoji

Soundboard: discord_list_guild_soundboard_sounds, discord_create_guild_soundboard_sound, discord_update_guild_soundboard_sound, discord_delete_guild_soundboard_sound

Audit logs: discord_list_guild_audit_logs

Presence (gateway required): discord_get_presence_state, discord_set_presence

Gateway: discord_get_gateway_info

</details>

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选