Back to MCP directory
publicPublicdnsLocal runtime

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

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client