Skip to main content
Glama
Discord Self MCP

Discord Self MCP

by Maol-1997

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

Related MCP server: discord-user-connector

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

  • authorId (string, optional): Optional: Filter by author ID

  • limit (number, optional): Number of messages to search through (default: 100, max: 500)

  • before (string, optional): Optional: Search messages before this message ID

  • after (string, optional): Optional: Search messages after this message ID

mcp_discord_send_message

Send a message to a specific Discord channel.

Parameters:

  • channelId (string, required): The Discord channel ID to send the message to

  • content (string, required): The message content to send

  • replyToMessageId (string, optional): Optional: Message ID to reply to

šŸ° Guild and Channel Management

mcp_discord_list_channels

List all accessible channels for the current user.

Parameters:

  • guildId (string, optional): Optional: Filter channels by guild ID

mcp_discord_list_guilds

List all guilds (servers) the user is in.

Parameters:

  • None required

šŸ‘„ User Management

mcp_discord_get_user_info

Get information about the logged-in user.

Parameters:

  • None required

mcp_discord_list_guild_members

List members of a specific Discord guild/server.

Parameters:

  • guildId (string, required): The Discord guild ID to list members from

  • limit (number, optional): Number of members to fetch (default: 100, max: 1000)

  • includeRoles (boolean, optional): Whether to include role information for each member

Usage Examples in Claude

Once configured, you can use commands like:

Server Management

- "List my Discord servers"
- "Show all channels from server [ID]"
- "How many members does server [ID] have?"

Message Reading

- "Read the last 20 messages from channel [ID]"
- "Search for messages containing 'meeting' in channel [ID]"
- "Show messages from user [ID] in channel [ID]"

Interaction

- "Send a message to channel [ID] saying 'Hello world'"
- "Reply to message [ID] with 'Thanks for the information'"

User Information

- "Show my Discord information"
- "List members of server [ID] with their roles"

Features

  • āœ… Message reading with advanced filters

  • āœ… Message searching by content, author, and date

  • āœ… Message sending with reply support

  • āœ… Server management and channel listing

  • āœ… User information and member management

  • āœ… Robust error handling

  • āœ… Complete parameter validation

  • āœ… Relative time formatting (e.g., "2 hours ago")

  • āœ… Support for attachments and embeds

Project Structure

src/
ā”œā”€ā”€ index.ts              # Main MCP server
ā”œā”€ā”€ types.ts              # TypeScript type definitions
ā”œā”€ā”€ tool-definitions.ts   # MCP tool schemas
ā”œā”€ā”€ message-handlers.ts   # Message handling functions
ā”œā”€ā”€ guild-handlers.ts     # Guild/server handling functions
ā”œā”€ā”€ user-handlers.ts      # User handling functions
└── utils.ts             # Common utilities

Warning

This project uses selfbot, which goes against Discord's terms of service. Use it at your own risk and only for educational or personal purposes.

Contributing

Contributions are welcome! Please:

  1. Fork the project

  2. Create a feature branch (git checkout -b feature/new-functionality)

  3. Commit your changes (git commit -am 'feat: add new functionality')

  4. Push to the branch (git push origin feature/new-functionality)

  5. Open a Pull Request

Available Tools

7 tools
get_user_infoB

Get information about the logged-in user

Inputs: no named parameters.

list_channelsB

List all accessible channels for the current user

Inputs: guildId.

list_guild_membersC

List members of a specific Discord guild/server

Inputs: guildId (required), limit, includeRoles.

list_guildsA

List all guilds (servers) the user is in

Inputs: no named parameters.

read_channelC

Read messages from a Discord channel

Inputs: channelId (required), limit.

search_messagesB

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

Inputs: channelId (required), after, limit, query, +2 more.

send_messageC

Send a message to a specific Discord channel

Inputs: content (required), channelId (required), replyToMessageId.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool has a clearly distinct resource+action target: listing (guilds, channels, members), reading (read_channel), searching, sending, and user info. read_channel and search_messages both return messages, but the descriptions make the filtering role of search_messages explicit, so misselection risk is low.

    Naming Consistency5/5

    All seven tools follow a consistent snake_case verb_noun pattern (list_guilds, list_channels, list_guild_members, send_message, read_channel, get_user_info, search_messages). No camelCase or vague-verb outliers.

    Tool Count5/5

    Seven tools is well within the 3-15 sweet spot and matches the modest scope of a personal Discord client. Every tool maps to a distinct operation with no filler.

    Completeness3/5

    The surface covers browsing and sending, but there is no edit_message or delete_message, so a sent message can never be corrected or removed, and no direct-message capability despite being a self-user client. Fetching a single message by ID or listing DM channels are also notable gaps.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      F
      maintenance
      Enables LLMs to read and send Discord messages, list servers and channels, and monitor unread messages via a selfbot that uses a user token (violates Discord ToS).
      8
      25 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to access and interact with a Discord user account via the Discord client API, allowing them to read servers, channels, DMs, mentions, and message history, and optionally send messages and perform other actions.
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to interact with a Discord account to read channels, send and manage messages, handle DMs and reactions, search messages, and update status.
      1
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to interact with the Discord platform, including servers, members, roles, channels, categories, forum posts, messages, reactions, and webhooks. It supports logging in a bot, reading and searching messages, and creating, editing, or deleting Discord resources through natural language.
      1,560 npm
      MIT