//! MCP server binary

use anyhow::Result;
use kogral_mcp::McpServer;

#[tokio::main]
async fn main() -> Result<()> {
    // Initialize tracing
    tracing_subscriber::fmt()
        .with_env_filter(
            tracing_subscriber::EnvFilter::try_from_default_env()
                .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")),
        )
        .with_writer(std::io::stderr) // Write logs to stderr to not interfere with stdio transport
        .init();

    // Create and run server
    let server = McpServer::new(
        "kogral-mcp".to_string(),
        env!("CARGO_PKG_VERSION").to_string(),
    );
    server.run_stdio().await?;

    Ok(())
}
