Skip to main content
Glama
discord-history-mcp

discord-history-mcp

by ultsaza

discord-history-mcp

Share a Discord server’s text history with MCP clients. Each member approves the connection in Discord; every read checks that member’s current permissions and the bot’s permissions.

No Discord user tokens or Discord OAuth client secret. No voice recording, message mirroring, or message-writing MCP tools.

Quick start

Requires Python 3.12+ and uv.

  1. Create a dedicated Discord application and bot in the Developer Portal. Enable Message Content Intent as permitted for your app. Install it in your server with bot and applications.commands scopes, and only View Channels / Read Message History permissions (66560). Do not grant Administrator. Private threads also require the bot to be a member, or have Manage Threads.

  2. Copy config.example.json to config.json. Set your public HTTPS origin and server IDs. Add only exact OAuth callbacks you trust. Put the bot token in secrets/bot-token, outside Git; protect it with permissions 600.

  3. Run:

uv sync --locked
uv run discord-history-mcp --config config.json check
uv run discord-history-mcp --config config.json serve
  1. Publish 127.0.0.1:19230 through an HTTPS reverse proxy. Tailscale Funnel and container deployment are documented. Members do not need Tailscale when Funnel is used.

  2. Add https://YOUR-PUBLIC-HOST/mcp to ChatGPT or Claude using OAuth and dynamic client registration (DCR). Run the displayed /mcp code:CODE in Discord and approve the private bot response. Keep the browser page open until it redirects back.

Each member repeats step 5 using their own Discord account. /mcp action:revoke revokes all their grants for that server.

The example callbacks follow current ChatGPT authentication documentation and Claude connector documentation. Check your client’s actual callback before enabling it. CIMD / private-key JWT client registration is not supported; choose DCR where offered. Client availability depends on the product plan and workspace policy.

Related MCP server: fluency-discord-mcp

Tools

Tool

Result

whoami

Connected member and approved server

list_channels

Readable text, announcement, forum and media channels

list_threads

Readable active threads under one channel

get_messages

1–100 messages with authors, timestamps and Discord links

search_messages

Bounded text search through at most 500 messages in one channel

Messages are returned oldest first. Use next_before / next_after for pagination. Search reports its coverage; it is not a complete server-wide index. Archived threads can be fetched by ID, but thread discovery covers active threads only. DMs and voice/stage text are excluded.

Security and operation

  • OAuth authorization code + PKCE S256; exact callback allowlist and resource audience validation.

  • Explicit Discord consent bound to the interacting member and guild. Grants last 30 days; access tokens last one hour; refresh tokens rotate. Member revocation takes effect on the next request.

  • Current membership, roles and channel overrides are fetched for every read. Private threads require membership or Manage Threads. Administrator on the bot is rejected at startup and during reads.

  • HTTP defaults to loopback. Request size, body timeout, concurrency, endpoint rates and per-member work are bounded. Idle registrations expire and unused registrations can be evicted; active grants are preserved.

  • Tokens and authorization codes are hashed in a private SQLite database. Messages are not stored. Returned Discord content remains untrusted input to the AI client.

Read the security model and remaining risks before public deployment. In particular, granted history is sent to the connected AI service, and revocation cannot retract data already delivered. Use a dedicated bot and isolated service account/container.

Development

uv sync --locked --group dev
uv run ruff check src tests
uv run ruff format --check src tests
uv run pytest -q
uv build

Tests use synthetic Discord data and local ASGI transport. A live Discord bot and real ChatGPT/Claude account are still needed to verify a deployment’s first connection.

日本語の導入手順 · Architecture · Deployment · MIT License

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Read-only MCP server for finding Discord messages. It enables searching guild messages, locating messages from jump URLs, and reading context around results.
    7
    1
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables MCP clients to read, post to, and moderate a Discord server through the Discord REST API, with opt-in guardrails and dry-run safeguards.
    -
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI clients to read Discord channels, recent messages, and searchable history, then turn that evidence into freshness-aware team context, briefs, decision baselines, and signed checkpoint diffs through remote MCP and GPT Actions. It keeps Discord access read-only while supporting OAuth/Bearer authentication for multiple clients.
    Apache 2.0
  • F
    license
    A
    quality
    C
    maintenance
    Provides read-only Discord access, enabling listing guilds, mapping channels, reading and searching messages, following threads, and viewing attachments without posting.
    12
    1
    -