M1

maol-1997/discord-self-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

11 stars 3 forks 质量 64 趋势 18MIT

An MCP (Model Context Protocol) server that allows AIs to access Discord using selfbot to read messages, manage channels, get user information, and more.

概览

An MCP (Model Context Protocol) server that allows AIs to access Discord using selfbot to read messages, manage channels, get user information, and more. You don't need to install anything. Simply configure your MCP client with: The Discord token is passed as an environment variable from your MCP client. use local .env files. 1. Open Discord in your browser 2. Press F12 to open developer tools 3. Go to the "Console" tab 4. Paste the following code and press Enter: 5. Your token will be automatically copied to the clipboard 1. Open Discord in your browser 2. Press F12 to open developer tools 3. Go to the "Network" tab 4. Look for any request to Discord's API 5. In the headers, look for "Authorization" - channelId (string, required): The Discord channel ID to read messages from - limit (number, optional): Number of messages to fetch (default: 50, max: 100) Search for messages in a Discord channel by content, author, or date range.

README

以下为原文 README 节选,完整内容请查看原文。

Discord Self MCP

An MCP (Model Context Protocol) server that allows AIs to access Discord using selfbot to read messages, manage channels, get user information, and more.

Installation and Usage

Option 1: Direct use with npx (no installation)

You don’t need to install anything. Simply configure your MCP client with:

{
  "mcpServers": {
    "discord": {
      "command": "npx",
      "args": ["-y", "discord-self-mcp"],
      "env": {
        "DISCORD_TOKEN": "your_discord_token_here"
      }
    }
  }
}

Option 2: Global installation

npm install -g discord-self-mcp

Then configure your MCP client:

{
  "mcpServers": {
    "discord": {
      "command": "discord-self-mcp",
      "env": {
        "DISCORD_TOKEN": "your_discord_token_here"
      }
    }
  }
}

Option 3: Local development

# Clone the repository
git clone [repo-url]
cd discord-self-mcp

# Install dependencies
npm install

# Build the project
npm run build

# Configure in your MCP client with the local path

Discord Token Configuration

The Discord token is passed as an environment variable from your MCP client. DO NOT use local .env files.

How to get your Discord token:

  1. Open Discord in your browser
  2. Press F12 to open developer tools
  3. Go to the “Console” tab
  4. Paste the following code and press Enter:
window.webpackChunkdiscord_app.push([
  [Symbol()],
  {},
  (req) => {
    if (!req.c) return
    for (let m of Object.values(req.c)) {
      try {
        if (!m.exports || m.exports === window) continue
        if (m.exports?.getToken) return copy(m.exports.getToken())
        for (let ex in m.exports) {
          if (
            m.exports?.[ex]?.getToken &&
            m.exports[ex][Symbol.toStringTag] !== 'IntlMessagesProxy'
          )
            return copy(m.exports[ex].getToken())
        }
      } catch {}
    }
  },
])

window.webpackChunkdiscord_app.pop()
console.log('%cWorked!', 'font-size: 50px')
console.log(`%cYou now have your token in the clipboard!`, 'font-size: 16px')
  1. Your token will be automatically copied to the clipboard

Method 2: Manual Network Inspection

  1. Open Discord in your browser
  2. Press F12 to open developer tools
  3. Go to the “Network” tab
  4. Look for any request to Discord’s API
  5. In the headers, look for “Authorization”

Available Tools

📧 Message Management

mcp_discord_read_channel

Read messages from a Discord channel.

Parameters:

  • channelId (string, required): The Discord channel ID to read messages from
  • limit (number, optional): Number of messages to fetch (default: 50, max: 100)

mcp_discord_search_messages

Search for messages in a Discord channel by content, author, or date range.

Parameters:

  • channelId (string, required): The Discord channel ID to search messages in
  • query (string, optional): Text to search for in message content
在 GitHub 查看完整 README

安装

npx -y discord-self-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "discord": { "command": "npx", "args": ["-y", "discord-self-mcp"], "env": { "DISCORD_TOKEN": "your_discord_token_here" } } } }