pulseengine_mcp_transport/
config.rs

1//! Transport configuration
2
3use serde::{Deserialize, Serialize};
4
5/// Transport configuration
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub enum TransportConfig {
8    /// Standard I/O transport (for MCP clients)
9    Stdio,
10
11    /// HTTP transport with Server-Sent Events
12    Http { port: u16, host: Option<String> },
13
14    /// Streamable HTTP transport (MCP Inspector compatible)
15    StreamableHttp { port: u16, host: Option<String> },
16
17    /// WebSocket transport
18    WebSocket { port: u16, host: Option<String> },
19}
20
21impl Default for TransportConfig {
22    fn default() -> Self {
23        Self::Stdio
24    }
25}
26
27impl TransportConfig {
28    /// Create stdio transport configuration
29    pub fn stdio() -> Self {
30        Self::Stdio
31    }
32
33    /// Create HTTP transport configuration
34    pub fn http(port: u16) -> Self {
35        Self::Http { port, host: None }
36    }
37
38    /// Create Streamable HTTP transport configuration (MCP Inspector compatible)
39    pub fn streamable_http(port: u16) -> Self {
40        Self::StreamableHttp { port, host: None }
41    }
42
43    /// Create WebSocket transport configuration
44    pub fn websocket(port: u16) -> Self {
45        Self::WebSocket { port, host: None }
46    }
47}