Public declaration syntax from forge-rs/crates/forge-mcp/src/transport.rs Original source SHA-256: bd78963350e09184a385db77f16c1150aedd4d8d9281936ba8daa203bd703128 Function bodies and constant values are omitted. This is not the complete implementation. Source line 228 #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub enum TransportConfig { /// Standard I/O transport (stdin/stdout). /// /// Used when the MCP server is spawned as a child process. Stdio, /// Server-Sent Events transport. /// /// The client receives responses via an SSE stream and sends requests /// via HTTP POST to a companion endpoint. Sse { /// The SSE endpoint URL. url: String, }, /// HTTP POST transport. /// /// Both requests and responses use HTTP POST with JSON bodies. This /// is the simplest transport for stateless MCP servers. Http { /// The HTTP endpoint URL. url: String, }, } Source line 263 pub fn transport_name(&self) -> &'static str; Source line 285 pub fn endpoint_url(&self) -> Option<&str>; Source line 314 #[async_trait] pub trait McpTransport: Send + Sync { /// Sends a JSON-encoded message through the transport. /// /// # Arguments /// /// * `message` - The JSON string to send. /// /// # Errors /// /// Returns `ForgeMcpError::TransportError` if the write fails. async fn send(&self, message: &str) -> ForgeMcpResult<()>; /// Receives the next JSON-encoded message from the transport. /// /// This method blocks (asynchronously) until a message is available /// or the transport is closed. /// /// # Returns /// /// `Ok(Some(message))` if a message was received, `Ok(None)` if the /// transport has been cleanly closed. /// /// # Errors /// /// Returns `ForgeMcpError::TransportError` if the read fails. async fn receive(&self) -> ForgeMcpResult>; /// Closes the transport, releasing any held resources. /// /// After calling `close()`, subsequent `send()` and `receive()` calls /// should return errors. /// /// # Errors /// /// Returns `ForgeMcpError::TransportError` if the close fails. async fn close(&self) -> ForgeMcpResult<()>; } Source line 364 pub struct StdioTransport { } Source line 383 pub fn new() -> Self; Source line 391 pub fn from_streams(reader: R, writer: W) -> Self where R: AsyncRead + Send + 'static, W: AsyncWrite + Send + 'static,; Source line 499 pub struct SseTransport { } Source line 530 pub fn new(url: impl Into) -> Self; Source line 543 pub fn url(&self) -> &str; Source line 731 pub struct HttpTransport { } Source line 756 pub fn new(url: impl Into) -> Self; Source line 766 pub fn url(&self) -> &str; Source line 881 pub fn create_transport(config: &TransportConfig) -> Box;