Skip to content

WIP: mcp: support custom notifications - #1146

Open
delaneyj wants to merge 1 commit into
modelcontextprotocol:mainfrom
delaneyj:custom-notifications
Open

WIP: mcp: support custom notifications#1146
delaneyj wants to merge 1 commit into
modelcontextprotocol:mainfrom
delaneyj:custom-notifications

Conversation

@delaneyj

@delaneyj delaneyj commented Aug 5, 2026

Copy link
Copy Markdown

Protocol extensions can send custom JSON-RPC notifications. The SDK session APIs provide methods only for standard notifications.

This change adds SendNotification to ClientSession and ServerSession. Sending middleware processes each custom notification before transmission.

The implementation preserves arbitrary parameters. It encodes nil parameters as an empty JSON object.

This PR supersedes #844. It updates that implementation for the current Params.isNil interface and adds wire-level tests.

Tests cover:

  • Client-to-server notifications.
  • Server-to-client notifications.
  • Exact wire method names.
  • Arbitrary parameter objects.
  • Nil parameters.

Tests:

go test ./mcp -run '^TestSendNotification$'
go test ./...

Fixes #745

Protocol extensions can define custom JSON-RPC notifications, but the SDK only exposes helpers for standard notifications.

Add SendNotification to client and server sessions. Route custom notifications through sending middleware and preserve arbitrary parameters.

Fixes modelcontextprotocol#745.
@delaneyj
delaneyj force-pushed the custom-notifications branch from 99154e6 to 6863d59 Compare August 5, 2026 14:37
@delaneyj
delaneyj marked this pull request as ready for review August 5, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose generic SendNotification on ServerSession for custom protocol extensions

1 participant