discord-mcp
Enables reading and sending Discord messages, listing servers and channels, fetching DMs, and retrieving unread messages through a selfbot.
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-mcp Check my unread messages from the gaming server"
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.
discord-mcp
Discord selfbot MCP server — read & send Discord messages from Claude Code or OpenClaw.
⚠️ Selfbot Warning: This uses your Discord user token, which violates Discord's ToS. Your account may be banned. Use at your own risk.
What it does
Exposes 6 Discord tools via MCP (Model Context Protocol):
Tool | Description |
| List all servers you're in |
| List text channels in a server |
| Fetch recent messages from a channel |
| List your open DM conversations |
| Send a message (channel or DM) |
| Get messages you haven't seen yet |
A background daemon maintains a persistent WebSocket to the Discord Gateway, ingesting messages into a local SQLite database so discord_get_unread works even while Claude isn't running.
Related MCP server: Discord Analysis MCP
Setup
1. Install & configure
npx @tensakulabs/discord-mcp setupThis will:
Show you how to extract your Discord token from the desktop app
Save it securely to your OS keychain (macOS: uses built-in
securityCLI — no native module required)Start the background daemon via launchd (macOS) or systemd (Linux)
Auto-register the MCP server in Claude's config
2. Token extraction (step shown during setup)
Open Discord desktop app → Press Ctrl+Shift+I (or Cmd+Option+I on Mac) → Network tab → Send any message in Discord → filter requests by messages → click any request → Headers tab → find the Authorization header → copy its value.
3. Restart Claude
Restart Claude Code. You'll see Discord tools available.
Verify it's working
npx @tensakulabs/discord-mcp status
# ✅ Connected as: yourname#0Manual MCP config (if auto-config fails)
Add to ~/.claude/settings.json:
{
"mcpServers": {
"discord": {
"command": "npx",
"args": ["-y", "@tensakulabs/discord-mcp"]
}
}
}Usage with Claude
Once registered, Claude can use Discord tools directly:
"What did I miss in the #general channel of the Tensaku server?"
→ Claude calls discord_list_guilds, discord_list_channels, discord_get_unread
"Reply to Alex saying I'll be there at 5pm"
→ Claude calls discord_send_message with replyToMessageIdHooks
Fire shell commands or HTTP webhooks when Discord events occur. Configure in ~/.config/discord-mcp/config.json:
{
"hooks": {
"on_mention": [
{
"type": "command",
"enabled": true,
"command": "osascript -e 'display notification \"{content}\" with title \"Mention from {author}\"'"
}
],
"on_everyone": [],
"on_here": [],
"on_message": []
}
}Hook types
Hook | Fires when |
| Someone directly @username mentions you |
| Someone uses @everyone in a server you're in |
| Someone uses @here in a server you're in |
| Any non-bot message (use sparingly — fires a lot) |
Hook config fields
Field | Values | Description |
|
| Shell command or HTTP POST |
|
| Toggle without removing |
| string | Shell command (type: command) |
| string | Endpoint to POST to (type: http) |
Template variables
Available in command strings and HTTP POST body:
Variable | Value |
| Username of message sender |
| Message text |
| Channel ID |
| Guild/server ID (or |
|
|
HTTP hook payload
{
"author": "username",
"content": "message text",
"channel": "channel-id",
"guild": "guild-id",
"is_dm": false
}OpenClaw integration
Add to OpenClaw's MCP config:
{
"mcp": {
"servers": [{
"name": "discord",
"transport": "stdio",
"command": "npx",
"args": ["-y", "@tensakulabs/discord-mcp"]
}]
}
}Security
Token stored in OS keychain (macOS:
securityCLI — no native module compilation needed; Linux: keytar; fallback: AES-256-CBC encrypted file)Token never written to config files or logs
Local files at
~/.config/discord-mcp/:messages.db,config.json,token.enc(fallback only),daemon.log
Architecture
discord-mcp/
├── src/
│ ├── index.ts MCP server entry — registers 6 tools
│ ├── cli.ts setup + status commands
│ ├── daemon.ts Discord Gateway WebSocket → SQLite ingestion + hooks
│ ├── auth.ts keychain token storage (macOS security CLI / keytar / encrypted file)
│ ├── hooks.ts hook runner — shell commands and HTTP webhooks
│ ├── config.ts config loader (~/.config/discord-mcp/config.json)
│ ├── db.ts SQLite schema + queries
│ ├── ratelimit.ts 429 backoff + Discord headers
│ ├── state.ts per-channel last-seen state
│ ├── purge.ts scheduled message retention cleanup
│ └── tools/
│ ├── list_guilds.ts
│ ├── list_channels.ts
│ ├── get_messages.ts
│ ├── get_dms.ts
│ ├── send_message.ts
│ └── get_unread.tsAll Discord API calls go through rateLimitedFetch — automatic backoff on 429.
The daemon runs as a launchd service (com.discord-mcp.daemon) on macOS, connecting to wss://gateway.discord.gg and storing all messages locally for fast unread queries.
Available Tools
8 toolsdiscord_get_dmsA
List the user's open DM conversations.
Inputs: no named parameters.
discord_get_messagesA
Get messages from a channel. Uses local cache if daemon is running, Discord API otherwise.
Inputs: channelId (required), limit, since, until.
discord_get_unreadA
Get messages you haven't seen yet. Uses local cache when daemon is running.
Inputs: channels (required).
discord_list_channelsB
List text channels in a guild.
Inputs: guildId (required).
discord_list_guildsA
List all Discord servers (guilds) the user is a member of.
Inputs: no named parameters.
discord_resolve_dm_userA
Resolve a username or display name to a DM channel ID. Use this before discord_get_messages when you know who to DM but not the channel ID.
Inputs: username (required).
discord_searchB
Full-text search across locally cached Discord messages (requires daemon).
Inputs: query (required), channelId, since, until, +1 more.
discord_send_messageA
Send a message to a channel or user (DM). Specify channelId OR userId.
Inputs: content (required), channelId, userId, replyToMessageId.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a distinct operation: listing DMs, getting messages, getting unread, listing channels, listing guilds, resolving user to DM channel, searching, and sending. No two tools have overlapping purposes.
All tools follow a consistent 'discord_verb_noun' pattern in snake_case, using imperative verbs (get, list, resolve, search, send). No mixing of conventions.
8 tools is well-scoped for a Discord MCP, covering essential read operations (messages, channels, guilds) and sending. Not excessive nor too sparse.
Covers core reading and sending, but lacks update/delete message operations and guild management. Minor gaps that agents can work around.
Maintenance
Related MCP Connectors
Connect a Discord bot (bot token from the developer portal) to read/send messages, list guilds and c
Discord MCP server for ChatGPT, Claude and any AI agent: list servers and channels, read channel messages, search messages, send message, reply to message, send DM, read mentions and assign role in your own Discord account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Discord yourself; Cotlet does not store your password and you need no Discord API key. About the official Discord API: Yes, Discord has an official API for bots and OAuth2 apps, but it acts as a bot that a server manager adds, not as you, and Discord has no official MCP server for it (checked 5 Nov 2026). The MCP server on Discord's docs site only searches documentation. Setup and FAQ: https://cotlet.dev/integrations/discord-api-mcp-server
Control your Discord community: send/read messages, manage channels and forums, and handle webhook…
SwarmDM (formerly AgoraDM): DMs, friends, groups and files between AI agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to send and read messages in Discord channels, manage servers, channels, and roles via Discord's API.19 npm2MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to read and write Discord messages, search content, and compute channel statistics via a Discord bot.MIT
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to read messages, discover channels, send messages, and monitor Discord communities using the Discord HTTP API.-
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to send and read messages in Discord channels through the Discord API, with server and channel discovery.19 npmMIT