Skip to main content

telos_agent/integrations/mcp/
config.rs

1use std::collections::HashMap;
2use std::path::PathBuf;
3
4/// Configuration for one MCP server.
5///
6/// Controls how the server process is spawned and how the client interacts
7/// with it.
8#[derive(Debug, Clone)]
9pub struct McpServerConfig {
10    /// The command to spawn (e.g. "npx", "uvx", "node").
11    pub command: String,
12    /// Arguments passed to the command.
13    pub args: Vec<String>,
14    /// Additional environment variables passed to the child process.
15    pub env: HashMap<String, String>,
16    /// Working directory for the child process.
17    pub cwd: Option<PathBuf>,
18    /// Auto-connect on session start.
19    pub auto_connect: bool,
20    /// Request timeout in milliseconds.
21    pub timeout_ms: u64,
22}
23
24impl Default for McpServerConfig {
25    fn default() -> Self {
26        Self {
27            command: String::new(),
28            args: Vec::new(),
29            env: HashMap::new(),
30            cwd: None,
31            auto_connect: true,
32            timeout_ms: 60_000,
33        }
34    }
35}
36
37impl McpServerConfig {
38    /// Create a new config with the given command and arguments.
39    ///
40    /// All other fields use their defaults.
41    pub fn new(command: &str, args: Vec<String>) -> Self {
42        Self { command: command.into(), args, ..Default::default() }
43    }
44}