pub struct McpServerConnectionConfig {
pub name: String,
pub transport: TransportTypeId,
pub command: Option<String>,
pub args: Vec<String>,
pub url: Option<String>,
pub config: Value,
pub timeout_secs: u64,
pub env: HashMap<String, String>,
pub restart_policy: RestartPolicy,
}Expand description
Configuration for connecting to an MCP server.
Fields§
§name: StringServer name (identifier)
transport: TransportTypeIdTransport type
command: Option<String>Command to run (for stdio)
args: Vec<String>Command arguments (for stdio)
url: Option<String>URL endpoint (for HTTP/SSE)
config: ValueServer-specific configuration
timeout_secs: u64Connection timeout in seconds
env: HashMap<String, String>Environment variables to set for stdio transport
restart_policy: RestartPolicyRestart policy for handling server failures
Implementations§
Source§impl McpServerConnectionConfig
impl McpServerConnectionConfig
Sourcepub fn stdio(
name: impl Into<String>,
command: impl Into<String>,
args: Vec<String>,
) -> Self
pub fn stdio( name: impl Into<String>, command: impl Into<String>, args: Vec<String>, ) -> Self
Create a stdio server configuration.
Sourcepub fn http(name: impl Into<String>, url: impl Into<String>) -> Self
pub fn http(name: impl Into<String>, url: impl Into<String>) -> Self
Create an HTTP server configuration.
Sourcepub fn with_config(self, config: Value) -> Self
pub fn with_config(self, config: Value) -> Self
Set server-specific configuration.
Sourcepub fn with_timeout(self, timeout_secs: u64) -> Self
pub fn with_timeout(self, timeout_secs: u64) -> Self
Set connection timeout.
Sourcepub fn with_env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn with_env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add an environment variable (for stdio transport).
Sourcepub fn with_restart(self, policy: RestartPolicy) -> Self
pub fn with_restart(self, policy: RestartPolicy) -> Self
Set a custom restart policy.
Sourcepub fn restart_on_failure(self) -> Self
pub fn restart_on_failure(self) -> Self
Enable restart on failure with default settings (unlimited retries).
Sourcepub fn restart_max_attempts(self, attempts: u32) -> Self
pub fn restart_max_attempts(self, attempts: u32) -> Self
Enable restart with a maximum number of attempts.
Trait Implementations§
Source§impl Clone for McpServerConnectionConfig
impl Clone for McpServerConnectionConfig
Source§fn clone(&self) -> McpServerConnectionConfig
fn clone(&self) -> McpServerConnectionConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for McpServerConnectionConfig
impl Debug for McpServerConnectionConfig
Source§impl<'de> Deserialize<'de> for McpServerConnectionConfig
impl<'de> Deserialize<'de> for McpServerConnectionConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for McpServerConnectionConfig
impl RefUnwindSafe for McpServerConnectionConfig
impl Send for McpServerConnectionConfig
impl Sync for McpServerConnectionConfig
impl Unpin for McpServerConnectionConfig
impl UnwindSafe for McpServerConnectionConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more