Discord AI助手交互服务器
一个Discord模型上下文协议服务器,它使AI助手能够与Discord互动,提供发送消息、管理频道、处理论坛帖子和处理反应的功能。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"discord": {
"args": [
"/c",
"node",
"path/to/mcp-discord/build/index.js"
],
"command": "cmd",
"env": {
"DISCORD_TOKEN": "your_discord_bot_token"
}
}
}
}
该服务需要配置环境变量:DISCORD_TOKEN
可用工具 (15 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
test 1 个参数 需填 1 项
必填参数:name
discord_login 1 个参数
该工具无需必填参数,直接调用即可
discord_send 2 个参数 需填 2 项
必填参数:channelId、message
discord_get_forum_channels 1 个参数 需填 1 项
必填参数:guildId
discord_create_forum_post 4 个参数 需填 3 项
必填参数:forumChannelId、title、content
discord_get_forum_post 1 个参数 需填 1 项
必填参数:threadId
discord_reply_to_forum 2 个参数 需填 2 项
必填参数:threadId、message
discord_create_text_channel 3 个参数 需填 2 项
必填参数:guildId、channelName
discord_delete_channel 2 个参数 需填 1 项
必填参数:channelId
discord_read_messages 2 个参数 需填 1 项
必填参数:channelId
discord_get_server_info 1 个参数 需填 1 项
必填参数:guildId
discord_add_reaction 3 个参数 需填 3 项
必填参数:channelId、messageId、emoji
discord_add_multiple_reactions 3 个参数 需填 3 项
必填参数:channelId、messageId、emojis
discord_remove_reaction 4 个参数 需填 3 项
必填参数:channelId、messageId、emoji
discord_delete_forum_post 2 个参数 需填 1 项
必填参数:threadId
服务介绍
MCP-Discord
一个 Discord MCP(模型上下文协议)服务器,使 AI 助手能够与 Discord 平台进行交互。
概览
MCP-Discord 提供以下与 Discord 相关的功能:
- 登录 Discord 机器人
- 获取服务器信息
- 读取/删除频道消息
- 向指定频道发送消息
- 获取论坛频道列表
- 创建/删除/回复论坛帖子
- 创建/删除文本频道
- 添加/移除消息反应
- 创建/编辑/删除/使用 Webhook
目录
先决条件
- Node.js (v16.0.0 或更高版本)
- npm (v7.0.0 或更高版本)
- 一个具有适当权限的 Discord 机器人
- 机器人令牌(可从 Discord 开发者门户 获取)
- 启用消息内容意图
- 启用服务器成员意图
- 启用在线状态意图
- 在您的 Discord 服务器中的权限:
- 发送消息
- 创建公开线程
- 在线程中发送消息
- 管理线程
- 管理频道
- 添加反应
安装
通过 Smithery 安装
要通过 Smithery 自动为 Claude Desktop 安装 mcp-discord:
npx -y @smithery/cli install @barryyip0625/mcp-discord --client claude
手动安装
# Clone the repository
git clone https://github.com/barryyip0625/mcp-discord.git
cd mcp-discord
# Install dependencies
npm install
# Compile TypeScript
npm run build
配置
正常运行需要 Discord 机器人的令牌。您可以采用以下两种方式提供它:
- 环境变量:
DISCORD_TOKEN=your_discord_bot_token
- 启动时使用
--config参数:
node path/to/mcp-discord/build/index.js --config "{\"DISCORD_TOKEN\":\"your_discord_bot_token\"}"
与 Claude/Cursor 的使用
-
Claude
{ "mcpServers": { "discord": { "command": "node", "args": [ "path/to/mcp-discord/build/index.js" ], "env": { "DISCORD_TOKEN": "your_discord_bot_token" } } } } -
Cursor
{ "mcpServers": { "discord": { "command": "cmd", "args": [ "/c", "node", "path/to/mcp-discord/build/index.js" ], "env": { "DISCORD_TOKEN": "your_discord_bot_token" } } } }
工具文档
基本功能
discord_login: 登录 Discorddiscord_send: 向指定频道发送消息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_read_messages: 读取频道消息discord_add_reaction: 为消息添加反应discord_add_multiple_reactions: 为消息添加多个反应discord_remove_reaction: 从消息中移除反应discord_delete_message: 从频道中删除特定消息
Webhook 管理
discord_create_webhook: 为 Discord 频道创建一个新的 webhookdiscord_send_webhook_message: 使用 webhook 向 Discord 频道发送消息discord_edit_webhook: 编辑 Discord 频道的现有 webhookdiscord_delete_webhook: 删除 Discord 频道的现有 webhook
开发
# Development mode
npm run dev