sshexec

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(logger zerolog.Logger) tools.Tool

Types

type Input

type Input struct {
	Host            string   `json:"host"`                        // SSH host (required)
	Port            int      `json:"port,omitempty"`              // SSH port (default: 22)
	User            string   `json:"user,omitempty"`              // SSH user (default: current user)
	BinaryPath      string   `json:"binary_path,omitempty"`       // Local binary path to transfer (required for exec, optional for kill)
	RemotePath      string   `json:"remote_path,omitempty"`       // Remote destination path (default: /tmp/<filename>)
	Args            []string `json:"args,omitempty"`              // Arguments to pass to the binary
	KeepBinary      bool     `json:"keep_binary,omitempty"`       // Keep binary after execution (default: false, meaning cleanup)
	RunInBackground bool     `json:"run_in_background,omitempty"` // Run process in background (default: false)
	KillPID         int      `json:"kill_pid,omitempty"`          // PID to kill on remote host (mutually exclusive with exec)
	KillByName      string   `json:"kill_by_name,omitempty"`      // Kill processes by name pattern (mutually exclusive with exec and kill_pid)
	KillSignal      string   `json:"kill_signal,omitempty"`       // Signal to send when killing (default: TERM)
	MaxLines        int      `json:"max_lines,omitempty"`         // Maximum lines to return (default: 1000)
	Offset          int      `json:"offset,omitempty"`            // Line offset for pagination
}

type Output

type Output struct {
	Host       string   `json:"host"`
	Port       int      `json:"port"`
	User       string   `json:"user"`
	BinaryPath string   `json:"binary_path"`
	RemotePath string   `json:"remote_path"`
	Args       []string `json:"args"`
	Output     string   `json:"output"`
	ExitCode   int      `json:"exit_code"`
	TotalLines int      `json:"total_lines"`
	Offset     int      `json:"offset"`
	MaxLines   int      `json:"max_lines"`
	Truncated  bool     `json:"truncated"`
}

type Tool

type Tool struct {
	// contains filtered or unexported fields
}

func (*Tool) Register

func (s *Tool) Register(server *mcp.Server)

func (*Tool) SSHExecHandler

func (s *Tool) SSHExecHandler(_ context.Context, _ *mcp.ServerSession, params *mcp.CallToolParamsFor[Input]) (*mcp.CallToolResultFor[Output], error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL