GeezerVison is showing github.com — [FEATURE]: Surface MCP server->client custom notifications to the session (push wake-up) · Issue #48855 · anomalyco/opencode
[FEATURE]: Surface MCP server->client custom notifications to the session (push wake-up) #48855DescriptionSummary
opencode's MCP client drops every server->client notification except notifications/message (forwarded to the logger) and notifications/tools/list_changed (triggers a tool re-list). Custom notifications like notifications/termgram/message, plus notifications/progress, are received then silently discarded — there is no path for a push-style MCP server to reach the session, the model, or plugin hooks.
This makes it impossible to build an MCP server that asynchronously wakes the agent (e.g. a Telegram assistant server pushing "new message arrived, reply now"). The only workaround today is client-polling tools (wait/watch loops), which are time-boxed (60–110s) and never fire mid-task.
Current behavior
packages/opencode/src/mcp/index.ts (~line 456):
client.setNotificationHandler(LoggingMessageNotificationSchema, …) → routes to serverLog() / the opencode logger
client.setNotificationHandler(ToolListChangedNotificationSchema, …) → re-fetch tool defs, publish ToolsChanged
No other setNotificationHandler is registered, so custom and progress notifications fall through silently.
Expected behavior
- Custom
notifications/* from an MCP server should not be dropped: at minimum they should be observable (plugin hook / session event bus / SSE stream) with their method + params intact.
- A defined path for a notification to wake the session — forwarded as a steer/synthetic user turn so the current agent model gets it, subject to a per-server opt-in (capability or a session-level setting) so a noisy server cannot spam the model.
Use case
termgram (a personal Telegram MTProto MCP server, grammers-based) already pushes notifications/termgram/message with { chat, id, at, out, from, text, media } on every incoming message via the MCP protocol (verified working with a probe client; Peer::send_notification on rmcp 3.3). The agent never sees it. The goal: someone messages me on Telegram → opencode surfaces it → the assistant replies.
Related issues
Environment
- opencode (CLI, current stable at time of report),
termgram MCP server as local stdio transport, rmcp 3.3, protocol 2025-06-18
- Linux x86_64
- Existing
wait tool clamps timeout 1–110s — there is no unbounded wait, so polling cannot substitute for push
Activityopencodejr commented on Oct 28, 2026 Thanks for the detailed write-up, @liagha!
To restate the request: OpenCode should stop dropping custom MCP server→client notifications (e.g. notifications/termgram/message, notifications/progress). They should at least be observable with method and params intact. As an opt-in for each server, they could also wake the session as an injected turn, so a push-style server can trigger the agent.
The current v2 MCP client (packages/core/src/mcp/client.ts) works the same way you describe. It only handles roots, elicitation and list-changed notifications, and drops everything else. The plugin API doesn't have a hook for incoming MCP notifications yet, so this can't be built as a plugin today either. Maintainers will consider it.
Related issues:
mattroe commented on Nov 16, 2026 OpenCode 2 now has a standard path for this. Since v2.3.0 (#63254, #63269), with the experimental mcp_events flag on, opencode subscribes to a server's MCP Events (SEP-3415) over events/stream: the model calls watch_mcp_event, and each event wakes the session with a message. A watch stops after one event unless it's started with once: false, which matters for a Telegram inbox. So termgram would serve SEP-3415 events with push instead of a custom notification. OpenCode 1, which the default installer still gives, doesn't have it, and we haven't run it end to end or over stdio.
I'm building Wakeshift (MCP Events for MCP servers) and keep track of which clients subscribe: https://wakeshift.ai/blog/state-of-mcp-events-2026-11
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|