Discord MCP
Connects AI agents to Discord using a bot token, enabling message search and history reading, sending and managing messages, DMs, files, embeds, reactions, and pins, plus server management for channels, threads, members, roles, invites, events, emoji, stickers, webhooks, moderation actions, and connection diagnostics.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Discord MCPsummarize the last 20 messages in #general"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.

Connect your agent to Discord
Discord MCP connects your agent to Discord through the Model Context Protocol (MCP). Search discussions and post messages with your bot’s permissions. Use your bot token with the hosted server, or run it yourself.
Install · Client setup · Tools · Contribute
Install
Paste this prompt into your agent to configure its MCP connection:
Install Discord MCP for this agent using the instructions at
https://github.com/purduehackers/discord-mcp.
Use the hosted Streamable HTTP server at
https://discord.purduehackers.com/mcp with X-Discord-Token
set from my DISCORD_BOT_TOKEN environment variable.
Configure this client's user-level MCP settings and preserve existing servers.
If the token is missing, help me create a Discord bot and set it locally;
do not ask me to paste the token into chat or commit it to a repository.
Reconnect, call diagnose_connection, and show which bot and servers I can use.
Do not send messages or change Discord during setup.Get a bot token
Create a Discord application. Open Bot and copy its token.
Install the bot in your server with the permissions you need.
Enable Message Content Intent to search and read message content.
Set the token where you launch your agent:
export DISCORD_BOT_TOKEN='your_discord_bot_token_here'For the full setup walkthrough, follow Discord’s bot setup guide.
Related MCP server: DiscordMCP
Client setup
Choose your client below. The hosted server uses Streamable HTTP, the MCP transport for remote servers. Send your raw bot token in the X-Discord-Token header, without a Bot prefix.
Use this endpoint:
https://discord.purduehackers.com/mcpRegister the endpoint:
codex mcp add discord --url https://discord.purduehackers.com/mcpIn ~/.codex/config.toml, add env_http_headers to the generated entry:
[mcp_servers.discord]
url = "https://discord.purduehackers.com/mcp"
env_http_headers = { "X-Discord-Token" = "DISCORD_BOT_TOKEN" }If the desktop app can’t access that environment variable, replace env_http_headers with:
http_headers = { "X-Discord-Token" = "your_discord_bot_token_here" }Keep that value in your private user configuration. For credential helpers and other options, see the Codex MCP documentation.
Run codex mcp get discord to inspect the configuration. Then restart the MCP connection or start a new Codex session.
Register the server in your user configuration:
claude mcp add --scope user --transport http discord \
https://discord.purduehackers.com/mcp \
--header 'X-Discord-Token: ${DISCORD_BOT_TOKEN}'
claude mcp listKeep the single quotes: Claude resolves the environment variable when connecting. Open /mcp in Claude Code to inspect the connection. Claude Code MCP documentation.
Pi 1.x includes native MCP support. Register the server in your user configuration:
pi mcp add discord --url https://discord.purduehackers.com/mcp \
--header 'X-Discord-Token=${DISCORD_BOT_TOKEN}'
pi mcp listThis writes to ~/.pi/agent/mcp.json. Run /reload in an existing session, then /mcp to inspect the connection. Pi MCP documentation.
Add this server to ~/.cursor/mcp.json:
{
"mcpServers": {
"discord": {
"url": "https://discord.purduehackers.com/mcp",
"headers": {
"X-Discord-Token": "${env:DISCORD_BOT_TOKEN}"
}
}
}
}Enable the server in Cursor’s MCP settings. Cursor MCP documentation.
Install into the VS Code user-profile configuration from your terminal:
code --add-mcp '{
"name": "discord",
"type": "http",
"url": "https://discord.purduehackers.com/mcp",
"headers": {"X-Discord-Token": "${env:DISCORD_BOT_TOKEN}"}
}'Use MCP: List Servers to start the server and inspect its tools. For the Copilot command-line interface (CLI), add this to ~/.copilot/mcp-config.json:
{
"mcpServers": {
"discord": {
"type": "http",
"url": "https://discord.purduehackers.com/mcp",
"headers": {
"X-Discord-Token": "${DISCORD_BOT_TOKEN}"
}
}
}
}Register the server in your user configuration:
gemini mcp add --scope user --transport http discord \
https://discord.purduehackers.com/mcp \
--header 'X-Discord-Token: ${DISCORD_BOT_TOKEN}'
gemini mcp listOpen /mcp in Gemini CLI to inspect the connection. Gemini CLI MCP documentation.
Add this server to ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"discord": {
"type": "remote",
"url": "https://discord.purduehackers.com/mcp",
"oauth": false,
"headers": {
"X-Discord-Token": "{env:DISCORD_BOT_TOKEN}"
}
}
}
}Run opencode mcp list to inspect the connection. OpenCode MCP documentation.
Other clients can connect if they support Streamable HTTP with custom headers. Desktop apps must receive DISCORD_BOT_TOKEN in their own environment. Exporting it in a terminal won’t update an app that’s already running.
Try it
Ask your agent to check its connection, then try a request using your server’s channels and topics:
Check my Discord connection and show the servers I can access.
Find the Mac face unlock app in #ship and link the original post.
Summarize the latest updates in #projects.
Send me the project and source code links in a direct message.
The agent discovers server, channel, and member IDs through the tools. You choose the server; there’s no shared or default server.
Discord tools
Use the tools below to read conversations, send messages, and manage servers your bot can access.
Capabilities | |
Find context | Indexed message search, channel history, individual messages, and audit logs. |
Communicate | Messages, replies, direct messages, native forwards, files, embeds, reactions, and pins. Long messages preserve code fences across chunks. |
Manage a server | Channels, threads, members, roles, invites, events, emoji, stickers, and webhooks. |
Moderate | Timeouts, kicks, bans, message cleanup, and auto-moderation rules. |
Troubleshoot | Connection diagnostics, channel permissions, role hierarchy guidance, and actionable Discord errors. |
All 78 tools have typed inputs and outputs. Codex displays activity labels; Claude uses tool search hints. Browse the tool implementations for the full set.
Discord enforces your bot’s permissions. Connecting doesn’t grant access to anyone else’s servers.
Search uses Discord’s index. It requires Read Message History and Message Content Intent, and returns one page per call. Totals can change; a short page doesn’t prove completion. Indexing errors include
retry_afterin seconds.Mentions stay disabled unless you select them. Long sends stop on failure and report confirmed message IDs. Check uncertain delivery before resuming with the original content and
start_chunk_index.The hosted service receives your token over HTTPS and uses it for Discord requests. The application doesn’t persist credentials.
For a Discord OAuth access token, add
X-Discord-Auth-Prefix: Bearer. Available tools depend on its scopes. This service doesn’t provide an MCP OAuth login flow.
Run diagnose_connection first. Include guild_id and channel_id to inspect a specific server or channel.
Problem | Fix |
Missing token | Send |
Discord returns 401 | Use a valid raw bot token and the correct Bot or Bearer auth prefix. |
Missing access or permissions | Check bot membership, channel overwrites, and role hierarchy. |
Empty message content | Enable the application’s Message Content Intent. |
Tools missing after an update | Restart the MCP connection so the client refreshes its tool list. |
Self-host
Run your own server with Bun, xmcp, and @discordjs/rest. Clone the repository, install dependencies, and start the HTTP server:
git clone https://github.com/purduehackers/discord-mcp.git
cd discord-mcp
bun install
bun run build
bun run start-httpThe HTTP server accepts the same headers as the hosted service. For a local standard input/output (stdio) connection, set DISCORD_BOT_TOKEN and run bun run start-stdio. Use bun run dev for development. Vercel deploys xmcp’s native output.
Contributing
Report bugs through issues, or open a pull request with a fix. Each file in src/tools/ defines one tool; shared schemas live in src/lib/schemas/.
The Remotion demo has its own dependencies. Install them before running the full checks:
bun install --cwd demo
bun run --cwd demo lint
bun run typecheck
bun run lint
bun run format --check
bun run buildMIT licensed. Made by Purdue Hackers.
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect a Discord bot (bot token from the developer portal) to read/send messages, list guilds and c
Control your Discord community: send/read messages, manage channels and forums, and handle webhook…
Build Discord communities with AI: roles, channels, modules, automations and reviewed announcements.
Run Discord forms, surveys, polls and quizzes from your AI app: build, launch and analyze projects.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with Discord through the REST API and real-time events, supporting message management, user info, channel operations, and more with security controls.4 npm1MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to interact with a Discord account to read channels, send and manage messages, handle DMs and reactions, search messages, and update status.133 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables 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.866 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to interact with the Discord platform by managing servers, channels, roles, forum posts, messages, reactions, and webhooks through a Discord bot.866 npmMIT