MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / uninstall_mcp_server

Function uninstall_mcp_server

src/agents/codex.rs:1180–1217  ·  view source on GitHub ↗

Remove MCP server from ~/.codex/config.toml.

(config_path: &Path)

Source from the content-addressed store, hash-verified

1178
1179/// Remove MCP server from ~/.codex/config.toml.
1180fn uninstall_mcp_server(config_path: &Path) -> Result<()> {
1181 if !config_path.exists() {
1182 return Ok(());
1183 }
1184 let mut config = load_toml_file(config_path)?;
1185 let Some(table) = config.as_table_mut() else {
1186 return Ok(());
1187 };
1188 let Some(servers) = table.get_mut("mcp_servers").and_then(|v| v.as_table_mut()) else {
1189 return Ok(());
1190 };
1191 let removed = servers.remove("tracedecay").is_some();
1192 if !removed {
1193 eprintln!(
1194 " No tracedecay MCP server in {}, skipping",
1195 config_path.display()
1196 );
1197 return Ok(());
1198 }
1199 if servers.is_empty() {
1200 table.remove("mcp_servers");
1201 }
1202 if table.is_empty() {
1203 let _ = super::backup_file(config_path);
1204 std::fs::remove_file(config_path).ok();
1205 eprintln!(
1206 "\x1b[32m✔\x1b[0m Removed {} (was empty)",
1207 config_path.display()
1208 );
1209 } else {
1210 write_toml_file(config_path, &config)?;
1211 eprintln!(
1212 "\x1b[32m✔\x1b[0m Removed tracedecay MCP server from {}",
1213 config_path.display()
1214 );
1215 }
1216 Ok(())
1217}
1218
1219/// Remove tracedecay rules from AGENTS.md.
1220fn uninstall_prompt_rules(agents_md: &Path) {

Callers 2

uninstallMethod · 0.70

Calls 5

load_toml_fileFunction · 0.85
backup_fileFunction · 0.85
write_toml_fileFunction · 0.85
existsMethod · 0.80
is_emptyMethod · 0.45

Tested by

no test coverage detected