Documentation
¶
Index ¶
- func FormatMCPError(err error) error
- func Serve(ctx context.Context, opts ...Option) (retErr error)
- type CreateTunnelInput
- type FSBaseOutput
- type FSCpInput
- type FSListInput
- type FSListOutput
- type FSMkdirInput
- type FSMvInput
- type FSRmInput
- type FSTouchInput
- type FileInfo
- type HTTPOptions
- type ListNodesInput
- type ListNodesOutput
- type ListTunnelsInput
- type ListTunnelsOutput
- type NodeInfo
- type Option
- type PrepareDownloadInput
- type PrepareUploadInput
- type PreparedTransferOutput
- type ReadFileInput
- type ReadFileOutput
- type RecoveryEntry
- type RecoveryOptions
- type Runtime
- type SshRunInput
- type SshRunOutput
- type TransferFileInput
- type TransferFileOutput
- type TransferTaskInput
- type TunnelInput
- type TunnelOutput
- type WriteFileInput
- type WriteFileOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatMCPError ¶ added in v0.12.0
FormatMCPError converts internal SSH errors (such as ErrInteractionRequired) into user-friendly MCP errors.
Types ¶
type CreateTunnelInput ¶ added in v0.13.0
type CreateTunnelInput struct {
RequestID string `` /* 157-byte string literal not displayed */
NodeID string `json:"nodeID" jsonschema:"Managed SSH node ID or alias, including canonical openssh:host IDs returned by tunnel tools."`
Mode string `` /* 202-byte string literal not displayed */
ListenHost string `` /* 140-byte string literal not displayed */
ListenPort int `json:"listenPort" jsonschema:"Listening TCP port, 0 to 65535. Zero requests an automatically allocated port."`
TargetHost string `` /* 130-byte string literal not displayed */
TargetPort int `json:"targetPort" jsonschema:"Destination TCP port, 1 to 65535."`
TTLSeconds int `` /* 133-byte string literal not displayed */
}
type FSBaseOutput ¶
type FSBaseOutput struct {
Status string `json:"status" jsonschema:"Operation status"`
}
type FSListInput ¶
type FSListOutput ¶
type FSMkdirInput ¶
type FSTouchInput ¶
type FileInfo ¶
type FileInfo struct {
Name string `json:"name" jsonschema:"File name"`
Size int64 `json:"size" jsonschema:"Size in bytes"`
Mode string `json:"mode" jsonschema:"File mode/permissions"`
ModTime time.Time `json:"modTime" jsonschema:"Last modification time"`
IsDir bool `json:"isDir" jsonschema:"True if it is a directory"`
}
type HTTPOptions ¶ added in v0.13.0
type HTTPOptions struct {
Listen string
PublicURL string
Token string
StateDir string
AllowedHosts []string
AllowedOrigins []string
HeaderTimeout time.Duration
BodyTimeout time.Duration
StreamIdle time.Duration
ToolTimeout time.Duration
SessionTimeout time.Duration
ShutdownTimeout time.Duration
MaxSessions int
MaxRequests int
Transfers transfer.Limits
// contains filtered or unexported fields
}
HTTPOptions configures authenticated Streamable HTTP. Token is consumed at construction; the runtime retains only its digest, never a printable token.
func DefaultHTTPOptions ¶ added in v0.13.0
func DefaultHTTPOptions() HTTPOptions
func HTTPOptionsFromConfig ¶ added in v0.13.0
func HTTPOptionsFromConfig(c *config.MCPConfig) (HTTPOptions, error)
HTTPOptionsFromConfig overlays explicit settings. Token loading and the default state directory are owned by the CLI composition root.
type ListNodesInput ¶
type ListNodesInput struct {
Tag string `json:"tag,omitempty" jsonschema:"Filter nodes by tag. If empty, lists all nodes."`
}
type ListNodesOutput ¶
type ListTunnelsInput ¶ added in v0.13.0
type ListTunnelsOutput ¶ added in v0.13.0
type NodeInfo ¶
type NodeInfo struct {
ID string `json:"id" jsonschema:"Node ID / Name"`
Alias []string `json:"alias,omitempty" jsonschema:"Node aliases"`
Address string `json:"address" jsonschema:"Host address and port"`
User string `json:"user" jsonschema:"SSH user"`
AuthType string `json:"authType" jsonschema:"Authentication type"`
ProxyJump string `json:"proxyJump,omitempty" jsonschema:"Proxy jump host"`
Tags []string `json:"tags,omitempty" jsonschema:"Node tags"`
}
type Option ¶ added in v0.12.0
type Option func(*serverConfig)
Option configures the MCP server runtime.
func WithConfigProvider ¶ added in v0.12.0
func WithConfigProvider(provider config.ConfigProvider) Option
WithConfigProvider injects the configuration used by MCP tools and guardrails. Callers must fully load and validate the configuration before starting Serve.
func WithCredentialRegistry ¶ added in v0.12.0
func WithCredentialRegistry(r adapter.CredentialResolver) Option
WithCredentialRegistry injects a credential registry so MCP connections can resolve stored secrets. When set, the MCP connector is configured with WithCredentialSource so SSH nodes can authenticate without interactive prompts.
func WithHTTP ¶ added in v0.13.0
func WithHTTP(options HTTPOptions) Option
WithHTTP switches the runtime to HTTP tools and session-based Streamable HTTP. Start it with Runtime.ServeHTTP rather than the stdio Run entry point.
func WithLogger ¶ added in v0.12.0
func WithLogger(l logger.DebugLogger) Option
WithLogger injects a custom DebugLogger into MCP server and its underlying SSH connector.
type PrepareDownloadInput ¶ added in v0.13.0
type PrepareUploadInput ¶ added in v0.13.0
type PrepareUploadInput struct {
RequestID string `json:"requestID" jsonschema:"Client-generated idempotency key; keep the same key when retrying preparation"`
NodeID string `json:"nodeID" jsonschema:"Managed SSH node ID"`
RemotePath string `json:"remotePath" jsonschema:"Absolute destination file path on the SSH target"`
Size int64 `json:"size" jsonschema:"Exact client file size in bytes"`
SHA256 string `json:"sha256" jsonschema:"Lowercase SHA-256 of the client file"`
Overwrite bool `json:"overwrite,omitempty" jsonschema:"Explicitly replace an existing ordinary file atomically; new file mode is 0600"`
}
type PreparedTransferOutput ¶ added in v0.13.0
type ReadFileInput ¶
type ReadFileInput struct {
NodeID string `json:"nodeID" jsonschema:"Node ID for the remote machine"`
Path string `json:"path" jsonschema:"Absolute path to the remote file"`
Offset int64 `json:"offset,omitempty" jsonschema:"Byte offset to start reading from"`
Limit int64 `json:"limit,omitempty" jsonschema:"Max bytes to read (default 50KB, max 100KB)"`
}
type ReadFileOutput ¶
type ReadFileOutput struct {
Content string `json:"content" jsonschema:"File content represented as string"`
EOF bool `json:"eof" jsonschema:"True if end of file reached"`
Size int64 `json:"size" jsonschema:"Total size of the remote file"`
Status string `json:"status" jsonschema:"Operation status"`
}
type RecoveryEntry ¶ added in v0.13.0
type RecoveryEntry struct {
Task transfer.Status `json:"task"`
TemporaryPath string `json:"temporaryPath,omitempty"`
Verified bool `json:"verified"`
DestinationExists bool `json:"destinationExists"`
ActualSize int64 `json:"actualSize,omitempty"`
ActualSHA256 string `json:"actualSHA256,omitempty"`
MatchesExpected bool `json:"matchesExpected"`
Resolution string `json:"resolution,omitempty"`
}
func RecoverTransfers ¶ added in v0.13.0
func RecoverTransfers(ctx context.Context, options RecoveryOptions, opts ...Option) (_ []RecoveryEntry, retErr error)
RecoverTransfers is offline maintenance: the permanent journal lock prevents racing a running service. Listing never mutates task records or contacts SSH. Remote verification/cleanup and operator acknowledgement are explicit options.
type RecoveryOptions ¶ added in v0.13.0
type Runtime ¶ added in v0.13.0
type Runtime struct {
// contains filtered or unexported fields
}
Runtime owns a single MCP server and its SSH resources. Independent runtimes can coexist; Close cancels keepalive and closes only this runtime's sessions.
func NewRuntime ¶ added in v0.13.0
NewRuntime validates dependencies before starting any background work. The caller owns Close, including when connecting a transport fails.
func (*Runtime) Close ¶ added in v0.13.0
Close is idempotent and cancels the runtime before joining its resources.
func (*Runtime) HTTPHandler ¶ added in v0.13.0
HTTPHandler returns the authenticated handler owned by this runtime. Every HTTP server using it must bind its lifecycle to this runtime and call Close.
type SshRunInput ¶
type SshRunOutput ¶
type TransferFileInput ¶
type TransferFileOutput ¶
type TransferFileOutput struct {
Status string `json:"status" jsonschema:"Operation status"`
}
type TransferTaskInput ¶ added in v0.13.0
type TransferTaskInput struct {
TransferID string `json:"transferID" jsonschema:"Transfer task ID returned by a prepare tool"`
}
type TunnelInput ¶ added in v0.13.0
type TunnelInput struct {
TunnelID string `json:"tunnelID" jsonschema:"Tunnel ID returned by xops_tunnel_create or xops_tunnel_list."`
}
type TunnelOutput ¶ added in v0.13.0
type WriteFileInput ¶
type WriteFileInput struct {
NodeID string `json:"nodeID" jsonschema:"Node ID for the remote machine"`
Path string `json:"path" jsonschema:"Absolute path to the remote file"`
Content string `json:"content" jsonschema:"Content to write"`
Append bool `json:"append,omitempty" jsonschema:"If true, append to existing file; if false, overwrite completely"`
}
type WriteFileOutput ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package transfer manages authorized, single-use file transfer tasks.
|
Package transfer manages authorized, single-use file transfer tasks. |
|
Package tunnel manages process-local SSH forwards independently of MCP calls.
|
Package tunnel manages process-local SSH forwards independently of MCP calls. |