MCPcopy Create free account
hub / github.com/CodeBendKit/codeseek / install_to_codex

Function install_to_codex

rust-core/src/main.rs:699–741  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

697}
698
699fn install_to_codex() -> Result<(), Box<dyn std::error::Error>> {
700 let config_path = codex_config_path();
701 if !config_path.parent().map(|p| p.exists()).unwrap_or(false) {
702 return Ok(());
703 }
704
705 let toml_block = format!(
706 "[mcp_servers.codeseek]\ncommand = \"{}\"\nargs = [\"serve\", \"--mcp\"]\n",
707 codeseek_bin()
708 );
709
710 let existing = if config_path.exists() {
711 std::fs::read_to_string(&config_path)?
712 } else {
713 String::new()
714 };
715
716 let header = "[mcp_servers.codeseek]";
717 if existing.contains(header) {
718 let start = existing.find(header).unwrap();
719 let end = existing[start..]
720 .find("\n[")
721 .map(|i| start + i)
722 .unwrap_or(existing.len());
723 let mut updated = existing[..start].to_string();
724 updated.push_str(&toml_block);
725 if end < existing.len() {
726 updated.push_str(&existing[end..]);
727 }
728 std::fs::write(&config_path, updated.trim_end())?;
729 } else {
730 std::fs::create_dir_all(config_path.parent().unwrap())?;
731 let content = if existing.is_empty() {
732 toml_block
733 } else {
734 format!("{}\n\n{}", existing.trim_end(), toml_block)
735 };
736 std::fs::write(&config_path, content)?;
737 }
738
739 println!(" ✓ Codex config → {}", config_path.display());
740 Ok(())
741}
742
743fn uninstall_from_claude() -> Result<(), Box<dyn std::error::Error>> {
744 let mcp_path = claude_global_mcp_path();

Callers 1

mainFunction · 0.85

Calls 2

codex_config_pathFunction · 0.85
to_stringMethod · 0.80

Tested by

no test coverage detected