Skip to main content
Glama

discord-music-mcp

An MCP server that lets Claude (or any MCP client) play music in your Discord voice channel.

"Play some lo-fi in the Lobby" β†’ 🎢

πŸ“š Learning MCP? This repo is also a commented, step-by-step tutorial (Turkish): docs/TUTORIAL.tr.md.


How it relates to Discord YouTube DJ

This repo is not a Discord bot. It's a small adapter in front of Discord YouTube DJ, the self-hosted bot that does the actual work.

 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  stdio (JSON-RPC)  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  HTTP 127.0.0.1:1231  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
 β”‚ Claude Desktop / β”‚ ─────────────────► β”‚ discord-music-mcpβ”‚ ────────────────────► β”‚ Discord YouTube DJ   β”‚ ─────► β”‚ Discord β”‚
 β”‚ Claude Code      β”‚ ◄───────────────── β”‚ (this repo)      β”‚ ◄──────────────────── β”‚ bot (other repo)     β”‚  voice β”‚         β”‚
 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  • Claude starts this server as a child process when it needs it. You don't run it yourself.

  • This server turns tool calls (play_song, stop_music, …) into requests to the bot's local API.

  • The bot holds the Discord token and joins voice channels. This repo never sees or needs your Discord token.

  • Because the bot only accepts connections from 127.0.0.1, this server must run on the same computer as the bot.

discord-youtube-dj

discord-music-mcp (this repo)

Talks to Discord

βœ…

❌

Needs the bot token

βœ… (entered once in its dashboard)

❌

Runs

all the time (starts with Windows)

only while Claude uses it

Required

βœ…

optional


Related MCP server: YouTube Search & Download MCP Server

What you need

Item

Needed?

Secret?

Where you get it

Discord YouTube DJ installed, set up, and running

βœ…

β€”

Follow its README. The bot must be invited to a server, and the dashboard at http://localhost:1231 should show "Online".

Node.js 20+

βœ…

β€”

nodejs.org. The Windows installer of the bot bundles its own Node, but this repo needs a normal install.

git

βœ…

β€”

git-scm.com (or download this repo as a ZIP)

An MCP client

βœ…

β€”

Claude Desktop, Claude Code, or any other MCP client

Bot address

only if not default

no

http://localhost:1231 by default. Set MUSIC_BOT_URL only if you changed the bot's port.

Not needed: no Discord token, no client secret, no API keys, no server or channel IDs. You refer to channels by name ("Lobby"). Channel IDs also work: enable Discord Settings β†’ Advanced β†’ Developer Mode, then right-click a channel β†’ Copy Channel ID.


Setup

1. Get the code

git clone https://github.com/cengizhanpece/discord-music-mcp
cd discord-music-mcp
npm install

Note the full path of src/index.js. You'll need it below, e.g. C:\Users\you\discord-music-mcp\src\index.js or /home/you/discord-music-mcp/src/index.js.

2. Check that it can reach the bot

npm test

You should see the list of tools followed by your voice channels. If you see "Could not reach the Discord YouTube DJ bot", start the bot first.

3. Connect it to your MCP client

Claude Code:

claude mcp add discord-music -- node "C:\full\path\to\discord-music-mcp\src\index.js"

Then run /mcp inside Claude Code to confirm it's connected.

Claude Desktop: open Settings β†’ Developer β†’ Edit Config (this opens claude_desktop_config.json) and add:

{
  "mcpServers": {
    "discord-music": {
      "command": "node",
      "args": ["C:\\full\\path\\to\\discord-music-mcp\\src\\index.js"]
    }
  }
}

On Windows, write the path with double backslashes (\\) as shown. Fully quit Claude Desktop (including the tray icon) and reopen it.

Non-default bot port: if you changed the bot's port, add the address to the config. MCP clients don't pass your terminal's environment variables to the server, so it has to go in the config:

claude mcp add discord-music -e MUSIC_BOT_URL=http://localhost:4000 -- node "C:\full\path\to\discord-music-mcp\src\index.js"
"discord-music": {
  "command": "node",
  "args": ["C:\\full\\path\\to\\discord-music-mcp\\src\\index.js"],
  "env": { "MUSIC_BOT_URL": "http://localhost:4000" }
}

4. Try it

"Which voice channels can you play in?" "Play Daft Punk – Get Lucky in the Lobby." "Search for three versions of Kuzu Kuzu and let me pick." "What's playing?" / "Stop the music."

Updating

cd discord-music-mcp
git pull
npm install

Restart Claude Desktop, or run /mcp β†’ reconnect in Claude Code.


What it can do

Tool

Description

play_song

Play a URL or the top YouTube result for a search. Optional channel (name or ID; partial names work) and guild. If a name matches several channels, it asks which one.

search_songs

Search YouTube and list results without playing.

list_voice_channels

List servers and voice channels the bot can join.

now_playing

What's playing, and where.

stop_music

Stop and leave the voice channel.

Also: resource discord://voice-channels and prompt dj ("pick something that fits a mood and play it").

Troubleshooting

Symptom

Fix

Could not reach the Discord YouTube DJ bot

Start the bot (Start menu β†’ Discord YouTube DJ). Check that http://localhost:1231 opens.

The bot is not connected to Discord yet

Finish the bot's setup in its dashboard (token + invite).

πŸ”’ channel / "The bot can't play in …"

The bot has no access to that private channel. See Private voice channels.

No voice channel selected

Name a channel in your request, or pick one in the bot's dashboard.

Server doesn't show up in Claude

Check the path to src/index.js. Run node "<path>" yourself: it should print [music-mcp] …ready and wait. Press Ctrl+C to exit.

Wrong port / 404 errors

Set MUSIC_BOT_URL in the MCP config (see above). Environment variables from your shell are not passed through.

Development

node scripts/test-client.js search "daft punk"     # a ~40-line MCP client, see how a host talks to the server
node scripts/test-client.js play "daft punk get lucky"
npm run inspect                                     # MCP Inspector UI

Logs go to stderr. stdout is reserved for the JSON-RPC stream.

License

MIT

Available Tools

5 tools
list_voice_channelsSes kanallarΔ±nΔ± listeleA
Read-only

Botun erişebildiği tüm Discord sunucularını ve ses kanallarını listeler. Kullanıcı bir kanaldan bahsettiğinde ve hangisi olduğu belirsizse kullan.

Inputs: guild.

now_playingŞu an ne çalıyor?B
Read-only

Botun bağlı olduğu kanalı ve çalan şarkıyı gâsterir.

Inputs: no named parameters.

play_songŞarkı çalA

Discord ses kanalında bir şarkı çalmaya başlar (o an çalanı keser). Ya doğrudan bir URL (YouTube, SoundCloud vb.) ya da arama metni ver; arama metni verilirse ilk YouTube sonucu çalınır. channel verilmezse bot en son kullanılan kanalda çalar.

Inputs: song (required), guild, channel.

search_songsYouTube'da şarkı araA
Read-only

YouTube'da arama yapar ve sonuΓ§larΔ± (başlΔ±k, kanal, sΓΌre, URL) dΓΆndΓΌrΓΌr. Bir şey Γ‡ALMAZ. KullanΔ±cΔ± seΓ§enek gΓΆrmek istediğinde ya da doğru versiyondan emin olmak istediğinde kullan; sonra play_song'a seΓ§ilen URL'yi ver.

Inputs: query (required), limit.

stop_musicMüziği durdurA
Idempotent

Γ‡alan mΓΌziği durdurur ve botu ses kanalΔ±ndan Γ§Δ±karΔ±r.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 5 tools

    Disambiguation4/5

    Most tools target distinct actions: list channels, search, play, stop, and status. The main overlap is that play_song can accept a search text and play the first result, which could be confused with search_songs, but descriptions clearly guide the agent to use search_songs for selecting options.

    Naming Consistency4/5

    Names mostly follow a snake_case verb_noun pattern (list_voice_channels, search_songs, play_song), but now_playing is not verb-first and stop_music uses 'music' while others use 'song'/'songs'. Minor deviations keep it readable but slightly inconsistent.

    Tool Count5/5

    Five tools is well within the ideal range and each tool has a clear, non-redundant role in the music playback workflow. No obvious bloat or missing count-driven concerns.

    Completeness2/5

    The surface covers basic play, stop, search, and status, but omits common music bot operations like queue management, skip, pause/resume, and volume control. These gaps will cause agent failures for typical user requests, such as skipping a track or adding to a queue.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers