You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mcp: client panics on elicitation/create or notifications/elicitation/complete without params #1314
A Client crashes with a nil pointer dereference when a server sends elicitation/create or notifications/elicitation/complete without params (or with "params": null).
clientMethodInfos marks both methods missingParamsOK, so checkRequest accepts the message and the handler receives a typed-nil Params:
notifications/resources/updated has the same flag. Its built-in handler guards with req.Params != nil, but a user's ResourceUpdatedHandler still receives nil params.
The schema requires params for all three (ElicitRequest, ElicitationCompleteNotification and ResourceUpdatedNotification list it in required). The comment above clientMethodInfos says the flags are extracted from the schema, and the sibling sampling/createMessage is already registered with 0.
The same happens on the wire with {"jsonrpc":"2.0","id":1,"method":"elicitation/create"} from a non-conforming server or proxy. A notification needs no client option at all to reach callElicitationCompleteHandler. No recover in the SDK, so the client process dies.
Expected behavior
The message is rejected as an invalid request, as it is for sampling/createMessage. Handlers never see nil params for these methods.
I have a fix with a regression test and can send a PR.
Activity
mcp: reject server messages missing required params on the client (#1315