Skip to main content
Glama
v-3

Discord MCP Server

by v-3

Discord MCP 服务器

一个模型上下文协议 (MCP) 服务器,使 LLM 能够与 Discord 频道交互,允许他们通过 Discord 的 API 发送和读取消息。使用此服务器,像 Claude 这样的 LLM 可以直接与 Discord 频道交互,同时保持用户的控制权和安全性。

特征

  • 向 Discord 频道发送消息

  • 阅读频道中的最新消息

  • 自动服务器和频道发现

  • 支持频道名称和 ID

  • 正确的错误处理和验证

Related MCP server: Discord MCP Server

先决条件

  • Node.js 16.x 或更高版本

  • Discord 机器人令牌

  • 必须以适当的权限邀请机器人加入您的服务器:

    • 阅读消息/查看频道

    • 发送消息

    • 阅读消息历史记录

设置

  1. 克隆此存储库:

git clone https://github.com/yourusername/discordmcp.git
cd discordmcp
  1. 安装依赖项:

npm install
  1. 使用您的 Discord 机器人令牌在根目录中创建一个.env文件:

DISCORD_TOKEN=your_discord_bot_token_here
  1. 构建服务器:

npm run build

与 Claude 桌面版一起使用

  1. 打开您的 Claude for Desktop 配置文件:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

    • Windows: %APPDATA%\Claude\claude_desktop_config.json

  2. 添加 Discord MCP 服务器配置:

{
  "mcpServers": {
    "discord": {
      "command": "node",
      "args": ["path/to/discordmcp/build/index.js"],
      "env": {
        "DISCORD_TOKEN": "your_discord_bot_token_here"
      }
    }
  }
}
  1. 重启 Claude 桌面版

可用工具

发送消息

向指定的 Discord 频道发送消息。

参数:

  • server (可选):服务器名称或 ID(如果机器人位于多个服务器中则为必需)

  • channel :频道名称(例如“general”)或 ID

  • message :要发送的消息内容

例子:

{
  "channel": "general",
  "message": "Hello from MCP!"
}

阅读消息

从指定的 Discord 频道读取最新消息。

参数:

  • server (可选):服务器名称或 ID(如果机器人位于多个服务器中则为必需)

  • channel :频道名称(例如“general”)或 ID

  • limit (可选):要获取的消息数量(默认值:50,最大值:100)

例子:

{
  "channel": "general",
  "limit": 10
}

发展

  1. 安装开发依赖项:

npm install --save-dev typescript @types/node
  1. 以开发模式启动服务器:

npm run dev

测试

您可以使用 MCP 检查器测试服务器:

npx @modelcontextprotocol/inspector node build/index.js

示例

设置 Discord MCP 服务器后,您可以尝试与 Claude 进行以下一些示例交互:

  1. “您能读取普通频道的最后5条消息吗?”

  2. “请向公告频道发送一条消息,说明‘会议将在 10 分钟后开始’”

  3. “开发频道中关于最新版本的最新消息是什么?”

克劳德将使用适当的工具与 Discord 进行交互,同时在发送任何消息之前征求您的批准。

安全注意事项

  • 该机器人需要适当的 Discord 权限才能运行

  • 所有消息发送操作均需要用户明确批准

  • 环境变量应得到妥善保护

  • 令牌永远不应该提交到版本控制

  • 频道访问仅限于机器人被授予访问权限的频道

贡献

  1. 分叉存储库

  2. 创建你的功能分支( git checkout -b feature/amazing-feature

  3. 提交您的更改( git commit -m 'Add some amazing feature'

  4. 推送到分支( git push origin feature/amazing-feature

  5. 打开拉取请求

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

支持

如果您遇到任何问题或有疑问:

  1. 查看 GitHub 问题部分

  2. 请参阅https://modelcontextprotocol.io上的 MCP 文档

  3. 开启新问题并附上详细的复现步骤

A
license - permissive license
Not graded
quality - not tested
F
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity
Issues opened vs closed

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables interaction with Discord through natural language, including reading and sending messages, managing servers, and user actions.
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to interact with Discord through the REST API and real-time events, supporting message management, user info, channel operations, and more with security controls.
    13
    1
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables LLMs to send and read messages in Discord channels, manage servers, channels, and roles via Discord's API.
    16
    2
    MIT

View all related MCP servers

Related MCP Connectors

  • Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.

  • Let your AI agent notify you by email, Slack, Discord, or webhook. One tool: send_notification.

  • Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/v-3/discordmcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server