discord-mcp
Reads your Discord conversation history from the local Discord desktop cache and, optionally, falls back to the Discord REST API. Provides tools to list guilds and channels (including categories and forums with cached message counts), read channel messages with author/date filters, fetch a single message with its Discord link and attachments, search messages by text/server/channel/author/date, list and download message attachments, export cached channels or threads to JSON or Markdown, and list/read threads (token required). Cache mode makes zero network requests, while API mode uses a personal token to reach uncached messages.
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-mcpsearch my Discord history for messages mentioning 'roadmap'"
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
An MCP server that lets Claude read your Discord conversation history.
It keeps its own message store in the project folder (./cache), seeded for free
from the Discord desktop cache and refreshed on demand. Reads hit this store, so
it keeps working even when the Discord client stops flushing its own cache, and
in store/seed mode it makes zero network requests — no account-detection risk.
The Discord REST API is an optional, opt-in refresh source.
Windows / macOS supported (the on-disk cache format differs per platform and is handled automatically).
🇰🇷 한국어 README: README.ko.md
⚠️ Disclaimer — read before enabling API mode
This tool has two independent modes:
Cache mode (default, safe). Reads files Discord already wrote to your local disk. No API calls, no token, nothing sent to Discord. Only reads channels you have already opened in the Discord app.
API mode (optional, opt-in, your risk). If you set a
DISCORD_TOKEN, the server calls the Discord REST API with your personal user token. This is a self-bot, which violates the Discord Terms of Service and the Developer Policy, and can get your account suspended or terminated. API mode is off until you create a.envwith a token yourself.
Use this software only on your own account and your own data, and only where local law allows. You are solely responsible for how you use it. The authors provide it "as is" with no warranty (see LICENSE). If you do not want the ToS risk, do not configure a token — cache mode works on its own.
Related MCP server: recall
Why
Discord gives you no built-in way to search or summarize your own history from an assistant. The official bot API requires inviting a bot per server and can't reach DMs or read-only servers.
So this reads the cache the Discord desktop app already stores locally. Zero API calls in cache mode → no account detection, no rate limits. Any channel you've opened in the app is readable with no network request.
Only when you explicitly need older messages or threads that aren't cached does the optional token-based REST fallback come into play.
Result: Claude can answer "what was said in this channel yesterday?" purely by reading local files.
Tools
Tool | Description |
| List servers you're in |
| List channels per server (categories & forums, with cached message counts) |
| Read channel messages, with author/date filters and |
| Fetch one message by ID, with its Discord link and attachment info |
| Search by text, server, channel, author, or date |
| List a cached message's attachments (size, type, URL) |
| Save a cached Discord CDN file into |
| Export a cached channel/thread to JSON or Markdown in |
| List forum/threads (API token required) |
| Read messages inside a thread |
| Snapshot the Discord desktop cache into the local store (no API calls) |
| Per-channel freshness: local store vs. the Discord desktop cache |
| Store statistics + API availability |
Query & file tools
authorinread_messages/search_messagesmatches an author ID, username, or display name exactly.since/untilacceptYYYY-MM-DDor ISO 8601 and are inclusive on both ends; a bare date is interpreted in UTC.search_messagesworks with an emptyquery— filter by channel, author, or date alone. Results and single-message lookups include the Discord message link and attachment metadata.Pass the
attachment_idfromlist_attachments(channel_id, message_id)todownload_attachment. The download tool only accepts Discord CDN URLs that a cached message points to, and caps each file at 100 MiB. Expired or uncached URLs return an error.export_messages(channel_id, format="json")orformat="markdown"saves a cached conversation;author/since/untilfilters apply. Exports are written oldest-message-first.Downloads and exports create local files. The local store
cache/, plusdownloads/,exports/, and the original backupbackups/, are git-ignored.
File downloads and exports operate on messages present in the cache. Message links use the server link when the guild ID can be found in cache, otherwise a DM style link — so some links may not open.
Local store & freshness
Reads come from a persistent store in ./cache (git-ignored), not from the
Discord desktop cache directly. This means the server keeps answering even when
the Discord client stops flushing its own cache to disk.
First read seeds the store for free from the Discord desktop cache.
sync_cachere-snapshots the desktop cache into the store (no API calls) — run it after opening a channel in the app to pull whatever the client flushed.cache_statusshows, per channel, how far the store reaches vs. how far the desktop cache has flushed, so you know whether async_cachewould add anything.read_messages(..., source="api")fetches live from the REST API and merges the result into the store (token required; see the disclaimer).
Pagination (read_messages)
Messages return newest-first. Each response includes has_more, newest_id, and
oldest_id. Use message-ID cursors to walk beyond the first page:
before=<message_id>— only messages older than it. Page back through history by passing the previous response'soldest_id.after=<message_id>— only messages newer than it. Read incrementally by passing the last ID you saw (e.g. the previousnewest_id).
Both bounds are exclusive and compared by numeric message ID.
Install
git clone https://github.com/mu1aq/discord-mcp.git
cd discord-mcp
# or install from releaseWindows (PowerShell 7+):
./install.ps1macOS / Linux:
./install.shWhat the installer does:
Check Python 3.11+
Install dependencies (
mcp[cli],aiohttp)Auto-detect the Discord install / cache location
Pick a target — Claude Code / Codex / both
Claude Code →
~/.claude.jsonCodex →
~/.codex/config.tomlinjects the cache path as
DISCORD_CACHE_DIR
Multiple clients share the same server (identical code). To run non-interactively,
set DISCORD_MCP_TARGET=claude|codex|both.
API mode (optional)
To read messages that aren't cached, set a Discord token. See the disclaimer above first — this is a self-bot and violates Discord's ToS.
cp .env.example .env
# open .env and set DISCORD_TOKENGetting the token:
Log in to the Discord desktop app or discord.com
Ctrl+Shift+I(macOS:Cmd+Option+I) → Network tabClick any channel → click a
/api/v9/request → Headers → copy theAuthorizationvalue
How it works
Discord client → desktop cache (Chromium Cache)
↓ seed / sync_cache (zero API calls, undetectable)
local store (./cache) ← primary read source
↓
MCP Server (localhost)
↑ source="api" (refresh, token required, rate-limited)
REST API
↓
Claude Code / Claude DesktopStore (default): reads come from
./cache. It is seeded from the Discord desktop cache (channels you've opened in the app) and keeps working after the client stops flushing.Windows: blockfile format (payload brute-scan), macOS: simple cache format
API mode: refreshes the store from the Discord API for uncached or newer messages (self-bot, ToS-violation risk).
Requirements
Windows or macOS
Python 3.11+
Discord desktop client installed and logged in
Manual install
pip install "mcp[cli]" aiohttpAdd to mcpServers in ~/.claude.json (command is your python path):
{
"discord-cache": {
"command": "python",
"args": ["/path/to/discord-mcp/server.py"],
"timeout": 30000,
"env": { "DISCORD_CACHE_DIR": "<Discord Cache_Data path>" }
}
}Codex — add to ~/.codex/config.toml:
[mcp_servers.discord-cache]
command = "python"
args = ["/path/to/discord-mcp/server.py"]
env = { DISCORD_CACHE_DIR = "<Discord Cache_Data path>" }Default cache path — Windows: %APPDATA%\discord\Cache\Cache_Data,
macOS: ~/Library/Application Support/discord/Cache/Cache_Data.
Use DISCORD_CACHE_DIR for other locations.
Self-check
python test_cache.py
python test_read_features.pyLicense
This server cannot be deployed
Maintenance
Related MCP Connectors
Give Claude only the Google Drive files you choose. Every action logged.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
- UxenOAuthcom.rrrfirstchat
Your Telegram, WhatsApp, Instagram, mail and calendar in Claude or ChatGPT. Never sends messages.
1 - platform7nOAuthtech.p7n
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Claude Code to interact with Discord servers, including sending messages, reading channels, managing threads, and adding reactions via natural language commands.3 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude to search through its own past sessions using full-text search and resume them. Works offline with zero runtime dependencies.MIT
- AlicenseBqualityBmaintenanceEnables Claude to interact with Discord through natural conversation, including reading and sending messages, managing threads, reacting, searching history, and sending direct messages using a user token.20133 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables Claude to full-text search, list, and read your exported ChatGPT and Claude conversations from a local conversations.json file, running locally with read-only file access and no network requests. Supports both official export formats with automatic detection.MIT