discord-mcp
Provides permission-aware search and reading over a Discord server's history, including ranked message search with context, channel/thread reading, server and member info, and optional posting as the bot where the signed-in member is allowed. Every query is filtered by the member's live Discord permissions.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
discord-mcp
Permission-aware search over your whole Discord history, for Claude and other AI agents. Self-hosted, read-only by default, and every member signs in as themselves.
"Where did we decide on the foundation logo?" · "Who deployed agroQ to Oracle and how?" · "Summarise what changed in #backend this week and reply to Ola's question."
Your team's decisions live on Discord. Its search is not built for an AI agent. It returns 25 results per page, shows no context around a hit and knows no synonyms or inflection. Bot-token MCP servers also show everyone everything the bot can see.
discord-mcp indexes your server's history into SQLite and gives agents hooks: the matching spot plus the conversation around it. Every result is filtered by what the asking member can see on Discord right now.
Why this one
discord-mcp | Typical Discord MCP servers | |
Search | Full-history index (FTS5 + trigram), lemmas, typo variants, phrase/OR/exclude, | Discord API pass-through or a scan of one channel |
Results | Hooks with surrounding messages, token budget, cursors | Raw message lists that overflow the context |
Who sees what | Each member signs in; their live Discord permissions (roles, overwrites, private threads) filter every query in SQL | Everything the bot token can read |
Connect | Remote MCP with built-in OAuth 2.1: paste a URL into claude.ai, run | Local stdio + a bot token in a config file |
Safety | Read-only by default, content wrapped as untrusted data, no pings, audit log | Often full admin tools |
ToS | Regular bot, no self-bot or user token | Some use user tokens |
Works with claude.ai (custom connector), Claude Code, and any MCP client that supports remote servers with OAuth. Bot UI and sign-in page in English and Polish.
Related MCP server: Discord Message Finder MCP
How it works
flowchart LR
D[Discord gateway + REST] -->|backfill, live events,<br>periodic reconcile| I[(SQLite index<br>FTS5 + trigram)]
U[Member in Claude] -->|OAuth: /mcp login code| S[MCP server]
S -->|live permissions| P{Channels this<br>member can read}
P --> Q[Query engine<br>hooks · facets · budget]
I --> Q --> SThe bot backfills the history (resumable), follows new/edited/deleted messages, and re-reads the last days periodically so edits and deletes made while it was offline are applied. Deleted messages are removed.
A member adds the server as a connector; the sign-in page asks for a one-time code from
/mcp loginon Discord. That is the whole identity check: no passwords, no tokens to paste.Every tool call computes the member's readable channels from their current roles and channel overwrites and constrains the SQL before ranking. Losing a role or leaving the server cuts access immediately.
Quickstart (self-hosted)
You need a Discord application with a bot, a server you manage, and an HTTPS domain. Full guide: docs/self-hosting.md.
# 1. Bot: discord.com/developers → New Application → Bot → enable MESSAGE CONTENT and SERVER MEMBERS intents.
# 2. Run it (Docker; the image is non-root and keeps its index in /data):
docker run -d --name discord-mcp \
-e DISCORD_BOT_TOKEN=... \
-e ZDM_GUILD_ID=123456789012345678 \
-e ZDM_PUBLIC_URL=https://mcp.example.com \
-v zdm-data:/data -p 8000:8000 \
ghcr.io/zerya-dev/zerya-discord-mcp-bot:latest
# 3. Put HTTPS in front of port 8000 (Dokploy/Traefik, Caddy, nginx) at the root of mcp.example.com.
# 4. The log prints a setup checklist and the invite link. On Discord, run /mcp-setup to see it there.Connect a client
Client | How |
claude.ai | Settings → Connectors → Add custom connector → |
Claude Code |
|
Other MCP clients | Remote server URL |
On Discord: /mcp login (sign-in code), /mcp list (connected clients), /mcp revoke <id|all> (disconnect),
/mcp-setup (admins: setup checklist).
Tools
Tool | What it does |
| Query → ranked hooks with context, expansions shown ("fundacja → fundacji (lemma)"), facets by channel/author/month, narrowing hints, per-term hit counts when nothing matches |
| Messages in order around a link/ID, the latest in a channel or thread, from a date, or a forum's posts; paged by token budget |
| Server map with activity, a channel (topic, who writes, threads) or a person (roles, where and when they write) |
| Optional ( |
Query language
logo exact word, its lemma (logami → logo) and close spellings from your corpus
(fundacja|foundation) any of the alternatives; groups are ANDed
"wersja mono" exact phrase
-lego exclude
in:#design channel (includes its threads), thread or forum
from:ola mentions:ola author / mentioned member (nick, display name or username)
after:2026-09 before:2026-10-01 after:7d
has:link has:file has:code is:threadTerms only need to occur within a few messages of each other (context, default 5), because conversations
spread one idea over several short messages.
Security model
Identity: OAuth 2.1 authorization server built in (RFC 8414 / 9728 discovery, dynamic client registration, PKCE S256, rotating refresh tokens with reuse detection, revocation). Codes and tokens are stored as SHA-256 hashes. The sign-in page shows which site receives the code;
ZDM_OAUTH_REDIRECT_HOSTScan restrict it.Authorization: computed per request from live Discord state; private threads use Discord's thread membership. Facets, counts, hints and channel mentions never reveal hidden channels.
Prompt injection: message content is returned inside
<untrusted_discord_messages>; tool descriptions and server instructions tell the agent not to follow it. Writing is off by default; when on, it is a separate OAuth scope the member approves, rate-limited, audited, without mentions or embeds.Data: your own SQLite file. Deleted messages are removed from the index. Excluded channels (
ZDM_EXCLUDE_CHANNEL_IDS) never enter it. The audit log keeps tool calls forZDM_AUDIT_RETENTION_DAYS.
Report vulnerabilities privately: see SECURITY.md.
Configuration
All settings are environment variables (or .env). The essentials:
Variable | Default | |
| required | bot token |
| required | the server to index and serve |
| required for HTTP | origin of the app, e.g. |
|
| index file |
|
| enable the |
|
| JSON list; channels (and their threads) never indexed |
Every other option (backfill limits, reconcile window, token lifetimes, rate limits, send allowlist, timezone, output budgets, bot/HTTP switches) is documented in docs/configuration.md.
Embedding in an existing hikari bot
The library does everything except owning the bot and the HTTP server:
from zerya_discord_mcp import Config, ZeryaDiscordMcp
zdm = ZeryaDiscordMcp(
bot, Config(db_path=Path("/data/zdm.sqlite3"), guild_id=GUILD_ID, public_url="https://mcp.example.com")
) # before bot.run()
@bot.listen(hikari.StartedEvent)
async def _(_: hikari.StartedEvent) -> None:
await zdm.start() # migrations, backfill and maintenance in the background
@bot.listen(hikari.StoppingEvent)
async def _(_: hikari.StoppingEvent) -> None:
await zdm.stop()
app = zdm.asgi_app() # serve at the root of ZDM_PUBLIC_URL (any thread; REST hops to the bot loop)
result = await zdm.commands.login(user_id, locale) # wire /mcp into your command framework; result.to_embed()pip install "zerya-discord-mcp[mcp]" # or: uv add "zerya-discord-mcp[mcp]"Needs the MESSAGE_CONTENT and GUILD_MEMBERS intents.
Development
uv sync --all-packages
just test lint typecheck # pytest, ruff, pyrefly (strict)
just index # run the bot locally without slash commands
just search "(logo|logotyp) after:2026-09" # query a local index as an admin
just eval eval/questions.yaml # recall@10 / MRR on your own questionsSearch changes are measured on an eval set of real questions (see eval/); a change must not lower recall@10.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Hosted Web Crawler MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Persistent AI memory shared across Claude, ChatGPT, coding agents, and compatible MCP clients.
The Remote MCP server acts as a standardized bridge between LLM applications (like Claude, ChatGPT, and Cursor) and external services, enabling AI agents to access external tools and resources. Its primary capability is providing a centralized search tool to discover other MCP servers and their respective tools. Unlike local implementations, it runs remotely with OAuth authentication and permission controls for security.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA remote MCP server deployed on Cloudflare Workers that provides AI agents with authenticated, permission-aware access to Discord servers. It enables agents to read, search, and post messages while maintaining secure Role-Based Access Control via OAuth2.16MIT
- AlicenseAqualityDmaintenanceRead-only MCP server for finding Discord messages. It enables searching guild messages, locating messages from jump URLs, and reading context around results.71MIT
- FlicenseAqualityCmaintenanceMCP server that exposes Discord and Twitch/Chatty chat log query tools to Claude Code, enabling searching messages, channel stats, user messages, and events from chat logs.7-
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables searching Discord messages using Discord's native search API. Designed for use with Claude Code to find project decisions and communications in Discord.MIT