# Discord — how to use (mcp.ai)

Conecte um bot Discord (token de bot do developer portal) para ler/enviar mensagens, listar servidores e canais, reagir, mandar DMs e gerenciar mensagens via a API REST oficial (discord.com/api/v10). Guild ID opcional define o servidor padrão usado por tools como list_channels e list_guild_members.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_discord?ms=1781045340000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `discord_add_reaction`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/discord`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/discord/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/discord/add/reaction` — Add a reaction to a message. `emoji` is either unicode (e.g. `👍`) or `name:id` for custom guild emoji.
  - body: { channel_id: string, message_id: string, emoji: string, account?: string, channel_ids?: string[], message_ids?: string[] }
- `POST https://api.mcp.ai/api/discord/delete/message` — Delete a message. Irreversible. Bot needs Manage Messages to delete messages authored by other users.
  - body: { channel_id: string, message_id: string, account?: string, channel_ids?: string[], message_ids?: string[] }
- `POST https://api.mcp.ai/api/discord/edit/message` — Edit a previously-sent message (must be authored by this bot).
  - body: { channel_id: string, message_id: string, content?: string, embeds?: string[], account?: string, channel_ids?: string[], message_ids?: string[] }
- `POST https://api.mcp.ai/api/discord/get/channel` — Get a channel's metadata (type, name, topic, parent, permissions).
  - body: { channel_id: string, account?: string, channel_ids?: string[] }
- `POST https://api.mcp.ai/api/discord/get/guild` — Get one guild's metadata. Falls back to the connection's default guild_id.
  - body: { guild_id?: string, account?: string, guild_ids?: string[] }
- `POST https://api.mcp.ai/api/discord/get/me` — Return the bot's own user profile (id, username, discriminator, avatar, etc).
  - body: { account?: string }
- `POST https://api.mcp.ai/api/discord/get/message` — Fetch a single message by id.
  - body: { channel_id: string, message_id: string, account?: string, channel_ids?: string[], message_ids?: string[] }
- `POST https://api.mcp.ai/api/discord/get/user` — Public profile of any Discord user by id.
  - body: { user_id: string, account?: string, user_ids?: string[] }
- `POST https://api.mcp.ai/api/discord/list/accounts` — List Discord bot connections linked to this install — id, label, default guild_id.
  - body: { account?: string }
- `POST https://api.mcp.ai/api/discord/list/channels` — List channels in a guild. Falls back to the connection's default guild_id.
  - body: { guild_id?: string, account?: string, guild_ids?: string[] }
- `POST https://api.mcp.ai/api/discord/list/guild/members` — List members of a guild. Requires the bot to have the Server Members intent enabled in the developer portal — may return 403 otherwise.
  - body: { guild_id?: string, limit?: integer, after?: string, account?: string, guild_ids?: string[] }
- `POST https://api.mcp.ai/api/discord/list/guilds` — List the servers (guilds) the bot is a member of.
  - body: { limit?: integer, before?: string, after?: string, account?: string }
- `POST https://api.mcp.ai/api/discord/list/messages` — Read recent messages from a channel (newest first). Pagination via `before` / `after` / `around` (message ids). Requires Message Content intent for non-bot message bodies in some cases.
  - body: { channel_id: string, limit?: integer, before?: string, after?: string, around?: string, account?: string, channel_ids?: string[] }
- `POST https://api.mcp.ai/api/discord/send/dm` — Open a DM channel with a user and send them a message. The bot and the user must share a guild.
  - body: { user_id: string, content?: string, embeds?: string[], account?: string, user_ids?: string[] }
- `POST https://api.mcp.ai/api/discord/send/message` — Post a message to a channel. Provide `content` (text up to 2000 chars), `embeds` (rich JSON), or both. `reply_to` makes it a reply.
  - body: { channel_id: string, content?: string, embeds?: string[], reply_to?: string, account?: string, channel_ids?: string[] }

## Example prompts
- "Mostre as últimas 20 mensagens do canal #geral"
- "Envie no canal de avisos: 'Reunião às 15h hoje'"
- "Liste todos os canais do servidor"

## More
- Page: https://mcp.ai/discord
- Agent spec (llms.txt): https://mcp.ai/discord/llms.txt
- Postman collection: https://mcp.ai/discord/postman.json
