m1nd-mcp 1.0.0

Local MCP runtime for coding agents: structural retrieval, change reasoning, document grounding, and continuity.
// === m1nd-mcp CLI argument parsing ===
//
// Clap derive struct for m1nd-mcp binary modes.
// Replaces manual std::env::args() parsing in main.rs.

use clap::Parser;

#[derive(Parser, Debug)]
#[command(name = "m1nd-mcp", about = "Neuro-symbolic connectome engine", version)]
pub struct Cli {
    /// Start HTTP server with embedded web UI
    #[arg(long)]
    pub serve: bool,

    /// HTTP server port
    #[arg(long, default_value = "1337")]
    pub port: u16,

    /// Bind address override (default: 127.0.0.1). Use 0.0.0.0 for network access.
    #[arg(long, default_value = "127.0.0.1")]
    pub bind: String,

    /// Serve frontend from disk instead of embedded (dev mode)
    #[arg(long)]
    pub dev: bool,

    /// Also run JSON-RPC stdio server alongside HTTP
    #[arg(long)]
    pub stdio: bool,

    /// Auto-open browser on startup
    #[arg(long)]
    pub open: bool,

    /// Path to config JSON file
    #[arg(long)]
    pub config: Option<String>,

    /// Graph source path override
    #[arg(long)]
    pub graph: Option<String>,

    /// Plasticity state path override
    #[arg(long)]
    pub plasticity: Option<String>,

    /// Runtime directory override for instance sidecar state
    #[arg(long)]
    pub runtime_dir: Option<String>,

    /// Global registry directory override
    #[arg(long)]
    pub registry_dir: Option<String>,

    /// Domain: code, music, memory, generic
    #[arg(long, default_value = "code")]
    pub domain: String,

    /// Disable auto-launching the HTTP GUI in stdio mode (for CI, headless servers)
    #[arg(long)]
    pub no_gui: bool,

    /// Path to event log file (append-only JSON lines). Enables cross-process SSE via file bus.
    #[arg(long)]
    pub event_log: Option<String>,

    /// Watch an event log file and broadcast new events via SSE (HTTP-only mode).
    /// Use when a separate stdio process writes events to this file.
    #[arg(long)]
    pub watch_events: Option<String>,

    /// Attach read-only: load the snapshot and serve queries, but never write to
    /// disk and never take an exclusive lease. Mutation tools are disabled.
    /// Also honored via env `M1ND_READ_ONLY=1`.
    #[arg(long)]
    pub read_only: bool,

    /// Attach to a running `--serve` owner as a thin stdio↔HTTP MCP bridge.
    /// Takes the owner's base URL (e.g. `http://127.0.0.1:1337`), or the literal
    /// `auto` to auto-discover the live serve ReadWrite owner for this client's
    /// runtime_root via the instance registry (read-only, NO lease). The env var
    /// `M1ND_ATTACH_URL`, when set, overrides both and wins. The bridge loads NO
    /// graph, builds NO engines, and takes NO lease: it speaks stdio MCP to the
    /// host (Claude Code), forwards every JSON-RPC frame to the owner's
    /// `POST /mcp`, and relays the owner's server→client SSE push notifications
    /// (`notifications/m1nd/graph_changed`) back to stdout. Multiple `--attach`
    /// clients pointed at one owner share that owner's single live graph.
    /// Requires the `serve` feature.
    #[arg(long)]
    pub attach: Option<String>,
}