cnctd-service-ssh 0.1.7

SSH command execution service - library and MCP server
Documentation
//! Entrypoint for cnctd-service-ssh (stdio mode).
//!
//! This service provides SSH command execution capabilities through the MCP protocol.
//! It manages SSH target configurations and executes commands on remote hosts.

use cnctd_service_ssh::mcp::SshToolRouter;
use rmcp::ServiceExt;
use tokio::io::{stdin, stdout};
use tracing::info;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Load environment variables from `.env` if present
    dotenvy::dotenv().ok();

    // Initialize tracing with configurable log level
    tracing_subscriber::fmt()
        .with_target(false)
        .with_env_filter(
            tracing_subscriber::EnvFilter::try_from_default_env()
                .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info"))
        )
        .compact()
        .init();

    info!("Starting cnctd-service-ssh (stdio mode)");

    // Create the SSH service handler
    let router = SshToolRouter::new();

    // Create stdio transport (stdin, stdout)
    let transport = (stdin(), stdout());

    // Start the MCP server and wait for shutdown
    let service = router.serve(transport).await?;
    service.waiting().await?;

    info!("Shutting down cnctd-service-ssh");
    Ok(())
}