pub struct McpConfigManager { /* private fields */ }Expand description
Helper to load and mutate MCP + app runtime config stored under [mcp_servers] and
[app_runtimes].
Runtime, API, and pool helpers consume this manager in a read-only fashion so stored definitions, auth hints, and metadata are left untouched while preparing launch configs.
Implementations§
Source§impl McpConfigManager
impl McpConfigManager
Sourcepub fn new(config_path: impl Into<PathBuf>) -> Self
pub fn new(config_path: impl Into<PathBuf>) -> Self
Create a manager that reads/writes the given config path.
Sourcepub fn from_code_home(code_home: impl AsRef<Path>) -> Self
pub fn from_code_home(code_home: impl AsRef<Path>) -> Self
Convenience constructor for a CODEX_HOME directory.
Sourcepub fn config_path(&self) -> &Path
pub fn config_path(&self) -> &Path
Returns the underlying config path.
Sourcepub fn list_servers(&self) -> Result<Vec<McpServerEntry>, McpConfigError>
pub fn list_servers(&self) -> Result<Vec<McpServerEntry>, McpConfigError>
Returns all configured MCP servers.
Sourcepub fn get_server(&self, name: &str) -> Result<McpServerEntry, McpConfigError>
pub fn get_server(&self, name: &str) -> Result<McpServerEntry, McpConfigError>
Returns a single MCP server by name.
Sourcepub fn list_app_runtimes(&self) -> Result<Vec<AppRuntimeEntry>, McpConfigError>
pub fn list_app_runtimes(&self) -> Result<Vec<AppRuntimeEntry>, McpConfigError>
Returns all configured app runtimes.
Sourcepub fn get_app_runtime(
&self,
name: &str,
) -> Result<AppRuntimeEntry, McpConfigError>
pub fn get_app_runtime( &self, name: &str, ) -> Result<AppRuntimeEntry, McpConfigError>
Returns a single app runtime by name.
Sourcepub fn app_runtimes(&self) -> Result<Vec<AppRuntime>, McpConfigError>
pub fn app_runtimes(&self) -> Result<Vec<AppRuntime>, McpConfigError>
Returns runtime-ready app configs with metadata preserved.
Sourcepub fn app_runtime(&self, name: &str) -> Result<AppRuntime, McpConfigError>
pub fn app_runtime(&self, name: &str) -> Result<AppRuntime, McpConfigError>
Returns a runtime-ready app config for a single entry.
Sourcepub fn app_runtime_launchers(
&self,
defaults: &StdioServerConfig,
) -> Result<Vec<AppRuntimeLauncher>, McpConfigError>
pub fn app_runtime_launchers( &self, defaults: &StdioServerConfig, ) -> Result<Vec<AppRuntimeLauncher>, McpConfigError>
Returns prepared launchers for all app runtimes.
Sourcepub fn app_runtime_launcher(
&self,
name: &str,
defaults: &StdioServerConfig,
) -> Result<AppRuntimeLauncher, McpConfigError>
pub fn app_runtime_launcher( &self, name: &str, defaults: &StdioServerConfig, ) -> Result<AppRuntimeLauncher, McpConfigError>
Returns a prepared launcher for an app runtime by name.
Sourcepub fn runtime_servers(&self) -> Result<Vec<McpRuntimeServer>, McpConfigError>
pub fn runtime_servers(&self) -> Result<Vec<McpRuntimeServer>, McpConfigError>
Returns runtime-ready configs for all servers, resolving bearer tokens from the environment.
Sourcepub fn runtime_server(
&self,
name: &str,
) -> Result<McpRuntimeServer, McpConfigError>
pub fn runtime_server( &self, name: &str, ) -> Result<McpRuntimeServer, McpConfigError>
Returns a runtime-ready config for a single server by name.
Sourcepub fn runtime_launchers(
&self,
defaults: &StdioServerConfig,
) -> Result<Vec<McpServerLauncher>, McpConfigError>
pub fn runtime_launchers( &self, defaults: &StdioServerConfig, ) -> Result<Vec<McpServerLauncher>, McpConfigError>
Returns prepared launchers/connectors for all runtime servers.
Sourcepub fn runtime_launcher(
&self,
name: &str,
defaults: &StdioServerConfig,
) -> Result<McpServerLauncher, McpConfigError>
pub fn runtime_launcher( &self, name: &str, defaults: &StdioServerConfig, ) -> Result<McpServerLauncher, McpConfigError>
Returns a prepared launcher/connector for a single runtime server by name.
Sourcepub fn add_app_runtime(
&self,
request: AddAppRuntimeRequest,
) -> Result<AppRuntimeEntry, McpConfigError>
pub fn add_app_runtime( &self, request: AddAppRuntimeRequest, ) -> Result<AppRuntimeEntry, McpConfigError>
Adds or updates an app runtime definition.
Sourcepub fn add_server(
&self,
request: AddServerRequest,
) -> Result<McpServerEntry, McpConfigError>
pub fn add_server( &self, request: AddServerRequest, ) -> Result<McpServerEntry, McpConfigError>
Adds or updates a server definition and injects any provided env vars.
Sourcepub fn remove_server(
&self,
name: &str,
) -> Result<Option<McpServerEntry>, McpConfigError>
pub fn remove_server( &self, name: &str, ) -> Result<Option<McpServerEntry>, McpConfigError>
Removes a server definition. Returns the removed entry if it existed.
Sourcepub fn login(
&self,
name: &str,
token: impl AsRef<str>,
) -> Result<McpLoginResult, McpConfigError>
pub fn login( &self, name: &str, token: impl AsRef<str>, ) -> Result<McpLoginResult, McpConfigError>
Writes the provided token into the server’s bearer env var.
Sourcepub fn logout(&self, name: &str) -> Result<McpLogoutResult, McpConfigError>
pub fn logout(&self, name: &str) -> Result<McpLogoutResult, McpConfigError>
Clears the bearer env var used for the given server.