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

Function install_vscode_mcp_server

src/agents/copilot.rs:253–280  ·  view source on GitHub ↗

Register MCP server in VS Code settings.json.

(settings_path: &Path, tracedecay_bin: &str)

Source from the content-addressed store, hash-verified

251
252/// Register MCP server in VS Code settings.json.
253fn install_vscode_mcp_server(settings_path: &Path, tracedecay_bin: &str) -> Result<()> {
254 if let Some(parent) = settings_path.parent() {
255 std::fs::create_dir_all(parent).ok();
256 }
257
258 let backup = backup_config_file(settings_path)?;
259 let mut settings = match load_jsonc_file_strict(settings_path) {
260 Ok(v) => v,
261 Err(e) => {
262 if let Some(ref b) = backup {
263 eprintln!(" Backup preserved at: {}", b.display());
264 }
265 return Err(e);
266 }
267 };
268 settings["mcp"]["servers"]["tracedecay"] = json!({
269 "type": "stdio",
270 "command": tracedecay_bin,
271 "args": ["serve"]
272 });
273
274 safe_write_json_file(settings_path, &settings, backup.as_deref())?;
275 eprintln!(
276 "\x1b[32m✔\x1b[0m Added tracedecay MCP server to {}",
277 settings_path.display()
278 );
279 Ok(())
280}
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<()> {

Callers 1

installMethod · 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