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
feat: add support for custom client notifications (#556)
MCP servers, particularly ones that offer "experimental" capabilities,
may wish to handle custom client notifications that are not part of the
standard MCP specification. This change introduces a new
`CustomClientNotification` type that allows a server to process
such custom notifications.
- introduces `CustomClientNotification` to carry arbitrary methods/params while
still preserving meta/extensions; wires it into the `ClientNotification` union
and `serde` so `params` can be decoded with `params_as`
- allows server handlers to receive custom notifications via a new
`on_custom_notification` hook
- adds integration coverage that sends a custom client notification end-to-end
and asserts the server sees the method and payload
Test:
```shell
cargo test -p rmcp --features client test_custom_client_notification_reaches_server
```
Copy file name to clipboardExpand all lines: crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema.json
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -396,6 +396,19 @@
396
396
"content"
397
397
]
398
398
},
399
+
"CustomClientNotification": {
400
+
"description": "A catch-all notification the client can use to send custom messages to a server.\n\nThis preserves the raw `method` name and `params` payload so handlers can\ndeserialize them into domain-specific types.",
401
+
"type": "object",
402
+
"properties": {
403
+
"method": {
404
+
"type": "string"
405
+
},
406
+
"params": true
407
+
},
408
+
"required": [
409
+
"method"
410
+
]
411
+
},
399
412
"ElicitationAction": {
400
413
"description": "Represents the possible actions a user can take in response to an elicitation request.\n\nWhen a server requests user input through elicitation, the user can:\n- Accept: Provide the requested information and continue\n- Decline: Refuse to provide the information but continue the operation\n- Cancel: Stop the entire operation",
Copy file name to clipboardExpand all lines: crates/rmcp/tests/test_message_schema/client_json_rpc_message_schema_current.json
+16Lines changed: 16 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -396,6 +396,19 @@
396
396
"content"
397
397
]
398
398
},
399
+
"CustomClientNotification": {
400
+
"description": "A catch-all notification the client can use to send custom messages to a server.\n\nThis preserves the raw `method` name and `params` payload so handlers can\ndeserialize them into domain-specific types.",
401
+
"type": "object",
402
+
"properties": {
403
+
"method": {
404
+
"type": "string"
405
+
},
406
+
"params": true
407
+
},
408
+
"required": [
409
+
"method"
410
+
]
411
+
},
399
412
"ElicitationAction": {
400
413
"description": "Represents the possible actions a user can take in response to an elicitation request.\n\nWhen a server requests user input through elicitation, the user can:\n- Accept: Provide the requested information and continue\n- Decline: Refuse to provide the information but continue the operation\n- Cancel: Stop the entire operation",
0 commit comments