Discord音乐机器人

一个功能强大的Discord音乐机器人,集成了Claude AI和MCP协议,支持自然语言控制、音乐播放和AI聊天功能。

  • by AkbulutMirac
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 AkbulutMirac/Mcp-Discord-Multifunctional-Bot

使用说明

🎵 Discord Music Bot with MCP Integration

A powerful Discord music bot that integrates with Claude AI via the Model Context Protocol (MCP). Control your Discord bot using natural language through Claude Desktop or Claude Mobile!

✨ Features

🎶 Music Playback

  • Play music from YouTube with high-quality audio
  • Queue management (add, remove, clear, view)
  • Playback controls (play, pause, resume, skip, stop)
  • Auto-play next song in queue

🤖 MCP Integration (Claude AI Control)

  • Control the bot via Claude Desktop or Claude Mobile
  • Natural language commands ("play some jazz music", "skip this song")
  • Auto-join: Bot finds you in voice channels automatically

🗣️ Voice & AI

  • Text-to-Speech in Turkish (TTS)
  • AI chat with memory using Google Gemini
  • Translation to Turkish

📋 Requirements

🚀 Installation

1. Clone the repository

git clone https://github.com/AkbulutMirac/Mcp-Discord-Multifunctional-Bot.git 
cd Mcp-Discord-Multifunctional-Bot

2. Install dependencies

pip install -r requirements.txt

3. Configure environment variables

Create a .env file in the project root (copy from .env.example):

GEMINI_API_KEY=your_gemini_api_key_here
BOT_TOKEN=your_discord_bot_token_here
CHANNEL_ID=your_default_channel_id_here
VOICE_ID=your_default_voice_channel_id_here
OWNER_ID=your_discord_user_id_here

4. Install FFmpeg

  • Windows: Download from ffmpeg.org and add to PATH
  • macOS: brew install ffmpeg
  • Linux: sudo apt install ffmpeg

🎮 Usage

Running Modes

Mode Command Description
Discord Only python dc_bot_mcp.py Run as a regular Discord bot
MCP (stdio) python dc_bot_mcp.py --mode mcp For Claude Desktop (local)
MCP (HTTP) python dc_bot_mcp.py --mode http For remote access / Cloudflare Tunnel

Discord Commands

🎵 Queue Management

Command Description
!add <song> Add a song to the queue
!remove <name> Remove a song from the queue
!clear Clear the entire queue
!queue Show the current queue

▶️ Playback Controls

Command Description
!play <song> Play a song or the queue
!pause Pause playback
!resume Resume playback
!skip Skip to the next song
!stop Stop playback and clear queue

🗣️ Voice & AI

Command Description
!speak <text> Bot speaks text in Turkish (TTS)
!translate <text> Translate text to Turkish
!chat <message> Chat with Gemini AI

🔊 Voice Channel

Command Description
!join Bot joins your voice channel
!leave Bot leaves the voice channel
!help Show help message

🔗 MCP Setup (Claude AI Integration)

Claude Desktop Configuration

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "discord-bot": {
      "command": "python",
      "args": ["C:\\path\\to\\dc_bot_mcp.py", "--mode", "mcp"]
    }
  }
}

Remote Access (Mobile/Cloudflare Tunnel)

  1. Start the bot in HTTP mode:
python dc_bot_mcp.py --mode http --port 9000
  1. Create a Cloudflare Tunnel:
cloudflared tunnel --url http://localhost:9000
  1. Add the tunnel URL to Claude Mobile:
    • Settings → MCP → Add Server
    • URL: https://your-tunnel-url.trycloudflare.com/sse

Available MCP Tools

Tool Description
play_music Play a song on Discord
stop_music Stop playback
pause_music Pause playback
resume_music Resume playback
skip_song Skip to next song
add_to_queue Add song to queue
get_queue View current queue
clear_queue Clear the queue
speak_text TTS in Turkish
chat_with_ai Chat with Gemini
translate_text Translate to Turkish
auto_join Auto-find and join your channel
list_servers List available voice channels
get_playback_status Check what's playing

📁 Project Structure

discord-mcp-bot/
├── dc_bot_mcp.py      # Main bot file
├── requirements.txt   # Python dependencies
├── .env.example       # Example environment file
└── README.md          # This file

⚠️ Notes

  • Ensure FFmpeg is installed and added to your system PATH
  • The bot requires permissions: Connect, Speak, Read Messages, Send Messages
  • AI chat memory resets when the bot restarts
  • MCP integration requires Claude Desktop

📄 License

MIT License - feel free to use and modify!

🤝 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.


Made by Mirage