[BUG] Discord channel plugin: MCP connected but inbound DMs never delivered to session (detailed root cause analysis)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet (related: #36460, #36503)
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
The Discord channel plugin (discord@claude-plugins-official) connects to Discord Gateway successfully, MCP tools work (fetch/reply), but inbound DMs are never pushed to the Claude Code session. The bot appears online (green) in Discord, manual fetch_messages and reply work perfectly, but the session never receives automatic notifications when a user sends a DM.
Additionally, the status bar shows "Channels are not currently available" even though the MCP server is functional.
What Should Happen?
When a user DMs the bot, the message should be delivered to the active Claude Code session as an inbound notification, triggering an automatic response.
Root Cause Analysis
Through extensive debugging, I identified three separate issues compounding into this behavior:
1. DISABLE_TELEMETRY env var blocks channels entirely
If DISABLE_TELEMETRY is set to any value (even "0" or "false"), the channels feature is disabled. The check appears to be existence-based rather than value-based.
Evidence:
- With DISABLE_TELEMETRY=true: status bar shows "Channels are not currently available"
- With DISABLE_TELEMETRY unset: no error (but inbound still does not work, see issue 2 and 3)
Complication: Many developers set DISABLE_TELEMETRY=true in shell configs for privacy across various tools. This common pattern should not break channel functionality.
Suggestion: Use a Claude-specific variable like CLAUDE_CODE_DISABLE_CHANNELS=true instead of piggybacking on a generic telemetry flag.
2. MCP server marked "failed" due to stderr DeprecationWarning
The Discord plugin MCP server outputs a DeprecationWarning from discord.js to stderr on startup:
discord channel: gateway connected as HypeproofClaude#6812
DeprecationWarning: The ready event has been renamed to clientReady...
Claude Code interprets any stderr output as a server error, marking the MCP as "failed" in /plugin UI. This is the known issue from #17653.
Evidence:
claude --debug --debug-file /tmp/debug.log mcp listshows:plugin:discord:discord: Connected- But /plugin UI shows:
discord MCP - failed
Redirecting stderr (2>/dev/null) in package.json makes the "failed" indicator disappear, but may break MCP communication.
3. Inbound notifications not delivered even when MCP is connected
Even after resolving issues 1 and 2, inbound DMs are never delivered to the session. The MCP tools work fine for manual operations:
- fetch_messages(channel) returns messages correctly
- reply(chat_id, text) sends messages correctly
- But channel source="discord" notification never appears in session
This appears to be the core issue: the channels subsystem does not subscribe to MCP server notifications even when the server is running and connected.
Error Messages/Logs
Debug log from claude --debug --debug-file:
MCP server "plugin:discord:discord": Starting connection with timeout of 30000ms
MCP server "plugin:discord:discord": Successfully connected to undefined server in 2040ms
MCP server "plugin:discord:discord": Connection established with capabilities: {"hasTools":true,"hasPrompts":false,"hasResources":false,"hasResourceSubscribe":false,"serverVersion":{"name":"discord","version":"1.0.0"}}
Status bar message: Channels are not currently available
Steps to Reproduce
- Install Discord plugin:
/plugin install discord@claude-plugins-official - Configure token:
/discord:configure <bot-token> - Ensure bun is installed and in PATH
- Start session:
claude --channels plugin:discord@claude-plugins-official - Observe status bar: "Channels are not currently available" (if DISABLE_TELEMETRY is set)
- Even after unsetting DISABLE_TELEMETRY and restarting:
- Bot appears online in Discord (green indicator)
mcp listshows Connected/pluginshows MCP failed (due to stderr)- DM the bot: no response, no notification in session
- Manual fetch_messages: messages visible
- Manual reply: message sent successfully
Claude Code Version
2.1.81 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal (Antigravity fork) + Terminal.app, zsh
Is this a regression?
I don't know
Additional Information
- Model: Opus 4.6 (1M context)
- macOS: Darwin 24.6.0
- Bun: 1.3.11
- Discord.js: 14.25.1
- Plugin version: discord@claude-plugins-official 0.0.2
- Related issues: #36460 (Max plan channels unavailable), #36503 (inbound notifications ignored), #17653 (stderr causes MCP "failed")
- The DISABLE_TELEMETRY workaround was found via community reports on X (Twitter)
- The MCP "failed" indicator from stderr is cosmetic but confusing
- The core issue (inbound not delivered) persists regardless of the other two issues being resolved
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗