use std::process::ExitCode;
fn main() -> ExitCode {
eprintln!(
"[DEPRECATED] trusty-memory-mcp-bridge is deprecated and will be removed in a future version.\n\
Update your MCP config to use: \"command\": \"trusty-memory\", \"args\": [\"serve\", \"--stdio\"]\n\
(No automated command exists for this config update — edit your .mcp.json manually.)\n\
Forwarding to `trusty-memory serve --stdio` now…"
);
let exe = std::env::current_exe()
.ok()
.and_then(|p| p.parent().map(|d| d.join("trusty-memory")))
.filter(|p| p.exists())
.unwrap_or_else(|| std::path::PathBuf::from("trusty-memory"));
eprintln!("trusty-memory-mcp-bridge: delegating to {}", exe.display());
#[cfg(unix)]
{
use std::os::unix::process::CommandExt;
let err = std::process::Command::new(&exe)
.arg("serve")
.arg("--stdio")
.exec(); eprintln!("trusty-memory-mcp-bridge: exec failed: {err}");
ExitCode::FAILURE
}
#[cfg(not(unix))]
{
use std::process::Stdio;
let status = std::process::Command::new(&exe)
.arg("serve")
.arg("--stdio")
.stdin(Stdio::inherit())
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.status();
match status {
Ok(s) => {
std::process::exit(s.code().unwrap_or(1));
}
Err(e) => {
eprintln!("trusty-memory-mcp-bridge: spawn failed: {e}");
ExitCode::FAILURE
}
}
}
}