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

Function install_workspace_mcp_server

src/agents/copilot.rs:313–340  ·  view source on GitHub ↗

Register MCP server in a project `.vscode/mcp.json` file.

(settings_path: &Path, tracedecay_bin: &str)

Source from the content-addressed store, hash-verified

311
312/// Register MCP server in a project `.vscode/mcp.json` file.
313fn install_workspace_mcp_server(settings_path: &Path, tracedecay_bin: &str) -> Result<()> {
314 if let Some(parent) = settings_path.parent() {
315 std::fs::create_dir_all(parent).ok();
316 }
317
318 let backup = backup_config_file(settings_path)?;
319 let mut settings = match load_jsonc_file_strict(settings_path) {
320 Ok(v) => v,
321 Err(e) => {
322 if let Some(ref b) = backup {
323 eprintln!(" Backup preserved at: {}", b.display());
324 }
325 return Err(e);
326 }
327 };
328 settings["servers"]["tracedecay"] = json!({
329 "type": "stdio",
330 "command": tracedecay_bin,
331 "args": ["serve"]
332 });
333
334 safe_write_json_file(settings_path, &settings, backup.as_deref())?;
335 eprintln!(
336 "\x1b[32m✔\x1b[0m Added tracedecay MCP server to {}",
337 settings_path.display()
338 );
339 Ok(())
340}
341
342// ---------------------------------------------------------------------------
343// Uninstall helpers

Callers 1

install_localMethod · 0.85

Calls 3

backup_config_fileFunction · 0.85
load_jsonc_file_strictFunction · 0.85
safe_write_json_fileFunction · 0.85

Tested by

no test coverage detected