Documentation
¶
Index ¶
- Constants
- func ServeStdio(ctx context.Context, svc *app.Service, version string) error
- func TruncateForModel(s string, headBytes, tailBytes int) (out string, totalBytes int, truncated bool)
- type CloseConnectionInput
- type DownloadInput
- type ListHostsInput
- type Manager
- func (m *Manager) CloseAll() int
- func (m *Manager) HandleCloseConnection(in CloseConnectionInput) map[string]any
- func (m *Manager) HandleDownload(ctx context.Context, in DownloadInput) map[string]any
- func (m *Manager) HandleListHosts(ctx context.Context) map[string]any
- func (m *Manager) HandleRunCommand(ctx context.Context, in RunCommandInput) map[string]any
- func (m *Manager) HandleUpload(ctx context.Context, in UploadInput) map[string]any
- type RunCommandInput
- type UploadInput
Constants ¶
View Source
const ( MaxPooledConnections = 8 DefaultIdleTTL = 15 * time.Minute DefaultQueueWait = 60 * time.Second ModelStreamHeadBytes = 32 * 1024 // 32 KiB ModelStreamTailBytes = 32 * 1024 // 32 KiB ModelStreamTotalLimit = ModelStreamHeadBytes + ModelStreamTailBytes )
Variables ¶
This section is empty.
Functions ¶
func ServeStdio ¶
ServeStdio 启动 stdio MCP 服务,在连接结束或进程退出时关闭全部缓存的 SSH/SFTP 会话。
Types ¶
type CloseConnectionInput ¶
type DownloadInput ¶
type DownloadInput struct {
Target string `json:"target" jsonschema:"目标服务器(用户@IP、单账号 IP 或别名)"`
RemotePath string `json:"remote_path" jsonschema:"远端源文件或目录路径"`
LocalPath string `json:"local_path" jsonschema:"本机保存目标路径"`
Overwrite bool `json:"overwrite,omitempty" jsonschema:"若本机目标文件已存在是否允许覆盖(默认 false)"`
Recursive bool `json:"recursive,omitempty" jsonschema:"若远端源路径是目录是否递归下载(默认 false)"`
}
type ListHostsInput ¶
type ListHostsInput struct{}
type Manager ¶
type Manager struct {
Service *app.Service
MaxConns int
IdleTTL time.Duration
QueueWait time.Duration
ModelHeadBytes int
ModelTailBytes int
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) HandleCloseConnection ¶
func (m *Manager) HandleCloseConnection(in CloseConnectionInput) map[string]any
func (*Manager) HandleDownload ¶
func (*Manager) HandleListHosts ¶
func (*Manager) HandleRunCommand ¶
func (*Manager) HandleUpload ¶
type RunCommandInput ¶
type RunCommandInput struct {
Target string `json:"target" jsonschema:"目标服务器(支持 用户@IP、已配置单账号的 IP 或别名)"`
Command string `json:"command" jsonschema:"要执行的单条非交互远程命令"`
Cwd string `json:"cwd,omitempty" jsonschema:"可选的远端工作目录绝对路径(如 /var/log)"`
Timeout float64 `json:"timeout,omitempty" jsonschema:"超时秒数 (0, 3600],默认 30 秒"`
}
type UploadInput ¶
type UploadInput struct {
LocalPath string `json:"local_path" jsonschema:"本机源文件或目录路径"`
Target string `json:"target" jsonschema:"目标服务器(用户@IP、单账号 IP 或别名)"`
RemotePath string `json:"remote_path" jsonschema:"远端目标路径(支持 ~/路径、相对家目录路径或平台允许的绝对路径)"`
Overwrite bool `json:"overwrite,omitempty" jsonschema:"若远端文件已存在是否允许覆盖(默认 false)"`
Recursive bool `json:"recursive,omitempty" jsonschema:"若本机源路径是目录是否递归上传(默认 false)"`
}
Click to show internal directories.
Click to hide internal directories.