use codex_wrapper::{
Codex, CodexCommand, McpAddCommand, McpGetCommand, McpListCommand, McpRemoveCommand,
};
const NAME: &str = "example-echo";
#[tokio::main]
async fn main() -> codex_wrapper::Result<()> {
let codex = Codex::builder().build()?;
let servers = McpListCommand::new().execute_json(&codex).await?;
println!("before: {servers}");
McpAddCommand::stdio(NAME, "bash")
.arg("-c")
.arg("cat")
.env("EXAMPLE", "1")
.execute(&codex)
.await?;
println!("\nadded {NAME}");
let detail = McpGetCommand::new(NAME).execute(&codex).await?;
println!("\n{}", detail.stdout);
McpRemoveCommand::new(NAME).execute(&codex).await?;
println!("removed {NAME}");
Ok(())
}