A comprehensive Model Context Protocol server for Discord integration
๐ค Discord MCP Server
A comprehensive Model Context Protocol server for Discord integrationFeatures โข
Quick Start โข
Installation โข
Configuration โข
API Reference โข
Contributing
๐ Table of Contents
- โจ Features
- ๐ Quick Start
- ๐ฆ Installation
- โ๏ธ Configuration
- ๐ง Setup Guide
- ๐ ๏ธ Available Tools
- ๐ Authentication
- ๐ Monitoring
- ๐งช Testing
- ๐ API Reference
- ๐ก๏ธ Security
- ๐ค Contributing
- ๐ License
โจ Features
๐ฏ Core Capabilities
- ๐ Discord Integration: Full Discord API support with 5 powerful tools
- ๐ Enterprise Security: Multi-tenant authentication with API key management
- โก Rate Limiting: Configurable rate limits (30/min, 500/hour, 5000/day)
- ๐ Real-time Monitoring: Built-in MCP Inspector dashboard
- ๐ Comprehensive Logging: Audit trails and security event tracking
- ๐งช Testing Ready: Jest framework with 80%+ coverage threshold
๐ ๏ธ Discord Tools
| Tool | Description | Use Case |
|---|---|---|
get_channel_info |
Retrieve detailed channel information | Channel analytics, moderation |
get_messages |
Fetch messages with filtering options | Content analysis, history |
search_messages |
Advanced message search capabilities | Content discovery, compliance |
send_message |
Send messages by channel ID or name | Automated notifications, responses |
moderate_content |
Delete messages and moderate content | Community management, safety |
๐๏ธ Architecture Highlights
- ๐ MCP Protocol: Full Model Context Protocol compliance
- ๐ข Multi-tenancy: Isolated client management per API key
- ๐ก๏ธ Security First: Token hashing, no persistent storage
- ๐ Scalable: Automatic client cleanup and resource management
# Clone the repository
git clone https://github.com/lokeshpanthangi/Discord-MCP.git
cd Discord-MCP
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your credentials
# Start the server
npm start
# Open MCP Inspector (optional)
# Visit http://localhost:3001
๐ฆ Installation
Prerequisites
- Node.js >= 18.0.0
- npm >= 8.0.0
- Discord Bot Token (Create one here)
- Discord Server with bot permissions
Step-by-Step Installation
Clone the Repository
git clone https://github.com/lokeshpanthangi/Discord-MCP.git cd Discord-MCPInstall Dependencies
npm installEnvironment Setup
cp .env.example .envConfigure Environment Variables (see Configuration)
Start the Server
npm start
โ๏ธ Configuration
Environment Variables
Create a .env file in the root directory:
# Required: Discord Bot Configuration
DISCORD_BOT_TOKEN=your_discord_bot_token_here
# Required: MCP Server Authentication
MCP_API_KEY=your_secure_api_key_here
# Optional: Server Configuration
MCP_SERVER_NAME=discord-mcp-server
NODE_ENV=production
# Optional: Monitoring
MCP_INSPECTOR_PORT=3001
# Optional: Logging
LOG_LEVEL=info
Discord Bot Setup
Create Discord Application
- Visit Discord Developer Portal
- Click "New Application" and give it a name
- Navigate to "Bot" section
- Click "Add Bot"
Configure Bot Permissions
โ Send Messages โ Read Message History โ View Channels โ Manage Messages (for moderation) โ Read Messages/View ChannelsGet Bot Token
- In Bot section, click "Copy" under Token
- Add to your
.envfile asDISCORD_BOT_TOKEN
Invite Bot to Server
ht
Tools (5)
get_channel_infoRetrieve detailed channel informationget_messagesFetch messages with filtering optionssearch_messagesAdvanced message search capabilitiessend_messageSend messages by channel ID or namemoderate_contentDelete messages and moderate contentEnvironment Variables
DISCORD_BOT_TOKENrequiredDiscord Bot Token from Developer PortalMCP_API_KEYrequiredSecure API key for MCP server authenticationMCP_SERVER_NAMEName of the MCP serverNODE_ENVEnvironment mode (e.g., production)MCP_INSPECTOR_PORTPort for the MCP inspector dashboardLOG_LEVELLogging verbosity levelConfiguration
{"mcpServers": {"discord": {"command": "node", "args": ["/path/to/Discord-MCP/index.js"], "env": {"DISCORD_BOT_TOKEN": "your_token", "MCP_API_KEY": "your_key"}}}}