返回 MCP 目录
public公开dns本地运行

mcp-discord-raw

一个提供原始Discord API访问的MCP服务器,支持REST和斜杠命令两种调用方式

article

README

🚀 Discord 原始 API MCP 服务器

本 MCP 服务器借助灵活工具,为用户提供对 Discord 原始 API 的访问能力。它支持 REST API 调用以及 Slash 命令语法,能满足多样化的使用需求。

smithery badge

🚀 快速开始

本 Discord 原始 API MCP 服务器能让你便捷地使用 Discord 原始 API,支持 REST API 调用和 Slash 命令语法。下面为你介绍详细的安装、配置和使用方法。

✨ 主要特性

  • 提供灵活的 Discord 原始 API 访问途径。
  • 支持 REST API 调用和 Slash 命令语法。

📦 安装指南

通过 Smithery 安装

若要借助 Smithery 自动为 Claude Desktop 安装 Discord 原始 API,可使用以下命令:

npx -y @smithery/cli install @hanweg/mcp-discord-raw --client claude

手动安装

  1. 设置 Discord 机器人
  2. 安装依赖项并设置项目结构
git clone https://github.com/yourusername/mcp-discord-raw.git
cd mcp-discord-raw
npm install
  1. 配置 Discord API 的环境变量
    • 创建一个 .env 文件,并添加以下内容(需将 YOUR_DISCORD_TOKEN 替换为你自己的令牌):
DISCORD_TOKEN=your_discord_token_here
  1. 运行服务器
npm start

🛠️ 配置

config.json 文件中,添加以下配置以启用 Discord 原始 API 支持:

{
  "apiEndpoints": {
    "discord": {
      "url": "https://discord.com/api/v9"
    }
  },
  "botConfig": {
    "token": "your_discord_token_here",
    "prefix": "/"
  }
}

💻 使用示例

基础用法

REST API 风格

使用 raw 命令与 Discord API 进行交互:

{
  "command": "raw",
  "endpoint": "/users/{user_id}",
  "method": "GET",
  "headers": {
    "Authorization": "Bearer your_discord_token_here"
  }
}

Slash Command 风格

使用 slash 命令创建和管理 Slash 命令:

{
  "command": "slash",
  "name": "ping",
  "description": "测试机器人是否正常运行。",
  "options": []
}

高级用法

创建频道

使用以下 JSON 请求创建一个新频道:

{
  "command": "raw",
  "endpoint": "/guilds/{guild_id}/channels",
  "method": "POST",
  "headers": {
    "Authorization": "Bearer your_discord_token_here"
  },
  "body": {
    "name": "new-channel-name",
    "type": 0
  }
}

发送消息

使用以下 JSON 请求向指定频道发送消息:

{
  "command": "raw",
  "endpoint": "/channels/{channel_id}/messages",
  "method": "POST",
  "headers": {
    "Authorization": "Bearer your_discord_token_here"
  },
  "body": {
    "content": "Hello, Discord!"
  }
}

📚 详细文档

推荐内容

  • 保存 ID:创建请求返回的 ID 以便后续使用。
  • Unicode 表情符号:直接在消息中包含 Unicode 表情符号(如 \:champagne_glass:)可能会导致 Claude Desktop 挂起,请告知模型使用 Discord 表情符号。
  • 频道类型:0 = 文本,2 = 语音,4 = 类别,13 = 舞台
  • 角色颜色:以十进制格式表示(非十六进制)
  • 大多数修改端点:使用 PATCH 方法
  • 空有效负载:应为 {} 而不是 null

📄 许可证

本项目采用 MIT License 进行许可。

help

运行方式说明

cloud

托管运行

托管运行通常表示这个 MCP Server 由服务方环境承载,用户一般按页面提供的连接方式或授权流程接入,不需要在本地长期启动一个 MCP 进程

  1. 打开服务方连接页
  2. 完成授权或复制端点
  3. 在 MCP 客户端中连接
terminal

本地运行 / 其它方式

本地运行通常需要用户在自己的电脑或服务器上安装依赖,把 server_config 复制到 MCP 客户端,并按 env_schema 补齐环境变量、密钥或其它配置

  1. 复制 server_config
  2. 安装所需依赖
  3. 补齐环境变量后重启客户端