sequel-mcp 0.11.2

Local-first, policy-gated MySQL/MariaDB and SQLite access for AI agents: native Rust MCP server, CLI and GUI
Documentation
//! Launch exactly one native dialog for a pending IPC request.

use std::path::Path;
use std::process::Stdio;

pub fn open_prompt(socket: &Path, request_id: &str) -> Option<tokio::process::Child> {
    // Unit tests never spawn processes. Process-level GUI tests must opt
    // in explicitly while retaining the normal isolated test environment.
    if cfg!(test)
        || (crate::app::test_mode::is_active()
            && std::env::var("SEQUEL_MCP_TEST_GUI").as_deref() != Ok("1"))
        || (!cfg!(target_os = "macos")
            && std::env::var_os("DISPLAY").is_none()
            && std::env::var_os("WAYLAND_DISPLAY").is_none())
    {
        return None;
    }
    let child = std::env::current_exe().and_then(|exe| {
        tokio::process::Command::new(exe)
            .arg("gui")
            .arg("--socket")
            .arg(socket)
            .arg("--request-id")
            .arg(request_id)
            .stdin(Stdio::null())
            .stdout(Stdio::null())
            .stderr(Stdio::inherit())
            .kill_on_drop(true)
            .spawn()
    });
    match child {
        Ok(child) => Some(child),
        Err(error) => {
            eprintln!(
                "sequel-mcp: approval dialog could not start ({error}); use sequel-mcp approve --socket {}",
                socket.display()
            );
            None
        }
    }
}