pub struct ServerConfig {
pub command: String,
pub args: Vec<String>,
pub env: HashMap<String, String>,
}
Expand description
Configuration for a single MCP server instance.
This structure defines how to start and configure a specific MCP server process. It includes the command to execute, any arguments to pass, and optional environment variables to set when launching the server.
§Examples
Basic server configuration:
use mcp_runner::config::ServerConfig;
use std::collections::HashMap;
let server_config = ServerConfig {
command: "node".to_string(),
args: vec!["server.js".to_string()],
env: HashMap::new(),
};
Configuration with environment variables:
use mcp_runner::config::ServerConfig;
use std::collections::HashMap;
let mut env = HashMap::new();
env.insert("MODEL_PATH".to_string(), "/path/to/model".to_string());
env.insert("DEBUG".to_string(), "true".to_string());
let server_config = ServerConfig {
command: "python".to_string(),
args: vec!["-m".to_string(), "mcp_server".to_string()],
env,
};
Fields§
§command: String
Command to execute when starting the MCP server. This can be an absolute path or a command available in the PATH.
args: Vec<String>
Command-line arguments to pass to the server.
env: HashMap<String, String>
Environment variables to set when launching the server. These will be combined with the current environment.
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
Returns a copy 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 ServerConfig
impl Debug for ServerConfig
Source§impl<'de> Deserialize<'de> for ServerConfig
impl<'de> Deserialize<'de> for ServerConfig
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 ServerConfig
impl RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnwindSafe for ServerConfig
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