The streamable-http client transport negotiates an Mcp-Session-Id during initialize and keeps it in the internal worker (src/transport/streamable_http_client.rs), but there is no public accessor to read it from the RunningService / transport handle after connecting.
Use case
Telemetry / observability: correlate a client-side invocation with the MCP session it actually used, and debug multi-call sessions. Today a client has no supported way to learn the session id its own transport negotiated.
Request
A public accessor to read the current negotiated session id post-initialize, e.g.:
impl<C> StreamableHttpClientTransport<C> {
pub fn session_id(&self) -> Option<Arc<str>> { /* ... */ }
}
or surface it via RunningService / Peer so it is reachable from serve_client(...) results.
Current workaround
Implement a custom StreamableHttpClient and snoop the session_id parameter that rmcp passes to post_message / get_stream. This works but is indirect, only applies to custom-client setups, and misses the id on the very first (initialize) call.
Version
rmcp 1.7.0
Happy to send a PR if the maintainers agree on the shape (accessor on the transport vs. on RunningService).
The streamable-http client transport negotiates an
Mcp-Session-Idduringinitializeand keeps it in the internal worker (src/transport/streamable_http_client.rs), but there is no public accessor to read it from theRunningService/ transport handle after connecting.Use case
Telemetry / observability: correlate a client-side invocation with the MCP session it actually used, and debug multi-call sessions. Today a client has no supported way to learn the session id its own transport negotiated.
Request
A public accessor to read the current negotiated session id post-
initialize, e.g.:or surface it via
RunningService/Peerso it is reachable fromserve_client(...)results.Current workaround
Implement a custom
StreamableHttpClientand snoop thesession_idparameter that rmcp passes topost_message/get_stream. This works but is indirect, only applies to custom-client setups, and misses the id on the very first (initialize) call.Version
rmcp 1.7.0
Happy to send a PR if the maintainers agree on the shape (accessor on the transport vs. on
RunningService).