`subscriptions/listen` accepts a request missing the required `notifications` field
Describe the bug
When a subscriptions/listen request omits the required notifications field, the Go SDK server does not reject the request with an error. Instead, the request is handled as if it specified an empty subscription set: the server sends a notifications/subscriptions/acknowledged notification with notifications: {} and opens a long-lived stream with zero active subscriptions.
The 2026-07-28 draft schema defines notifications as a required field on SubscriptionsListenRequestParams:
export interface SubscriptionsListenRequestParams extends RequestParams {
notifications: SubscriptionFilter;
}
A request that omits a required field in params should receive a JSON-RPC error (for example, -32602 Invalid params), rather than being treated as a valid stream-establishment request.
Environment tested:
mainsnapshot from 2026-06-28:65ece5964304528e7568507e2b17351824ef73fc- Server used:
conformance/everything-server - Transport: stdio
To Reproduce
Steps to reproduce the behavior:
- Start the Go SDK stdio server.
- Send a
server/discoverrequest using the 2026-07-28 per-request_metafields. - Send a
subscriptions/listenrequest with_metabut without thenotificationsfield:
{"jsonrpc":"2.0","id":1001,"method":"subscriptions/listen","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientInfo":{"name":"repro","version":"0.1.0"},"io.modelcontextprotocol/clientCapabilities":{}}}}
- Observe the server response.
Expected behavior
The server should reject the request with a JSON-RPC error indicating that the required notifications field is missing from params.
Observed behavior
The server sends a notifications/subscriptions/acknowledged notification with an empty subscription set:
{"jsonrpc":"2.0","method":"notifications/subscriptions/acknowledged","params":{"_meta":{"io.modelcontextprotocol/subscriptionId":1001},"notifications":{}}}
The stream stays open with zero subscriptions until the process exits. The server remains healthy (post-health server/discover succeeds).
Additional context
In mcp/protocol.go, SubscriptionsListenParams declares Notifications as a non-pointer value type:
type SubscriptionsListenParams struct {
Meta `json:"_meta,omitempty"`
Notifications NotificationSubscriptions `json:"notifications"`
}
Because Notifications is a non-pointer struct field, the decoded request contains the zero value NotificationSubscriptions{} when the field is absent from the JSON input. The handler then passes that value to allowedSubscriptions:
func (s *Server) subscriptionsListen(ctx context.Context, req *SubscriptionsListenRequest) (*emptyResult, error) {
// ...
allowed := s.allowedSubscriptions(req.Params.Notifications) // zero-value {} accepted
The allowedSubscriptions function processes the empty struct, returns an empty filter, and the handler proceeds to send the acknowledgement notification with notifications: {}.
I am interested in contributing to this bug
@cclabadmin thank you for reporting, the bug has been fixed in PR #1050