rtb_mcp/transport.rs
1//! The [`Transport`] enum — choice of MCP wire transport.
2
3use std::net::SocketAddr;
4
5/// MCP transport selection.
6///
7/// `Stdio` is the default: the server reads JSON-RPC messages from
8/// stdin and writes responses to stdout. This is what MCP clients
9/// expect when they spawn a server as a subprocess.
10///
11/// `Sse` and `Http` are listed for forward-compatibility with the
12/// approved `rtb-mcp v0.1` spec but are stubbed in this release —
13/// invoking them returns [`crate::McpError::Transport`]. The full
14/// `rmcp::transport::streamable_http_server` wiring (which
15/// supersedes the standalone SSE transport in `rmcp` 0.16) lands in
16/// a v0.3.x point release.
17#[derive(Debug, Clone, Default)]
18#[non_exhaustive]
19pub enum Transport {
20 /// stdin/stdout transport — the default.
21 #[default]
22 Stdio,
23 /// HTTP+SSE on the supplied bind address. **Not yet implemented.**
24 Sse {
25 /// Address to bind to (e.g. `127.0.0.1:0`).
26 bind: SocketAddr,
27 },
28 /// Streamable HTTP on the supplied bind address. **Not yet implemented.**
29 Http {
30 /// Address to bind to (e.g. `127.0.0.1:0`).
31 bind: SocketAddr,
32 },
33}