TypeScriptADK-TS

MCP Discord

Enable AI agents to read and send messages in Discord channels via a bot integration.

Overview

The Discord MCP server lets your agent interact with Discord — reading messages from channels, sending responses, and monitoring server activity. It is useful for building agents that moderate communities, answer questions, or summarize discussions on Discord.

Bot Token Security

Your Discord bot token grants full access to your bot account. Never expose it in client-side code or commit it to source control.

Getting Started

Install the package:

pnpm add @iqai/mcp-discord

Use the server in your agent:

import { McpDiscord } from "@iqai/adk";

const toolset = McpDiscord({
  env: {
    DISCORD_TOKEN: process.env.DISCORD_TOKEN,
  },
});

const tools = await toolset.getTools();
import { McpToolset } from "@iqai/adk";

const toolset = new McpToolset({
  name: "Discord MCP Client",
  description: "Client for Discord bot interactions",
  transport: {
    mode: "stdio",
    command: "npx",
    args: ["-y", "@iqai/mcp-discord"],
    env: {
      DISCORD_TOKEN: process.env.DISCORD_TOKEN,
      PATH: process.env.PATH || "",
    },
  },
});

const tools = await toolset.getTools();
{
  "mcpServers": {
    "discord-mcp-server": {
      "command": "npx",
      "args": ["-y", "@iqai/mcp-discord"],
      "env": {
        "DISCORD_TOKEN": "your_discord_bot_token"
      }
    }
  }
}

Environment Variables

VariableRequiredDescription
DISCORD_TOKENYesYour Discord bot token

Credentials

To create a Discord bot and get your token:

  1. Go to the Discord Developer Portal
  2. Click New Application, name it, and go to the Bot tab
  3. Click Reset Token and copy your bot token
  4. Under OAuth2 → URL Generator, select the bot scope and the permissions your agent needs
  5. Use the generated URL to invite the bot to your server

Available Tools

discord_create_category
guildId:stringname:stringposition:numberreason:string

Description

Creates a new category in a Discord server.

discord_edit_category
categoryId:stringname:stringposition:numberreason:string

Description

Edits an existing Discord category (name and position).

discord_delete_category
categoryId:stringreason:string

Description

Deletes a Discord category by ID.

discord_login
token:string

Description

Logs in to Discord using the configured token

discord_send
channelId:stringmessage:string

Description

Sends a message to a specified Discord text channel

discord_get_forum_channels
guildId:string

Description

Lists all forum channels in a specified Discord server (guild)

discord_create_forum_post
forumChannelId:stringtitle:stringcontent:stringtags:array

Description

Creates a new post in a Discord forum channel with optional tags

discord_get_forum_post
threadId:string

Description

Retrieves details about a forum post including its messages

discord_reply_to_forum
threadId:stringmessage:string

Description

Adds a reply to an existing forum post or thread

discord_create_text_channel
guildId:stringchannelName:stringtopic:string

Description

Creates a new text channel in a Discord server with an optional topic

discord_delete_channel
channelId:stringreason:string

Description

Deletes a Discord channel with an optional reason

discord_read_messages
channelId:stringlimit:number

Description

Retrieves messages from a Discord text channel with a configurable limit

discord_get_server_info
guildId:string

Description

Retrieves detailed information about a Discord server including channels and member count

discord_add_reaction
channelId:stringmessageId:stringemoji:string

Description

Adds an emoji reaction to a specific Discord message

discord_add_multiple_reactions
channelId:stringmessageId:stringemojis:array

Description

Adds multiple emoji reactions to a Discord message at once

discord_remove_reaction
channelId:stringmessageId:stringemoji:stringuserId:string

Description

Removes a specific emoji reaction from a Discord message

discord_delete_forum_post
threadId:stringreason:string

Description

Deletes a forum post or thread with an optional reason

discord_delete_message
channelId:stringmessageId:stringreason:string

Description

Deletes a specific message from a Discord text channel

discord_create_webhook
channelId:stringname:stringavatar:stringreason:string

Description

Creates a new webhook for a Discord channel

discord_send_webhook_message
webhookId:stringwebhookToken:stringcontent:stringusername:stringavatarURL:stringthreadId:string

Description

Sends a message to a Discord channel using a webhook

discord_edit_webhook
webhookId:stringwebhookToken:stringname:stringavatar:stringchannelId:stringreason:string

Description

Edits an existing webhook for a Discord channel

discord_delete_webhook
webhookId:stringwebhookToken:stringreason:string

Description

Deletes an existing webhook for a Discord channel

Integration Example

import { AgentBuilder, McpDiscord } from "@iqai/adk";
import * as dotenv from "dotenv";

dotenv.config();

async function main() {
  // Initialize McpDiscord toolset
  const toolset = McpDiscord({
    env: {
      DISCORD_TOKEN: process.env.DISCORD_TOKEN,
    },
  });

  // Get available McpDiscord tools
  const discordTools = await toolset.getTools();

  // Create agent with McpDiscord tools
  const { runner } = await AgentBuilder.create("discord_agent")
    .withModel("gemini-2.5-flash")
    .withDescription(
      "A Discord community agent that summarizes and responds to messages",
    )
    .withTools(...discordTools)
    .build();

  const response = await runner.ask(
    "Read the last 20 messages in channel 123456789 and summarize what the community is discussing",
  );

  console.log(response);
}

main().catch(console.error);

Further Resources