Skip to content

Commit dbd5ae0

Browse files
committed
test: add tests for priming behavior on stream start and close
1 parent f2cb7f5 commit dbd5ae0

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

crates/rmcp/src/transport/common/server_side_http.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ pub struct ServerSseMessage {
6262
/// The event ID for this message. When set, clients can use this ID
6363
/// with the `Last-Event-ID` header to resume the stream from this point.
6464
pub event_id: Option<String>,
65-
/// The JSON-RPC message content. For priming events, set this to `None`.
65+
/// The JSON-RPC message content. Set to `None` for priming events.
66+
/// See [SEP-1699](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1699)
6667
pub message: Option<Arc<ServerJsonRpcMessage>>,
6768
/// The retry interval hint for clients. Clients should wait this duration
6869
/// before attempting to reconnect. This maps to the SSE `retry:` field.
@@ -81,7 +82,7 @@ pub(crate) fn sse_stream_response(
8182
let data = serde_json::to_string(msg.as_ref()).expect("valid message");
8283
Sse::default().data(data)
8384
} else {
84-
// Priming event: empty data per SSE spec (just "data:\n")
85+
// Priming event: empty data per SEP-1699 (just "data:\n")
8586
Sse::default().data("")
8687
};
8788

crates/rmcp/tests/test_with_js.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ async fn test_with_js_streamable_http_client() -> anyhow::Result<()> {
7272
stateful_mode: true,
7373
sse_keep_alive: None,
7474
cancellation_token: ct.child_token(),
75+
..Default::default()
7576
},
7677
);
7778
let router = axum::Router::new().nest_service("/mcp", service);

0 commit comments

Comments
 (0)