
v-3/discordmcp
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
v-3/discordmcp — это кандидат на MCP-сервер, импортированный из https://github.com/v-3/discordmcp.
Обзор
v-3/discordmcp — это кандидат на MCP-сервер, импортированный из https://github.com/v-3/discordmcp.
Обзор (машинный перевод)
Сервер Model Context Protocol (MCP), который позволяет LLM взаимодействовать с каналами Discord, позволяя им отправлять и читать сообщения через API Discord. Используя этот сервер, LLM, такие как Claude, могут напрямую взаимодействовать с каналами Discord, сохраняя при этом контроль пользователя и безопасность.
Особенности
- Отправлять сообщения на каналы Discord
- Чтение последних сообщений с каналов
- Автоматическое обнаружение серверов и каналов
- Поддержка как названий каналов, так и идентификаторов
- Правильная обработка ошибок и валидация
Предварительные требования
- Node.js 16.x или выше
- Токен бота Discord
- Бот должен быть приглашён на ваш сервер с соответствующими разрешениями:
- Чтение сообщений/просмотр каналов
- Отправить сообщения
- Прочитать историю сообщений
Подготовка
-
Клонируйте этот репозиторий:
-
Установка зависимостей:
-
Создайте файл
.envв корневой директории с помощью токена бота Discord: -
Постройте сервер:
Использование с Claude для десктопа
- Откройте конфигурационный файл Claude for Desktop:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Окна:
%APPDATA%\Claude\claude_desktop_config.json
-
Добавьте конфигурацию сервера Discord MCP:
-
Перезапусти Claude для десктопа
Доступные инструменты
отправить сообщение
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
README
Показан фрагмент оригинального README. Открыть оригинал.
Discord MCP Server
A Model Context Protocol (MCP) server that enables LLMs to interact with Discord channels, allowing them to send and read messages through Discord’s API. Using this server, LLMs like Claude can directly interact with Discord channels while maintaining user control and security.
Features
- Send messages to Discord channels
- Read recent messages from channels
- Automatic server and channel discovery
- Support for both channel names and IDs
- Proper error handling and validation
Prerequisites
- Node.js 16.x or higher
- A Discord bot token
- The bot must be invited to your server with proper permissions:
- Read Messages/View Channels
- Send Messages
- Read Message History
Setup
- Clone this repository:
git clone https://github.com/yourusername/discordmcp.git
cd discordmcp
- Install dependencies:
npm install
- Create a
.envfile in the root directory with your Discord bot token:
DISCORD_TOKEN=your_discord_bot_token_here
- Build the server:
npm run build
Usage with Claude for Desktop
-
Open your Claude for Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
-
Add the Discord MCP server configuration:
{
"mcpServers": {
"discord": {
"command": "node",
"args": ["path/to/discordmcp/build/index.js"],
"env": {
"DISCORD_TOKEN": "your_discord_bot_token_here"
}
}
}
}
- Restart Claude for Desktop
Available Tools
send-message
Sends a message to a specified Discord channel.
Parameters:
server(optional): Server name or ID (required if bot is in multiple servers)channel: Channel name (e.g., “general”) or IDmessage: Message content to send
Example:
{
"channel": "general",
"message": "Hello from MCP!"
}
read-messages
Reads recent messages from a specified Discord channel.
Parameters:
server(optional): Server name or ID (required if bot is in multiple servers)channel: Channel name (e.g., “general”) or IDlimit(optional): Number of messages to fetch (default: 50, max: 100)
Example:
{
"channel": "general",
"limit": 10
}
Development
- Install development dependencies:
npm install --save-dev typescript @types/node
- Start the server in development mode:
npm run dev
Testing
You can test the server using the MCP Inspector:
npx @modelcontextprotocol/inspector node build/index.js
Examples
Here are some example interactions you can try with Claude after setting up the Discord MCP server:
- “Can you read the last 5 messages from the general channel?”
- “Please send a message to the announcements channel saying ‘Meeting starts in 10 minutes’”
- “What were the most recent messages in the development channel about the latest release?”
Установка
npx @modelcontextprotocol/inspector node build/index.jsКонфигурация
{
"mcpServers": {
"discord": {
"command": "node",
"args": ["path/to/discordmcp/build/index.js"],
"env": {
"DISCORD_TOKEN": "your_discord_bot_token_here"
}
}
}
}