cnctd-service-ssh 0.1.7

SSH command execution service - library and MCP server
Documentation
//! cnctd-service-ssh - SSH command execution library
//!
//! This library provides secure SSH command execution capabilities.
//! It can be used directly as a library or run as an MCP server.
//!
//! # Library Usage
//!
//! ```rust,no_run
//! use cnctd_service_ssh::{SshService, SshRegisterArgs, SshExecArgs};
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//!     let service = SshService::new();
//!     
//!     // Register a target
//!     service.register(SshRegisterArgs {
//!         id: "my-server".to_string(),
//!         host: "example.com".to_string(),
//!         user: "ubuntu".to_string(),
//!         port: 22,
//!         key_passphrase: None,
//!         known_hosts_path: "~/.ssh/known_hosts".to_string(),
//!         client_id: Some("my-app".to_string()),
//!     }).await?;
//!     
//!     // Execute a command
//!     let result = service.exec(SshExecArgs {
//!         id: "my-server".to_string(),
//!         command: "hostname".to_string(),
//!         timeout_secs: 30,
//!         context: Some("checking hostname".to_string()),
//!     }).await?;
//!     
//!     println!("Output: {}", result.stdout);
//!     Ok(())
//! }
//! ```
//!
//! # Tool Definitions
//!
//! To get tool schemas for LLM integration (avoiding hardcoded schemas):
//!
//! ```rust
//! use cnctd_service_ssh::get_tool_definitions;
//!
//! let tools = get_tool_definitions();
//! for tool in tools {
//!     println!("{}: {}", tool.name, tool.description);
//! }
//! ```
//!
//! # MCP Server
//!
//! Run as a standalone MCP server:
//! ```bash
//! cnctd-service-ssh
//! ```

pub mod operations;
pub mod service_error;

#[cfg(feature = "mcp")]
pub mod mcp;

// Re-export main types for convenience
pub use operations::{
    SshRegisterArgs,
    SshExecArgs,
    SshUnregisterArgs,
    SshExecResult,
    SshService,
    ToolDefinition,
    get_tool_definitions,
    // Legacy global functions for backwards compatibility
    ssh_register,
    ssh_exec,
    ssh_unregister,
};

pub use service_error::ServiceError;