Skip to main content
Glama
hevji

Discord MCP Server

by hevji

Discord MCP Server

直接从你的 AI 编程助手中管理 Discord 服务器。创建频道、分类、角色,设置权限,分配角色,以及更多操作——全部通过自然语言完成。

virustotal: https://www.virustotal.com/gui/file/56fafed35e2734debed600e585741c53f456148da257065e9ea8c9fcb62c798d

工具

工具

描述

create_category

创建新的分类频道

create_channel

在分类下创建文字或语音频道

create_role

创建具有颜色、独立显示、可提及属性的新角色

edit_role

编辑角色的名称、颜色、独立显示或可提及属性

delete_role

删除角色(非托管,且位于机器人层级之下)

assign_role

按用户名将角色分配给成员

remove_role

按用户名移除成员的角色

restrict_channel

设置频道权限(允许/拒绝角色、只读模式、帖子控制)

create_role_restricted_channel

一次调用即可创建频道并设置限制

rename_channel

重命名文字或语音频道

delete_category

删除分类频道

delete_channel

删除文字或语音频道

list_channels

列出所有频道及其名称、类型和分类

list_roles

列出所有角色及其名称、颜色和成员数量

create_webhook

在文字频道中创建 Webhook

send_webhook_message

通过现有 Webhook 发送消息

set_slowmode

设置文字频道的慢速模式延迟(秒)

Related MCP server: discord-mcp

设置

1. 创建 Discord 机器人

  1. 前往 https://discord.com/developers/applications

  2. 点击新建应用 → 为其命名 → 创建

  3. 转到机器人添加机器人

  4. 特权网关意图下,启用:

    • Server Members Intent

    • Message Content Intent

  5. 复制令牌

  6. 转到 OAuth2URL 生成器

    • 作用域:bot

    • 机器人权限:Administrator(或手动选择:管理频道、管理角色、踢出成员、管理 Webhook、发送消息、读取消息、查看频道)

  7. 在浏览器中打开生成的 URL,将机器人邀请到你的服务器

2. 配置环境

cp .env.example .env

编辑 .env 并粘贴你的机器人令牌:

DISCORD_TOKEN=your_token_here

可选:按名称将机器人固定到特定服务器(默认为 Monolith)。所有工具仅在此服务器上运行:

DISCORD_GUILD_NAME=Monolith

3. 安装依赖

pip install -r requirements.txt

MCP 主机配置

opencode

将以下内容添加到项目根目录的 opencode.json 中:

{
  "mcp": {
    "discord": {
      "type": "local",
      "command": ["python", "/absolute/path/to/discord_mcp_server.py"]
    }
  }
}

重启 opencode 以加载服务器。

Claude Desktop

编辑 claude_desktop_config.json(文件 → 设置 → 开发者 → 编辑配置):

{
  "mcpServers": {
    "discord": {
      "command": "python",
      "args": ["/absolute/path/to/discord_mcp_server.py"],
      "env": {
        "DISCORD_TOKEN": "your_token_here"
      }
    }
  }
}

Claude Code

将以下内容添加到 ~/.claude.json 或项目中的 .mcp.json

{
  "mcpServers": {
    "discord": {
      "command": "python",
      "args": ["/absolute/path/to/discord_mcp_server.py"],
      "env": {
        "DISCORD_TOKEN": "your_token_here"
      }
    }
  }
}

Cursor

在项目根目录创建 .cursor/mcp.json(或全局使用 ~/.cursor/mcp.json):

{
  "mcpServers": {
    "discord": {
      "command": "python",
      "args": ["/absolute/path/to/discord_mcp_server.py"],
      "env": {
        "DISCORD_TOKEN": "your_token_here"
      }
    }
  }
}

Windsurf

将以下内容添加到 ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "discord": {
      "command": "python",
      "args": ["/absolute/path/to/discord_mcp_server.py"],
      "env": {
        "DISCORD_TOKEN": "your_token_here"
      }
    }
  }
}

Codex CLI

将以下内容添加到 ~/.codex/config.toml

[mcp_servers.discord]
command = "python"
args = ["/absolute/path/to/discord_mcp_server.py"]

[mcp_servers.discord.env]
DISCORD_TOKEN = "your_token_here"

或通过 CLI 添加:

codex mcp add discord -- python /absolute/path/to/discord_mcp_server.py

Antigravity (Google)

将以下内容添加到 ~/.gemini/config/mcp_config.json

{
  "mcpServers": {
    "discord": {
      "command": "python",
      "args": ["C:\\path\\to\\discord_mcp_server.py"],
      "env": {
        "DISCORD_TOKEN": "your_token_here"
      }
    }
  }
}

打开 Antigravity → Agent 面板 → ... → MCP 服务器 → 管理 MCP 服务器 → 查看原始配置。

注意: 如果使用 .env 文件而不是内联的 env,请省略 env 块,并确保脚本中的 load_dotenv() 能找到你的 .env(工作目录取决于主机)。

工作原理

该脚本通过 stdio 运行一个 MCP 服务器,通过机器人令牌连接到 Discord。它在启动时注册所有工具,你的 AI 助手可以按需调用这些工具。Discord 机器人只需要在一个服务器中——它会在登录时自动选择第一个服务器。

Maintenance

ActivityMaintained
ResponsivenessSyncing

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
    B
    maintenance
    Enables AI clients to manage Discord servers through natural language, offering tools for guilds, channels, messages, roles, members, webhooks, invites, and automations. Includes a conversational agent that responds to @mentions in Discord.
    8
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Control your Discord server with AI. Lets you manage channels, roles, members, messages, and more through natural language.
    348
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables managing a Discord server using natural language through AI clients like Claude, with 139 admin tools across 20 categories for roles, channels, members, messages, threads, moderation, and more.
    168
    28
    MIT
  • A
    license
    B
    quality
    A
    maintenance
    Gives your AI assistant full control of a Discord server: 148 tools for chat, moderation, automod, events, and administration, up to building a complete community server from one paragraph. Every destructive action previews first and waits for your confirmation.
    100
    154
    7
    Elastic 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/hevji/Discord-Bot-MCP'

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