返回市场
MCP- Discord服务器

MCP- Discord服务器

作者:barryyip062555 星标更新:2025-11-05

项目介绍

MCP-Discord

smithery 徽章 Docker Hub

一个允许AI助手与Discord平台交互的Discord MCP(模型上下文协议)服务器。

<a href="https://glama.ai/mcp/servers/@barryyip0625/mcp-discord"> <img width="380" height="200" src="https://gips1.baidu.com/it/u=4205092261,865043839&fm=3081&app=3_3081&f=PNG?w=760&h=400" alt="MCP-Discord MCP 服务器" /> </a>

概述

MCP-Discord 提供以下与Discord相关的功能:

  • 登录到Discord机器人
  • 列出机器人所属的所有服务器
  • 获取服务器信息
  • 在服务器中搜索消息
  • 读取/删除频道消息
  • 向指定频道发送消息(可以使用频道ID或频道名称)
  • 获取论坛频道列表
  • 创建/删除/回复论坛帖子
  • 创建/删除文本频道
  • 添加/移除消息反应
  • 创建/编辑/删除/使用网络钩子

目录

先决条件

注意: 根据Discord的安全模型,机器人只能访问它被明确添加到的服务器的信息。 如果您想使用此MCP服务器访问特定的Discord服务器,必须首先将机器人添加到该服务器。 使用下面的邀请链接将机器人添加到目标服务器。

安装

通过NPM安装

您可以使用以下命令:

npx mcp-discord --config ${DISCORD_TOKEN}

更多详情,请参阅NPM 包

通过Smithery安装

要通过Smithery自动安装mcp-discord

通过Docker安装

您可以使用Docker运行mcp-discord。Docker镜像会自动构建并发布到Docker Hub。

Docker Hub 仓库barryy625/mcp-discord

Docker容器默认使用stdio

# 拉取最新镜像
docker pull barryy625/mcp-discord:latest

# 使用环境变量运行
docker run -e DISCORD_TOKEN=your_discord_bot_token barryy625/mcp-discord:latest

# 或者使用命令行配置运行
docker run barryy625/mcp-discord:latest --config "your_discord_bot_token"

或者,覆盖--transport--port标志以在您选择的端口上运行http。在这种情况下,还需要映射端口。

# 拉取最新镜像
docker pull barryy625/mcp-discord:latest

# 使用环境变量运行
docker run -e DISCORD_TOKEN=your_discord_bot_token -p 8080:8080 barryy625/mcp-discord:latest --transport http --port 8081

# 或者使用命令行配置运行
docker run -p 8080:8080 barryy625/mcp-discord:latest --config "your_discord_bot_token" --transport http --port 8081

可用标签:

  • latest - 主分支上的最新稳定版本
  • v1.3.3等 - 特定版本发布

手动安装

# 克隆仓库
git clone https://github.com/barryyip0625/mcp-discord.git
cd mcp-discord

# 安装依赖
npm install

# 编译TypeScript
npm run build

配置

需要Discord机器人令牌才能正常运行。服务器支持两种传输方式:stdio和流式HTTP。

传输方式

  1. stdio(默认)

    • 传统的stdio传输,适用于基本用途
    • 适合简单的集成
  2. 流式HTTP

    • 基于HTTP的传输,适用于更高级的场景
    • 支持无状态操作
    • 可配置端口号

配置选项

您可以使用两种方式提供配置:

  1. 环境变量:
DISCORD_TOKEN=your_discord_bot_token
  1. 使用命令行参数:
# 对于stdio传输(默认)
node build/index.js --config "your_discord_bot_token"

# 对于流式HTTP传输
node build/index.js --transport http --port 3000 --config "your_discord_bot_token"

与Claude/Cursor的使用

Docker

您可以使用Docker容器与Claude和Cursor:

{
    "mcpServers": {
        "discord": {
            "command": "docker",
            "args": [
                "run",
                "--rm",
                "-e",
                "DISCORD_TOKEN=your_discord_bot_token",
                "-p",
                "8080:8080",
                "barryy625/mcp-discord:latest",
                "--transport",
                "http",
                "--port",
                "8080"
            ]
        }
    }
}

Claude

  1. 使用stdio传输:
{
    "mcpServers": {
        "discord": {
            "command": "node",
            "args": [
                "path/to/mcp-discord/build/index.js",
                "--config",
                "your_discord_bot_token"
            ]
        }
    }
}
  1. 使用流式HTTP传输:
{
    "mcpServers": {
        "discord": {
            "command": "node",
            "args": [
                "path/to/mcp-discord/build/index.js",
                "--transport",
                "http",
                "--port",
                "3000",
                "--config",
                "your_discord_bot_token"
            ]
        }
    }
}

Cursor

  1. 使用stdio传输:
{
    "mcpServers": {
        "discord": {
            "command": "cmd",
            "args": [
                "/c",
                "node",
                "path/to/mcp-discord/build/index.js",
                "--config",
                "your_discord_bot_token"
            ]
        }
    }
}
  1. 使用流式HTTP传输:
{
    "mcpServers": {
        "discord": {
            "command": "cmd",
            "args": [
                "/c",
                "node",
                "path/to/mcp-discord/build/index.js",
                "--transport",
                "http",
                "--port",
                "3000",
                "--config",
                "your_discord_bot_token"
            ]
        }
    }
}

工具文档

基本功能

  • discord_login: 使用配置的令牌登录到Discord
  • discord_list_servers: 列出机器人所属的所有Discord服务器
  • discord_send: 向指定频道发送消息(支持频道ID和频道名称)
  • discord_get_server_info: 获取Discord服务器信息

频道管理

  • discord_create_text_channel: 创建文本频道
  • discord_delete_channel: 删除频道

论坛功能

  • discord_get_forum_channels: 获取论坛频道列表
  • discord_create_forum_post: 创建论坛帖子
  • discord_get_forum_post: 获取论坛帖子
  • discord_reply_to_forum: 回复论坛帖子
  • discord_delete_forum_post: 删除论坛帖子

消息和反应

  • discord_search_messages: 在服务器中搜索消息
  • discord_read_messages: 读取频道消息
  • discord_add_reaction: 向消息添加反应
  • discord_add_multiple_reactions: 向消息添加多个反应
  • discord_remove_reaction: 从消息中移除反应
  • discord_delete_message: 从频道中删除特定消息

网络钩子管理

  • discord_create_webhook: 为Discord频道创建新的网络钩子
  • discord_send_webhook_message: 使用网络钩子向Discord频道发送消息
  • discord_edit_webhook: 编辑现有网络钩子
  • discord_delete_webhook: 删除现有网络钩子

开发

# 开发模式
npm run dev

许可

MIT 许可证