Skip to content

MCP server: notifications/* typos silently swallowed without warning #1895

Description

@Widthdom

Summary

McpServer.cs:140, 145 hardcodes recognition of notifications/initialized and notifications/cancelled only. Any other method name starting with notifications/ is silently swallowed (no response, no log) — including likely client typos (notifications/cancellation, notifications/initalized) or future spec additions. Per JSON-RPC §3 the server MUST NOT reply to notifications, but it should at least log unknown notification methods so client integration bugs surface.

Note: #186 reports the inverse-shaped bug (server replies to unknown notifications with -32601 + id:null). If #186 has since been fixed, the swallow path may now be the active behaviour — verify before fixing.

Where

Suggested approach

(1) Build a whitelist of known notification methods (notifications/initialized, notifications/cancelled, future: notifications/progress, notifications/message). Any other notifications/* method should be logged at WARN level with the method name so client typos surface in the MCP server log. (2) Don't reply (preserve §3 compliance) but record the invocation. (3) Add a --strict-notifications flag for debugging that promotes unknown notifications to a server-side error log entry surfaced via the suggestion store (cross-link C504). (4) Add regression tests: known notifications dispatch correctly, unknown notifications produce a log entry but no response, malformed notifications get logged. (5) Cross-link with #186, #1780, #1684, and the just-filed C511/C512 (other MCP transport issues).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions