mcpserver

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFS

func RegisterFS(server *mcp.Server, g *guardrail.Guardrail)

func RegisterSFTP

func RegisterSFTP(server *mcp.Server, g *guardrail.Guardrail)

func RegisterSSH

func RegisterSSH(server *mcp.Server, g *guardrail.Guardrail)

func RegisterTools

func RegisterTools(server *mcp.Server, g *guardrail.Guardrail)

RegisterTools 统一注册各模块的 MCP 能力,并注入安全护栏

func Serve

func Serve(ctx context.Context) error

Types

type FSBaseOutput

type FSBaseOutput struct {
	Status string `json:"status" jsonschema:"Operation status"`
}

type FSCpInput

type FSCpInput struct {
	NodeID string `json:"nodeID" jsonschema:"Node ID for the remote machine"`
	Src    string `json:"srcPath" jsonschema:"Absolute path to source"`
	Dest   string `json:"destPath" jsonschema:"Absolute path to destination"`
}

type FSListInput

type FSListInput struct {
	NodeID string `json:"nodeID" jsonschema:"Node ID for the remote machine"`
	Path   string `json:"path" jsonschema:"Absolute path to the remote directory"`
}

type FSListOutput

type FSListOutput struct {
	Files  []FileInfo `json:"files" jsonschema:"List of files in the directory"`
	Status string     `json:"status" jsonschema:"Operation status"`
}

type FSMkdirInput

type FSMkdirInput struct {
	NodeID string `json:"nodeID" jsonschema:"Node ID for the remote machine"`
	Path   string `json:"path" jsonschema:"Absolute path to the directory to create"`
}

type FSMvInput

type FSMvInput struct {
	NodeID string `json:"nodeID" jsonschema:"Node ID for the remote machine"`
	Old    string `json:"oldPath" jsonschema:"Original absolute path"`
	New    string `json:"newPath" jsonschema:"New absolute destination path"`
}

type FSRmInput

type FSRmInput struct {
	NodeID string `json:"nodeID" jsonschema:"Node ID for the remote machine"`
	Path   string `json:"path" jsonschema:"Absolute path to the file/directory to securely delete"`
}

type FSTouchInput

type FSTouchInput struct {
	NodeID string `json:"nodeID" jsonschema:"Node ID for the remote machine"`
	Path   string `json:"path" jsonschema:"Absolute path to the file to create"`
}

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 ListNodesInput

type ListNodesInput struct {
	Tag string `json:"tag,omitempty" jsonschema:"Filter nodes by tag. If empty, lists all nodes."`
}

type ListNodesOutput

type ListNodesOutput struct {
	Nodes  []NodeInfo `json:"nodes" jsonschema:"List of available nodes with detailed information"`
	Status string     `json:"status" jsonschema:"Operation status"`
}

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 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 SshRunInput

type SshRunInput struct {
	NodeID  string `json:"nodeID" jsonschema:"The ID of the node to execute command on"`
	Command string `json:"command" jsonschema:"The shell command to execute"`
	Sudo    bool   `json:"sudo,omitempty" jsonschema:"Whether to use sudo to execute the command"`
}

type SshRunOutput

type SshRunOutput struct {
	Output string `json:"output" jsonschema:"Command stdout/stderr"`
	Status string `json:"status" jsonschema:"Operation status"`
	Error  string `json:"error,omitempty" jsonschema:"Error message if failed"`
}

type TransferFileInput

type TransferFileInput struct {
	NodeID     string `json:"nodeID" jsonschema:"Node ID for the remote machine"`
	LocalPath  string `json:"localPath" jsonschema:"Absolute path to the local file or directory"`
	RemotePath string `json:"remotePath" jsonschema:"Absolute path to the remote file or directory"`
}

type TransferFileOutput

type TransferFileOutput struct {
	Status string `json:"status" jsonschema:"Operation status"`
}

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

type WriteFileOutput struct {
	BytesWritten int    `json:"bytesWritten" jsonschema:"Number of bytes written"`
	Status       string `json:"status" jsonschema:"Operation status"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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