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    /// WebSocket transport
15    WebSocket { port: u16, host: Option<String> },
16}
17
18impl Default for TransportConfig {
19    fn default() -> Self {
20        Self::Stdio
21    }
22}
23
24impl TransportConfig {
25    /// Create stdio transport configuration
26    pub fn stdio() -> Self {
27        Self::Stdio
28    }
29
30    /// Create HTTP transport configuration
31    pub fn http(port: u16) -> Self {
32        Self::Http { port, host: None }
33    }
34
35    /// Create WebSocket transport configuration
36    pub fn websocket(port: u16) -> Self {
37        Self::WebSocket { port, host: None }
38    }
39}