scryer-mcp 0.2.1

Model Context Protocol (MCP) server for Scryer code intelligence
//! Shared daemon: one process owns the database and serves many MCP clients over a Unix socket.
//!
//! `scryer serve` (stdio) connects to the daemon, starting it on first use, and pipes bytes
//! between its stdio and the socket. Each connection opens with a one-line JSON handshake
//! ([`handshake`]) and then carries raw MCP JSON-RPC for its own session.

pub mod client;
pub mod handshake;
pub mod paths;
pub mod server;

pub use client::{
    DaemonConnection, connect, connect_or_spawn, control, handshake, is_stale_build, pipe,
    replace_stale_daemon,
};
pub use handshake::{ControlCommand, DaemonStatus, Hello, HelloMode, HelloReply, WatchedProject};
pub use paths::{DaemonPaths, default_run_dir, is_local_db};
pub use server::{Daemon, DaemonLock, daemon_running, run_daemon};

/// Create the runtime directory, private to the current user.
pub(crate) fn prepare_run_dir(dir: &std::path::Path) -> std::io::Result<()> {
    use std::os::unix::fs::PermissionsExt;

    if !dir.exists() {
        std::fs::create_dir_all(dir)?;
        std::fs::set_permissions(dir, std::fs::Permissions::from_mode(0o700))?;
    }
    Ok(())
}