(settings_path: &Path, tracedecay_bin: &str)
| 94 | // --------------------------------------------------------------------------- |
| 95 | |
| 96 | fn install_mcp_server(settings_path: &Path, tracedecay_bin: &str) -> Result<()> { |
| 97 | if let Some(parent) = settings_path.parent() { |
| 98 | std::fs::create_dir_all(parent).ok(); |
| 99 | } |
| 100 | |
| 101 | let backup = backup_config_file(settings_path)?; |
| 102 | let mut settings = match load_json_file_strict(settings_path) { |
| 103 | Ok(v) => v, |
| 104 | Err(e) => { |
| 105 | if let Some(ref b) = backup { |
| 106 | eprintln!(" Backup preserved at: {}", b.display()); |
| 107 | } |
| 108 | return Err(e); |
| 109 | } |
| 110 | }; |
| 111 | settings["mcpServers"]["tracedecay"] = json!({ |
| 112 | "command": tracedecay_bin, |
| 113 | "args": ["serve"], |
| 114 | "disabled": false |
| 115 | }); |
| 116 | |
| 117 | safe_write_json_file(settings_path, &settings, backup.as_deref())?; |
| 118 | eprintln!( |
| 119 | "\x1b[32m✔\x1b[0m Added tracedecay MCP server to {}", |
| 120 | settings_path.display() |
| 121 | ); |
| 122 | Ok(()) |
| 123 | } |
| 124 | |
| 125 | /// Remove MCP server entry from Cline's `cline_mcp_settings.json`. |
| 126 | fn uninstall_mcp_server(settings_path: &Path) { |
no test coverage detected