DiscordMCP
Provides tools for interacting with Discord via a user token, enabling reading channels, sending messages, editing/deleting messages, managing reactions, DMs, server/channel listing, user info, search, and status changes.
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., "@DiscordMCPRead the last 20 messages in channel 123456789"
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.
An MCP server that gives Claude and other AI assistants access to your Discord: read channels, send messages, manage DMs, react, search, and more. Works via a user token (self-bot) powered by discord.js-selfbot-v13.
⚠️ Heads-up. Self-botting violates Discord's ToS. Your account can get banned. Use at your own risk — ideally on a secondary account. Never share your token, it grants full control over the account.
Features
Tool | What it does |
| Show the logged-in account |
| List every guild the account is in |
| Details for a specific guild |
| List text channels in a guild |
| Read the last N messages in a channel |
| Send a message (can reply to another one) |
| Edit a message you sent |
| Delete a message |
| List open DMs and group DMs |
| Open a DM with a user by ID |
| Look up a user by ID |
| Search a channel's recent messages for a substring |
| React to a message |
| Change presence (online/idle/dnd/invisible) |
Related MCP server: Discord MCP Server
Installation
git clone https://github.com/Ernest1101/DiscordMCP.git
cd DiscordMCP
npm install
npm run setupThat's it. The setup wizard will:
Scan your local Discord desktop client for logged-in accounts (Windows).
Show you a menu of accounts (by real username, verified against Discord's API).
Save the chosen token to
DiscordMCP/.env— never sent anywhere.Build the server (
npm run build).Detect installed AI clients (Claude Desktop, Cursor, Claude Code, Continue) and offer to install the MCP config for you.
npm install
npm run buildThen create a .env with your token — see Getting your user token below.
Getting your user token
(If you ran npm run setup above and it detected your account, you can skip this.)
Open Discord in a browser.
F12 → Network tab.
Reload the page and pick any request to
discord.com/api/....Copy the
authorizationheader value — that's your token.
Never publish this token and never share it with anyone.
Configuration
🔒 Do not put your token into the MCP client config. Client configs are often opened during demos/screenshares. Keep the token in a separate file that stays on your machine.
Recommended: .env file in the project folder
Copy .env.example to .env inside the DiscordMCP/ folder and paste your token:
DISCORD_TOKEN=your_token_hereThe server automatically reads this file at startup. .env is git-ignored, so it will never be committed.
Alternative: separate token file (DISCORD_TOKEN_FILE)
If you want to keep the token even further away from the repo — e.g. in %APPDATA%\discord-mcp\token.txt or ~/.config/discord-mcp/token:
Create a plain text file containing just the token (no quotes, no
DISCORD_TOKEN=).Point the server at it via the
DISCORD_TOKEN_FILEenv var in your MCP client config.
That way the config only stores a path, not the token itself.
Claude Desktop setup
Open the Claude Desktop config:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add this under mcpServers — no token in the config:
{
"mcpServers": {
"discord": {
"command": "node",
"args": ["C:\\path\\to\\DiscordMCP\\dist\\index.js"]
}
}
}The server picks up the token from DiscordMCP/.env automatically.
Prefer a separate token file? Point at it via env:
{
"mcpServers": {
"discord": {
"command": "node",
"args": ["C:\\path\\to\\DiscordMCP\\dist\\index.js"],
"env": {
"DISCORD_TOKEN_FILE": "C:\\Users\\you\\AppData\\Roaming\\discord-mcp\\token.txt"
}
}
}
}Restart Claude Desktop — the discord tool set will show up in the tools list.
Claude Code setup
claude mcp add discord -- node C:\path\to\DiscordMCP\dist\index.jsToken is loaded from DiscordMCP/.env or from a path set in DISCORD_TOKEN_FILE — never put it on the command line.
Other MCP clients (Cursor, Cline, etc.)
The server speaks the standard MCP stdio protocol. Any MCP client launches it the same way:
command: node
args: ["dist/index.js"]Token source is picked up in this order:
DiscordMCP/.envfile (recommended)File pointed to by
DISCORD_TOKEN_FILEenv varDISCORD_TOKENenv var (least safe — visible in configs)
Safety Word Filter
DiscordMCP ships with a built-in safety word filter that guards against accidental credential leaks. It works in two directions:
Outbound — before any
send_message/edit_messagehits Discord, the content is scanned. If it looks like a Discord token, an Anthropic/OpenAI/GitHub/AWS/Slack/Stripe key, a JWT, a private-key block, a password assignment (password = ...), or your ownDISCORD_TOKEN, the send is refused and the AI gets aSafetyError.Inbound — every
read_messages/search_messagesresponse is scanned before returning to the AI. Any matches are replaced with[REDACTED:token-type], so someone in a channel cannot trick the AI into forwarding a secret.
Modes
Set via env var SAFETY_MODE:
Mode | Behavior |
| Outbound blocked, inbound redacted |
| Nothing blocked, but every detection is logged |
| Filter fully disabled |
Custom words
Add your own secrets to the filter with SAFETY_CUSTOM_WORDS — comma-separated, minimum 4 chars each:
SAFETY_CUSTOM_WORDS=hunter2,internal-project-atlas,my-personal-note-codeAny occurrence in either direction triggers the filter.
Detection log
Optional SAFETY_LOG_FILE writes a JSONL entry for each detection:
SAFETY_LOG_FILE=C:\Users\you\AppData\Roaming\discord-mcp\safety.logEach line:
{"ts":"2026-09-24T12:34:56.789Z","kind":"block","hits":["anthropic-key","password-assignment"]}kind is block (outbound refused), redact (inbound masked), or warn (mode=warn, nothing changed).
What it catches by default
Discord user/bot/MFA tokens · Anthropic sk-ant-… · OpenAI sk-… · GitHub ghp_/gho_/… · AWS access keys · Slack tokens · Google API keys · Stripe keys · JWTs · PEM private-key blocks · password=… / api_key=… assignments · your own DISCORD_TOKEN.
Development
npm run dev # tsc in watch mode
npm start # run the built serverExample prompts for Claude
"List all my Discord servers"
"Read the last 20 messages from channel 123456789"
"Send 'hello' to channel 123456789"
"Search channel 123456789 for messages mentioning 'deploy'"
"Open a DM with user 987654321 and send them 'test'"
License
MIT
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…
Messaging tools for AI agents: send messages, manage chats, groups and channels.
Carbon Voice MCP serves as a bridge that connects AI assistants like ChatGPT, Claude, and Cursor to a user's Carbon Voice account, turning voice messages and conversations into a private, on-demand knowledge base. It provides 28 specialized tools for comprehensive voice messaging management, including creating and sending messages, accessing conversation history with instant transcription, running AI actions (summarization, TLDR generation, meeting notes), and managing workspace collaboration through folders, contacts, and team communications.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with Discord servers through a bot, supporting channel management, messaging, forum operations, reactions, and webhooks.22736 npmMIT
- 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.15 npm1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Discord servers, including listing servers/channels, sending messages, and managing reaction-based opt-in campaigns.MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to interact with Discord through the REST API, supporting message reading and sending, channel and guild management, threads, pins, and reactions.17MIT