Skip to main content

crabtalk_core/config/
mcp.rs

1//! MCP server configuration.
2
3use serde::{Deserialize, Serialize};
4use std::collections::BTreeMap;
5
6/// MCP server configuration.
7#[derive(Debug, Clone, Serialize, Deserialize)]
8#[serde(default)]
9pub struct McpServerConfig {
10    /// Server name. If empty, the name will be the command.
11    pub name: String,
12    /// Command to spawn (stdio transport).
13    pub command: String,
14    /// Command arguments.
15    pub args: Vec<String>,
16    /// Environment variables.
17    pub env: BTreeMap<String, String>,
18    /// Auto-restart on failure.
19    pub auto_restart: bool,
20    /// HTTP URL for streamable HTTP transport. When set, the daemon connects
21    /// via HTTP instead of spawning a child process.
22    pub url: Option<String>,
23    /// Whether this server requires OAuth authentication.
24    pub auth: bool,
25}
26
27impl Default for McpServerConfig {
28    fn default() -> Self {
29        Self {
30            name: String::new(),
31            command: String::new(),
32            args: Vec::new(),
33            env: BTreeMap::new(),
34            auto_restart: true,
35            url: None,
36            auth: false,
37        }
38    }
39}