Ein Model Context Protocol (MCP) Server für Discord-Integration, der es ermöglicht, Discord-Funktionen über eine standardisierte Schnittstelle zu nutzen.
-
Environment vorbereiten:
# Virtuelle Umgebung erstellen und aktivieren python -m venv venv # Windows venv\Scripts\activate # Linux/macOS source venv/bin/activate
-
Abhängigkeiten installieren:
pip install -r requirements.txt
-
Bot starten:
# Direkt aus dem Projektverzeichnis python -m discord_mcp
get_server_info: Hole detaillierte Server-Informationenlist_members: Liste Server-Mitglieder und ihre Rollen auf
send_message: Sende Nachrichten in einen Kanalread_messages: Lese kürzliche Nachrichten (mit Limit)moderate_message: Lösche Nachrichten und optional Timeout für Nutzer
add_reaction: Füge eine Reaktion zu einer Nachricht hinzuadd_multiple_reactions: Füge mehrere Reaktionen gleichzeitig hinzuremove_reaction: Entferne eine Reaktion von einer Nachricht
create_text_channel: Erstelle einen neuen Textkanaldelete_channel: Lösche einen existierenden Kanal
add_role: Füge einem Nutzer eine Rolle hinzuremove_role: Entferne eine Rolle von einem Nutzer
create_webhook: Create a new webhooklist_webhooks: List webhooks in a channelsend_webhook_message: Send messages via webhookmodify_webhook: Update webhook settingsdelete_webhook: Delete a webhook
-
Set up your Discord bot:
- Create a new application at Discord Developer Portal
- Create a bot and copy the token
- Enable required privileged intents:
- MESSAGE CONTENT INTENT
- PRESENCE INTENT
- SERVER MEMBERS INTENT
- Invite the bot to your server using OAuth2 URL Generator
-
Python Requirements:
- Python 3.8 or higher
- pip (Python package installer)
-
Repository klonen:
git clone https://github.com/yourusername/mcp-discord.git cd mcp-discord -
Virtuelle Umgebung erstellen:
# Windows python -m venv venv venv\Scripts\activate # Linux/macOS python -m venv venv source venv/bin/activate
-
Abhängigkeiten installieren:
pip install -r requirements.txt pip install -e . -
Configure Claude Desktop:
Add this to your claude_desktop_config.json:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"discord": {
"command": "python",
"args": ["-m", "mcp_discord"],
"cwd": "path/to/mcp-discord",
"env": {
"DISCORD_TOKEN": "your_bot_token"
}
}
}
}Note:
- Replace "path/to/mcp-discord" with the actual path to your cloned repository
- Replace "your_bot_token" with your Discord bot token
If you run into issues, check Claude Desktop's MCP logs:
tail -n 20 -f ~/Library/Logs/Claude/mcp*.logCommon issues:
-
Token Errors:
- Verify your Discord bot token is correct
- Check that all required intents are enabled
-
Permission Issues:
- Ensure the bot has proper permissions in your Discord server
- Verify the bot's role hierarchy for role management commands
-
Installation Issues:
- Make sure you're using the correct Python version
- Try recreating the virtual environment
- Check that all dependencies are installed correctly
{
"type": "call_tool",
"tool": "send_message",
"arguments": {
"channel_id": "123456789",
"content": "Hallo Welt!"
}
}{
"type": "call_tool",
"tool": "read_messages",
"arguments": {
"channel_id": "123456789",
"limit": 10
}
}{
"type": "call_tool",
"tool": "add_reaction",
"arguments": {
"channel_id": "123456789",
"message_id": "987654321",
"emoji": "👍"
}
}Häufige Fehler und Lösungen:
-
"Discord client not ready"
- Warte, bis der Bot vollständig gestartet ist
- Überprüfe die Bot-Token-Konfiguration
-
"Channel not found"
- Stelle sicher, dass der Bot Zugriff auf den Kanal hat
- Überprüfe die Channel-ID
-
"Missing permissions"
- Überprüfe die Bot-Berechtigungen im Server
- Stelle sicher, dass die Bot-Rolle ausreichende Rechte hat
Der Server protokolliert detaillierte Informationen:
- Bot-Start und -Status
- Empfangene Befehle
- Fehler und Warnungen
Logs findest du in der Konsolenausgabe oder in den konfigurierten Log-Dateien.
MIT License - siehe LICENSE für Details.
Note: This is a fork of the original mcp-discord repository.