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

Function codex_plugin_mcp

src/agents/codex.rs:598–614  ·  view source on GitHub ↗
(raw: &str, tracedecay_bin: &str, policy: CodexBundlePolicy)

Source from the content-addressed store, hash-verified

596}
597
598fn codex_plugin_mcp(raw: &str, tracedecay_bin: &str, policy: CodexBundlePolicy) -> Result<String> {
599 // Reuse the shared command rewrite, then layer the policy's args/env on
600 // top of the result.
601 let stamped = super::plugin_bundle::set_mcp_command(raw, tracedecay_bin)?;
602 let mut mcp: serde_json::Value = serde_json::from_str(&stamped)?;
603 let server = &mut mcp["mcpServers"]["tracedecay"];
604 server["args"] = policy.mcp_args();
605 match policy.mcp_env() {
606 Some(env) => server["env"] = env,
607 None => {
608 if let Some(object) = server.as_object_mut() {
609 object.remove("env");
610 }
611 }
612 }
613 Ok(format!("{}\n", serde_json::to_string_pretty(&mcp)?))
614}
615
616/// A lifecycle hook the Codex plugin registers.
617struct CodexManagedHook {

Callers 1

write_codex_plugin_filesFunction · 0.85

Calls 3

mcp_argsMethod · 0.80
mcp_envMethod · 0.80
set_mcp_commandFunction · 0.70

Tested by

no test coverage detected