Discord channel plugin: MCP server killed before Discord gateway connects (Windows)
Description
The Discord channel plugin (discord@claude-plugins-official v0.0.4) fails to connect on Windows. The MCP server initializes and responds to the initialize handshake, but the process is terminated before client.login() completes the Discord gateway connection (~2-3 seconds).
Environment
- Claude Code: 2.1.98
- OS: Windows 11 Home 10.0.26200
- Runtime: Bun 1.3.11
- discord.js: 14.26.2
- Plugin:
discord@claude-plugins-officialv0.0.4
Steps to reproduce
claude plugin install discord@claude-plugins-official- Configure bot token in
~/.claude/channels/discord/.env claude --channels plugin:discord@claude-plugins-official- Claude Code shows "Listening for channel messages" but the bot never appears online in Discord
- Messages sent to the bot (DM or @mention) are never received
Evidence that the plugin server itself works
Running the server manually with stdin kept open proves the bot connects and receives messages:
(echo '{"jsonrpc":"2.0","method":"initialize","id":1,"params":...}'; sleep 120) \
| DISCORD_BOT_TOKEN="<token>" bun run server.ts
Output:
discord channel: gateway connected as ClaudeBotReborn#2375
The bot goes online in Discord, receives @mentions in server channels, and forwards them as MCP notifications. When run through Claude Code's plugin launcher, the gateway connected message never appears.
Additional test: standalone discord.js bot
A minimal test bot with a raw event listener confirmed:
- Via Claude Code plugin: Zero events received (not even READY)
- Via manual launch: READY, GUILD_CREATE, and MESSAGE_CREATE all fire correctly
Suspected cause
Claude Code's plugin/channel MCP process launcher appears to kill or disconnect the server process before the Discord gateway connection completes. The MCP initialize response is sent immediately, but client.login() is async and takes 2-3 seconds to establish the WebSocket connection to Discord. The process seems to be terminated in that window.
Workaround
None found. The --channels flag is required for inbound message push, so running the bot as a regular MCP server doesn't solve the use case.
Expected behavior
The plugin MCP server process should remain alive after the initialize handshake completes, giving async connections (like Discord's gateway) time to establish.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗