mcp-discord

mcp-discord

An 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.

Category
Visit Server

README

mcp-discord

An MCP (Model Context Protocol) 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.

Quick Start (Team Members)

Step 1: Configure npm for GitHub Packages

Run this once to set up access to our private package:

npm config set @acheronlabs:registry https://npm.pkg.github.com
npm login --registry=https://npm.pkg.github.com

When prompted:

  • Username: Your GitHub username
  • Password: A GitHub Personal Access Token with read:packages scope (create one here)
  • Email: Your email

Step 2: Install globally

npm install -g @acheronlabs/mcp-discord

Step 3: Configure your Discord token

mcp-discord-setup

Follow the prompts to enter your Discord token (see Getting Your Token).

Step 4: Add to Claude Code

Option A: Global (available in all projects)

Run this command to add globally:

claude mcp add discord-search --scope user -- mcp-discord

Option B: Per-project

Add to your project's .mcp.json file:

{
  "mcpServers": {
    "discord-search": {
      "command": "mcp-discord"
    }
  }
}

Step 5: Restart Claude Code

Restart Claude Code and verify with the /mcp command.

Features

  • Search Messages: Full-text search with filters for author, channel, date range, and attachment types
  • List Guilds: View all Discord servers you have access to
  • List Channels: Browse channels in a server
  • Message Context: Get surrounding messages for context around search results
  • Daily Summary: Get aggregated messages over a time period with author statistics (rate-limit safe)

Prerequisites

Installation

Option 1: Global Install from GitHub Packages (Recommended)

See Quick Start above.

Option 2: Clone and Build (Development)

git clone https://github.com/AcheronLabs/mcp-discord.git
cd mcp-discord
npm install
npm run build
npm run setup

Configuration

1. Run Setup (Recommended)

The easiest way to configure the server is using the interactive setup:

# If installed globally
mcp-discord-setup

# Or after cloning and building
npm run setup

This will:

  • Guide you through getting your Discord token
  • Store it securely in ~/.config/mcp-discord/config.json
  • Set proper file permissions (600 - owner read/write only)

2. Configure Claude Code

Add to your project's .mcp.json:

{
  "mcpServers": {
    "discord-search": {
      "command": "node",
      "args": ["/path/to/mcp-discord/dist/index.js"]
    }
  }
}

Or if installed globally:

{
  "mcpServers": {
    "discord-search": {
      "command": "mcp-discord"
    }
  }
}

3. Restart Claude Code

After configuring, restart Claude Code for changes to take effect. Verify with /mcp command.

Alternative: Environment Variable

If you prefer environment variables (e.g., for CI/CD), you can set:

export DISCORD_USER_TOKEN="your_token_here"

The server checks config file first, then falls back to environment variable.

Getting Your Discord Token

  1. Open Discord in your browser at https://discord.com/app
  2. Open Developer Tools (F12 or Cmd+Option+I)
  3. Go to the Network tab
  4. Perform any action in Discord (send a message, switch channels)
  5. Click on any request to discord.com/api
  6. Look for the Authorization header in the request headers
  7. Copy the token value (without "Bearer " prefix if present)

Security: Your token is stored in ~/.config/mcp-discord/config.json with 600 permissions (only you can read/write).

Available Tools

search_messages

Search Discord messages with powerful filters.

Parameter Type Required Description
guild_id string Yes Server ID to search in
content string No Text to search for
author_id string No Filter by user ID
channel_id string No Filter to specific channel
has enum No Filter by: file, link, embed, image, video, sound, sticker
before string No Messages before date (ISO 8601) or message ID
after string No Messages after date (ISO 8601) or message ID
limit number No Max results 1-25 (default: 25)
offset number No Pagination offset

Response includes: guild_name, channel_name, author, content, timestamp, attachments for each message.

Example usage in Claude:

Search the Dimensional server for "mini pc" references

list_guilds

List all Discord servers you have access to. No parameters required.

list_channels

List channels in a Discord server.

Parameter Type Required Description
guild_id string Yes Server ID
type enum No Filter: text, voice, category, thread, forum, all (default: text)

get_message_context

Get messages surrounding a specific message for context.

Parameter Type Required Description
guild_id string Yes Server ID containing the message
channel_id string Yes Channel containing the message
message_id string Yes Target message ID
content string No Text from the target message (recommended for reliable results)
before_count number No Messages before (0-25, default: 5)
after_count number No Messages after (0-25, default: 5)

Note: The content parameter is recommended because Discord's search API requires content to reliably find specific messages. Without it, the target message may not be found.

get_daily_summary

Get a summary of all messages from a Discord server over a time period. Useful for daily digests.

Parameter Type Required Description
guild_id string Yes Server ID to summarize
channel_ids string[] No Specific channel IDs (default: all channels)
hours number No Hours to look back (1-168, default: 24)
max_messages number No Max messages to fetch (25-1000, default: 500)

Rate Limiting: Uses conservative 500ms delays between API requests (2 req/sec) to avoid Discord blocks. A full 500-message fetch takes ~10 seconds.

Response includes:

  • stats: Total messages, channels, authors, API calls made, truncation info
  • active_authors: Top 20 most active users with message counts
  • channels: Messages grouped by channel, sorted by activity

Example usage in Claude:

Give me a daily summary of the Dimensional server
Summarize the last 48 hours of messages in the dev channel

Usage Examples

Once configured, you can ask Claude:

  • "List my Discord servers"
  • "Search the Dimensional server for discussions about hardware"
  • "Find messages from @alex about navigation"
  • "Show me messages with attachments in the dev channel"
  • "Get context around message ID 1234567890" (use with content text for best results)
  • "Give me a daily summary of the Dimensional server"

Troubleshooting

MCP server not appearing

  1. Check /mcp command output for errors
  2. Verify token is configured: cat ~/.config/mcp-discord/config.json
  3. Ensure the path in .mcp.json is absolute
  4. Restart Claude Code

Token not found

Run the setup again:

npm run setup

"Rate limited" errors

The server handles rate limits automatically with retries. If you see persistent rate limit errors, wait a few minutes before trying again.

"Discord API error (401)"

Your token is invalid or expired. Get a fresh token from Discord.

"Discord API error (403)"

You don't have permission to access that server or channel.

Notes

  • This uses Discord's user token (not a bot token) to access the native search API
  • Using user tokens is against Discord's Terms of Service - use at your own risk for personal productivity
  • The server caches channel and guild information for better performance
  • Search results are limited to 25 per request (Discord API limit)

Publishing a New Release (Maintainers)

To publish a new version to GitHub Packages, just run:

npm run release

This will automatically:

  1. Run tests and build
  2. Bump the version (you'll be prompted for patch/minor/major)
  3. Create a git tag
  4. Push to GitHub
  5. Create a GitHub Release

The GitHub Release triggers the publish workflow, which publishes to GitHub Packages.

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured