remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Integrations
Enables interaction with Discord channels, allowing for sending messages and reading recent message history through Discord's API.
Discord MCP 服务器
一个模型上下文协议 (MCP) 服务器,使 LLM 能够与 Discord 频道交互,允许他们通过 Discord 的 API 发送和读取消息。使用此服务器,像 Claude 这样的 LLM 可以直接与 Discord 频道交互,同时保持用户的控制权和安全性。
特征
- 向 Discord 频道发送消息
- 阅读频道中的最新消息
- 自动服务器和频道发现
- 支持频道名称和 ID
- 正确的错误处理和验证
先决条件
- Node.js 16.x 或更高版本
- Discord 机器人令牌
- 必须以适当的权限邀请机器人加入您的服务器:
- 阅读消息/查看频道
- 发送消息
- 阅读消息历史记录
设置
- 克隆此存储库:
Copy
- 安装依赖项:
Copy
- 使用您的 Discord 机器人令牌在根目录中创建一个
.env
文件:
Copy
- 构建服务器:
Copy
与 Claude 桌面版一起使用
- 打开您的 Claude for Desktop 配置文件:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
- 添加 Discord MCP 服务器配置:
Copy
- 重启 Claude 桌面版
可用工具
发送消息
向指定的 Discord 频道发送消息。
参数:
server
(可选):服务器名称或 ID(如果机器人位于多个服务器中则为必需)channel
:频道名称(例如“general”)或 IDmessage
:要发送的消息内容
例子:
Copy
阅读消息
从指定的 Discord 频道读取最新消息。
参数:
server
(可选):服务器名称或 ID(如果机器人位于多个服务器中则为必需)channel
:频道名称(例如“general”)或 IDlimit
(可选):要获取的消息数量(默认值:50,最大值:100)
例子:
Copy
发展
- 安装开发依赖项:
Copy
- 以开发模式启动服务器:
Copy
测试
您可以使用 MCP 检查器测试服务器:
Copy
示例
设置 Discord MCP 服务器后,您可以尝试与 Claude 进行以下一些示例交互:
- “您能读取普通频道的最后5条消息吗?”
- “请向公告频道发送一条消息,说明‘会议将在 10 分钟后开始’”
- “开发频道中关于最新版本的最新消息是什么?”
克劳德将使用适当的工具与 Discord 进行交互,同时在发送任何消息之前征求您的批准。
安全注意事项
- 该机器人需要适当的 Discord 权限才能运行
- 所有消息发送操作均需要用户明确批准
- 环境变量应得到妥善保护
- 令牌永远不应该提交到版本控制
- 频道访问仅限于机器人被授予访问权限的频道
贡献
- 分叉存储库
- 创建你的功能分支(
git checkout -b feature/amazing-feature
) - 提交您的更改(
git commit -m 'Add some amazing feature'
) - 推送到分支(
git push origin feature/amazing-feature
) - 打开拉取请求
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。
支持
如果您遇到任何问题或有疑问:
- 查看 GitHub 问题部分
- 请参阅https://modelcontextprotocol.io上的 MCP 文档
- 开启新问题并附上详细的复现步骤
This server cannot be installed
通过 Discord 的 API 发送和读取消息,使 LLM 能够与 Discord 频道进行交互,重点是维护用户控制和安全。
- Features
- Prerequisites
- Setup
- Usage with Claude for Desktop
- Available Tools
- Development
- Testing
- Examples
- Security Considerations
- Contributing
- License
- Support