Skip to main content
Glama
fmarcac

discord-mcp

by fmarcac

discord-mcp

通过你自己正在运行的桌面客户端读取 Discord 并执行操作:频道消息、私信、群聊、帖子、论坛帖与搜索。

工作原理

Discord 的桌面应用基于 Electron。以 --remote-debugging-port 启动后,其渲染进程即可通过 Chrome DevTools Protocol 访问。discord-mcp 附加到该渲染进程,观察客户端在自身 API 调用中已经发送的请求头,并从同一页面内部发出请求。

因此,每个请求都来自真实的客户端进程、真实的会话、真实的指纹。没有第二个客户端可供检测,令牌也绝不会从 Discord 的存储中被读出:它只会在客户端原本就要发出的请求中被观察到。

Related MCP server: discord-user-mcp

使用前须知

这违反了 Discord 的服务条款。 无论会话是如何获得的,自动化用户账户均被禁止;第 11 条还单独禁止修改客户端。

实际风险与 Vencord 等客户端模组处于同一等级。Discord 已公开表示降低对此类模组的处置优先级,截至 2026 年也没有已确认的封禁记录。这是一种不执行的模式,而非承诺。风险集中在写入操作,而非读取操作。

机器人令牌完全合规,但机器人永远无法读取你的私信。这一局限正是本项目存在的全部原因。

设置

npm install
npm run build

Discord 持有单实例锁,因此调试标志只在启动时生效。请先退出任何正在运行的客户端。

node dist/cli/main.js launch      # starts Discord on a random loopback port
node dist/cli/main.js doctor      # verifies attach, capture and a real read

doctor 应打印出你的账户、公会数量和私信数量。

首次附加会重新加载一次渲染进程,因为空闲的客户端不会发出任何 REST 请求可供观察请求头。捕获的请求头随后按端口保存在 ~/.local/state/discord-mcp/headers.json 中,持续十二小时,因此之后的运行只需约一秒钟即可完成附加,并且不会打扰你的客户端。

接入 MCP 客户端

{
  "mcpServers": {
    "discord": {
      "command": "node",
      "args": ["/path/to/discord-mcp/dist/cli/main.js", "serve"]
    }
  }
}

工具

默认暴露十八个工具:十二个读取、六个写入。

工具

类型

用途

guild_list

读取

该账户所属的公会

guild_channels

读取

某个公会的频道

guild_roles

读取

公会中定义的角色

channel_get

读取

描述某个频道或帖子

channel_history

读取

一页消息,可向两个方向翻页

channel_pins

读取

置顶消息

message_get

读取

按 id 获取一条消息

dm_list

读取

私聊与群聊会话

thread_list

读取

某个频道的公开帖子,也是读取论坛帖的途径

thread_archived

读取

已归档的帖子,冷清论坛帖的归宿

search_guild

读取

搜索某个公会

search_channel

读取

搜索某个频道或会话

message_send

写入

发送消息或回复

message_edit

写入

编辑本账户发送的消息

message_react

写入

添加回应

message_ack

写入

将频道标记为已读,直到某条消息

thread_create

写入

开启一个帖子,可选地从现有消息发起

forum_post

写入

创建一个论坛帖及其开篇消息

读取论坛通过列出论坛频道的帖子来实现。每个帖子都会连同其开篇消息及已应用的标签一并返回,因此无需第二次调用即可读取一个帖子。

破坏性工具

另有七个操作存在,但在对应类别被启用前完全不会被注册。它们不会出现在工具列表中,因此任何宿主和任何模型都无法触达它们。

工具

类别

message_delete

messages

thread_delete

threads

channel_delete

channels

guild_leave

guilds

member_kick, member_ban

members

member_roles

roles

只启用你需要的:

{ "destructive": ["messages", "threads"] }
node dist/cli/main.js serve --config /path/to/policy.json

这才是起决定性作用的控制开关。宿主审批提示只是第二层防线,因为宿主行为各不相同,有些宿主会自动批准。每个破坏性工具都会解析并返回其作用的对象,因此结果会给出频道名称,而不只是回显一条雪花 ID。

安全性

开放的 DevTools 端口相当于本地认证绕过:任何以你的身份运行的进程都能操控会话,两步验证也不例外。discord-mcp 仅绑定到回环地址,并选择随机高位端口,而非默认的 9222。不要在不使用时让客户端带着开放端口继续运行。

请求头缓存持有有效令牌。 复用捕获结果就意味着要继续保留它,因此 ~/.local/state/discord-mcp/headers.json 中会一直包含你的 Authorization 请求头,直到其过期。该文件以仅所有者权限写入,模式为 0600,其旁的启动状态文件也是如此。删除该文件即可强制重新捕获:

rm ~/.local/state/discord-mcp/headers.json

如果你更愿意每次都重新捕获、绝不存储令牌,可以不带缓存路径运行,代价是每次附加都会重新加载一次渲染进程。

项目结构

src/attach/     CDP connection, target selection, launch, state
src/bridge/     header capture, request execution, rate limiting
src/api/        typed wrappers over Discord REST v9
src/normalize/  reduce Discord's wire format to what a reader needs
src/policy/     operation tiers and the destructive gate
src/tools/      MCP tool registration
src/cli/        launch, doctor, serve

依赖只允许向下流动。normalize/policy/ 是纯净模块,不依赖任何其他内容,测试套件的大部分也都在这里。

npm test         # 152 tests, no Discord required
npm run typecheck

设计文档(包括影响了桥接层设计的 Spike 0 调查发现)位于 docs/superpowers/specs/

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

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables interaction with Discord using personal user tokens instead of bot applications, allowing for seamless message management and server exploration. It provides tools for reading history, sending messages, and searching across channels and DMs directly through MCP-compatible clients.
    6
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables interaction with Discord through natural language, including reading and sending messages, managing servers, and user actions.

View all related MCP servers

Related MCP Connectors

  • Browser MCP for logged-in tasks. Uses your Chrome — credentials stay local. Zero-token replay.

  • Eyes and hands on real Windows PCs — observe, click, type via Glasswarp API.

  • Let ChatGPT, Claude & Cursor use your Mac: email, calendar, iMessage, Teams, files. Local, free.

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/fmarcac/discord-mcp'

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