Register MCP server in Copilot CLI's ~/.copilot/mcp-config.json.
(settings_path: &Path, tracedecay_bin: &str)
| 281 | |
| 282 | /// Register MCP server in Copilot CLI's ~/.copilot/mcp-config.json. |
| 283 | fn install_cli_mcp_server(settings_path: &Path, tracedecay_bin: &str) -> Result<()> { |
| 284 | if let Some(parent) = settings_path.parent() { |
| 285 | std::fs::create_dir_all(parent).ok(); |
| 286 | } |
| 287 | |
| 288 | let backup = backup_config_file(settings_path)?; |
| 289 | let mut settings = match load_json_file_strict(settings_path) { |
| 290 | Ok(v) => v, |
| 291 | Err(e) => { |
| 292 | if let Some(ref b) = backup { |
| 293 | eprintln!(" Backup preserved at: {}", b.display()); |
| 294 | } |
| 295 | return Err(e); |
| 296 | } |
| 297 | }; |
| 298 | settings["mcpServers"]["tracedecay"] = json!({ |
| 299 | "type": "stdio", |
| 300 | "command": tracedecay_bin, |
| 301 | "args": ["serve"] |
| 302 | }); |
| 303 | |
| 304 | safe_write_json_file(settings_path, &settings, backup.as_deref())?; |
| 305 | eprintln!( |
| 306 | "\x1b[32m✔\x1b[0m Added tracedecay MCP server to {}", |
| 307 | settings_path.display() |
| 308 | ); |
| 309 | Ok(()) |
| 310 | } |
| 311 | |
| 312 | /// Register MCP server in a project `.vscode/mcp.json` file. |
| 313 | fn install_workspace_mcp_server(settings_path: &Path, tracedecay_bin: &str) -> Result<()> { |
no test coverage detected