pub struct McpServerConfig {
pub name: String,
pub transport: McpTransportConfig,
pub auto_connect: bool,
}Expand description
MCP 服务器配置
定义单个 MCP 服务器的完整配置
Fields§
§name: String服务器名称 (用于标识)
transport: McpTransportConfig传输配置
auto_connect: bool是否自动连接
Implementations§
Source§impl McpServerConfig
impl McpServerConfig
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
创建 Stdio 类型的 MCP 服务器配置
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
设置环境变量 (仅对 Stdio 有效)
Sourcepub fn with_auto_connect(self, auto_connect: bool) -> Self
pub fn with_auto_connect(self, auto_connect: bool) -> Self
设置是否自动连接
Trait Implementations§
Source§impl Clone for McpServerConfig
impl Clone for McpServerConfig
Source§fn clone(&self) -> McpServerConfig
fn clone(&self) -> McpServerConfig
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 McpServerConfig
impl Debug for McpServerConfig
Source§impl<'de> Deserialize<'de> for McpServerConfig
impl<'de> Deserialize<'de> for McpServerConfig
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 McpServerConfig
impl RefUnwindSafe for McpServerConfig
impl Send for McpServerConfig
impl Sync for McpServerConfig
impl Unpin for McpServerConfig
impl UnsafeUnpin for McpServerConfig
impl UnwindSafe for McpServerConfig
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