mcp

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	E_INVALID          = "E_INVALID"
	E_CONFIRM_REQUIRED = "E_CONFIRM_REQUIRED"
	E_NOT_FOUND        = "E_NOT_FOUND"
	E_CONFLICT         = "E_CONFLICT"
	E_INTERNAL         = "E_INTERNAL"
)
View Source
const (
	TransportStdio = "stdio"
	TransportHTTP  = "http"
)

Variables

This section is empty.

Functions

func BranchAdapter

func BranchAdapter(ctx context.Context, a *app.App, in BranchInput) (any, error)

func Err

func Err(code, msg string, details map[string]any) error

func ExecuteAdapter

func ExecuteAdapter(ctx context.Context, a *app.App, in ExecuteInput) (any, error)

func KillAdapter

func KillAdapter(ctx context.Context, a *app.App, in KillInput) (any, error)

func RunAdapter

func RunAdapter(ctx context.Context, a *app.App, in RunInput) (any, error)

func SetRateLimit

func SetRateLimit(tool string, perMinute int)

SetRateLimit sets a simple per-minute limit for a given tool.

func StartServer

func StartServer(ctx context.Context, application *app.App, opts Options) error

StartServer wires the MCP server using the Go SDK when built with `-tags mcp`. Note: This file references the MCP Go SDK. Ensure the module is added:

go get github.com/modelcontextprotocol/go-sdk

API calls here are structured to match the SDK’s server + stdio transport.

func StatusAdapter

func StatusAdapter(ctx context.Context, a *app.App, in StatusInput) (any, error)

Types

type BranchInput

type BranchInput struct {
	Target   string `json:"target,omitempty" jsonschema:"Source VM ID or alias; defaults to HEAD"`
	Alias    string `json:"alias,omitempty" jsonschema:"Alias for the new VM"`
	Checkout bool   `json:"checkout,omitempty" jsonschema:"Switch HEAD to the new VM after creation"`
	Count    int    `json:"count,omitempty" jsonschema:"Number of branches to create (default 1)"`
}

BranchInput defines inputs for vers.branch

type Error

type Error struct {
	Code    string
	Message string
	Details map[string]any
}

func (*Error) Error

func (e *Error) Error() string

type ExecuteInput

type ExecuteInput struct {
	Target         string   `json:"target,omitempty" jsonschema:"VM ID or alias; defaults to HEAD"`
	Command        []string `json:"command" jsonschema:"Command and args to run"`
	TimeoutSeconds int      `json:"timeoutSeconds,omitempty" jsonschema:"Execution timeout in seconds"`
}

ExecuteInput defines inputs for vers.execute

type KillInput

type KillInput struct {
	Targets          []string `json:"targets,omitempty" jsonschema:"VM identifiers; empty means HEAD VM"`
	SkipConfirmation bool     `json:"skipConfirmation,omitempty" jsonschema:"Required for destructive operations in MCP"`
}

KillInput defines inputs for vers.kill

type Options

type Options struct {
	// Transport selects the server transport. Supported: "stdio", "http".
	Transport string
	// Addr is the listen address for HTTP transport.
	Addr string
	// AllowInsecureSetKey toggles a local-only tool to set API key via MCP.
	AllowInsecureSetKey bool
	// Verbose enables extra debug logging.
	Verbose bool
}

Options configures the MCP server startup.

type RunInput

type RunInput struct {
	MemSizeMib  int64  `json:"memSizeMib,omitempty" jsonschema:"VM memory size in MiB"`
	VcpuCount   int64  `json:"vcpuCount,omitempty" jsonschema:"Number of vCPUs"`
	RootfsName  string `json:"rootfsName,omitempty" jsonschema:"Rootfs image name"`
	KernelName  string `json:"kernelName,omitempty" jsonschema:"Kernel image name"`
	FsSizeVmMib int64  `json:"fsSizeVmMib,omitempty" jsonschema:"VM filesystem size in MiB"`
	VMAlias     string `json:"vmAlias,omitempty" jsonschema:"Alias for the root VM"`
}

RunInput defines inputs for vers.run

type StatusInput

type StatusInput struct {
	Target string `json:"target,omitempty" jsonschema:"VM ID or alias for VM-specific status"`
}

StatusInput is the input schema for vers.status tool.

type ToolMetricView

type ToolMetricView struct {
	Calls           int64  `json:"calls"`
	Errors          int64  `json:"errors"`
	TotalDurationMs int64  `json:"totalDurationMs"`
	LastError       string `json:"lastError,omitempty"`
	RatePerMinute   int    `json:"ratePerMinute"`
	UsedInWindow    int    `json:"usedInWindow"`
	WindowResetSec  int64  `json:"windowResetSec"`
}

ToolMetricView is a read-only view for reporting via vers.metrics.

type ToolMetrics

type ToolMetrics struct {
	Calls         int64
	Errors        int64
	TotalDuration time.Duration
	LastError     string
}

type TunnelInput added in v0.6.0

type TunnelInput struct {
	Target     string `json:"target,omitempty" jsonschema:"VM ID or alias; defaults to HEAD"`
	LocalPort  int    `json:"localPort" jsonschema:"Local port to listen on (0 for auto)"`
	RemotePort int    `json:"remotePort" jsonschema:"Remote port on the VM to forward to"`
	RemoteHost string `json:"remoteHost,omitempty" jsonschema:"Remote host from the VM perspective; defaults to localhost"`
}

TunnelInput defines inputs for vers.tunnel

Jump to

Keyboard shortcuts

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