claude-code - 💡(How to fix) Fix Stable API for channel plugins to send notifications/claude/channel [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48177Fetched 2026-04-15 06:31:00
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

We're building MCP channel plugins that push messages into Claude Code sessions via notifications/claude/channel. We have two use cases:

  1. slack-channel-plugin: Bridges Slack messages into Claude Code sessions in real time (Socket Mode, event bus, channel notification). Already published and working.

  2. intercom (in development): Agent-to-agent communication between independent Claude Code sessions. Lets multiple Claude Code instances (e.g., one managing training runs, another doing data preprocessing) send messages to each other, delivered as channel notifications. Identity is derived from tmux window names; messages flow through a shared JSONL event bus.

Both plugins need to send notifications/claude/channel to push messages into the active session.

Root Cause

We're building MCP channel plugins that push messages into Claude Code sessions via notifications/claude/channel. We have two use cases:

  1. slack-channel-plugin: Bridges Slack messages into Claude Code sessions in real time (Socket Mode, event bus, channel notification). Already published and working.

  2. intercom (in development): Agent-to-agent communication between independent Claude Code sessions. Lets multiple Claude Code instances (e.g., one managing training runs, another doing data preprocessing) send messages to each other, delivered as channel notifications. Identity is derived from tmux window names; messages flow through a shared JSONL event bus.

Both plugins need to send notifications/claude/channel to push messages into the active session.

Fix Action

Fix / Workaround

The current workaround is bypassing the SDK entirely and writing raw JSON-RPC to a private internal:

Code Example

notification = types.JSONRPCNotification(
    jsonrpc="2.0",
    method="notifications/claude/channel",
    params={"content": "sender: message text", "meta": {...}},
)
raw_msg = SessionMessage(message=types.JSONRPCMessage(notification))
await _session._write_stream.send(raw_msg)
RAW_BUFFERClick to expand / collapse

Context

We're building MCP channel plugins that push messages into Claude Code sessions via notifications/claude/channel. We have two use cases:

  1. slack-channel-plugin: Bridges Slack messages into Claude Code sessions in real time (Socket Mode, event bus, channel notification). Already published and working.

  2. intercom (in development): Agent-to-agent communication between independent Claude Code sessions. Lets multiple Claude Code instances (e.g., one managing training runs, another doing data preprocessing) send messages to each other, delivered as channel notifications. Identity is derived from tmux window names; messages flow through a shared JSONL event bus.

Both plugins need to send notifications/claude/channel to push messages into the active session.

Problem

The MCP Python SDK's ServerNotification is a closed pydantic union that only includes built-in notification methods (notifications/cancelled, notifications/progress, etc.). Sending notifications/claude/channel through the normal session.send_notification() path fails pydantic validation.

The current workaround is bypassing the SDK entirely and writing raw JSON-RPC to a private internal:

notification = types.JSONRPCNotification(
    jsonrpc="2.0",
    method="notifications/claude/channel",
    params={"content": "sender: message text", "meta": {...}},
)
raw_msg = SessionMessage(message=types.JSONRPCMessage(notification))
await _session._write_stream.send(raw_msg)

This accesses _session._write_stream, a private attribute that could change or break in any SDK update.

Ask

Either:

  1. Expose a public method on the MCP server session for sending custom/arbitrary notifications (e.g., session.send_custom_notification(method, params))
  2. Open up the ServerNotification union in the MCP SDK to accept arbitrary notifications/* methods, which is already valid per the MCP spec

This would make channel plugin development significantly less fragile. The notifications/claude/channel pattern is powerful and enables a whole class of real-time integrations beyond what tools and resources can do alone.

extent analysis

TL;DR

To fix the issue, the MCP Python SDK needs to either expose a public method for sending custom notifications or open up the ServerNotification union to accept arbitrary notifications/* methods.

Guidance

  • The current workaround bypassing the SDK and writing raw JSON-RPC is fragile and may break with SDK updates.
  • To mitigate this, the MCP SDK could introduce a session.send_custom_notification(method, params) method to allow sending custom notifications.
  • Alternatively, the ServerNotification union could be modified to accept arbitrary notifications/* methods, aligning with the MCP spec.
  • Before implementing a fix, verify that the proposed solution aligns with the MCP specification and does not introduce any security vulnerabilities.

Example

# Proposed public method for sending custom notifications
class Session:
    def send_custom_notification(self, method, params):
        notification = types.JSONRPCNotification(
            jsonrpc="2.0",
            method=method,
            params=params,
        )
        raw_msg = SessionMessage(message=types.JSONRPCMessage(notification))
        await self._write_stream.send(raw_msg)

Notes

The proposed solutions assume that the MCP SDK maintainers are open to introducing changes to support custom notifications. The fix should be carefully reviewed to ensure it does not introduce any security risks or break existing functionality.

Recommendation

Apply a workaround by introducing a session.send_custom_notification(method, params) method, as this seems to be a more targeted and less invasive change compared to modifying the ServerNotification union.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Stable API for channel plugins to send notifications/claude/channel [1 participants]