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

Function install_cli_mcp_server

src/agents/copilot.rs:283–310  ·  view source on GitHub ↗

Register MCP server in Copilot CLI's ~/.copilot/mcp-config.json.

(settings_path: &Path, tracedecay_bin: &str)

Source from the content-addressed store, hash-verified

281
282/// Register MCP server in Copilot CLI's ~/.copilot/mcp-config.json.
283fn 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.
313fn install_workspace_mcp_server(settings_path: &Path, tracedecay_bin: &str) -> Result<()> {

Callers 1

installMethod · 0.85

Calls 3

backup_config_fileFunction · 0.85
load_json_file_strictFunction · 0.85
safe_write_json_fileFunction · 0.85

Tested by

no test coverage detected