MCP Relay
This MCP server allows Claude to send messages and prompts to a Discord channel and receive responses.
Setup Instructions
1. Create a Discord Application and Bot
- Go to the Discord Developer Portalβ
- Click βNew Applicationβ and give it a name
- Go to the βBotβ section in the left sidebar
- Under the botβs token section, click βReset Tokenβ and copy the new token
- Keep this token secure! Donβt share it publicly
- Under βPrivileged Gateway Intentsβ, enable:
- Message Content Intent
- Server Members Intent
- Presence Intent
2. Invite the Bot to Your Server
- Go to the βOAuth2β section in the left sidebar
- Select βURL Generatorβ
- Under βScopesβ, select:
- bot
- applications.commands
- Under βBot Permissionsβ, select:
- Send Messages
- Embed Links
- Read Message History
- Copy the generated URL and open it in your browser
- Select your server and authorize the bot
3. Get Channel ID
- In Discord, enable Developer Mode:
- Go to User Settings > App Settings > Advanced
- Turn on βDeveloper Modeβ
- Right-click the channel you want to use
- Click βCopy Channel IDβ
4. Configure MCP Settings
The server requires configuration in your MCP settings file. Add the following to your configuration file:
{
"mcpServers": {
"discord-relay": {
"command": "node",
"args": [
"/ABSOLUTE/PATH/TO/MCP Relay/build/index.js"
],
"env": {
"DISCORD_TOKEN": "your_bot_token_here",
"DISCORD_CHANNEL_ID": "your_channel_id_here"
}
}
}
}
Replace:
/ABSOLUTE/PATH/TO/MCP Relay
with the actual path to your MCP Relay projectyour_bot_token_here
with your Discord bot tokenyour_channel_id_here
with your Discord channel ID
Note: Make sure to use absolute paths in the configuration.
Usage
The server provides a tool called send-message
that accepts the following parameters:
{
type: 'prompt' | 'notification', // Type of message
title: string, // Message title
content: string, // Message content
actions?: Array<{ // Optional action buttons
label: string, // Button label
value: string // Value returned when clicked
}>,
timeout?: number // Optional timeout in milliseconds
}
Message Types
-
Notification: Simple message that doesnβt expect a response
{ "type": "notification", "title": "Hello", "content": "This is a notification" }
-
Prompt: Message that waits for a response
{ "type": "prompt", "title": "Question", "content": "Do you want to proceed?", "actions": [ { "label": "Yes", "value": "yes" }, { "label": "No", "value": "no" } ], "timeout": 60000 // Optional: 1 minute timeout }
Notes:
- Prompts can be answered either by clicking action buttons or sending a text message
- Only one response is accepted per prompt
- If a timeout is specified, the prompt will fail after the timeout period
- Notifications donβt wait for responses and return immediately
Last updated on