Documentation
¶
Overview ¶
Package hosts describes the agent hosts VegaLoad integrates with (Cursor, Claude Code, Claude Desktop) in one place: where each host keeps its MCP server config, which rules or skill files it reads, and how to detect that it is installed.
Both `vegaload init` (which writes these files) and `vegaload doctor` (which checks and can repair them) build on this package, so the two commands cannot disagree about where a host's files live. It knows nothing about the engine, protocols, or reporting.
Supported platforms are macOS, Linux and Windows. Claude Desktop is offered on macOS and Windows, because it has no official Linux build.
Index ¶
Constants ¶
const ( StatusOK = "ok" StatusMissing = "missing" StatusOutdated = "outdated" // a rules file that differs from this version's StatusOtherExe = "other binary" StatusBadArgs = "wrong args" // an MCP entry that does not run "mcp serve" StatusInvalid = "invalid" )
Artifact status values, as ArtifactStatus returns them.
Variables ¶
This section is empty.
Functions ¶
func ArtifactStatus ¶ added in v0.6.0
ArtifactStatus checks one project artifact under dir without changing anything. exePath is the binary an MCP entry should point at. The second result is a short note, or empty.
func ProjectEditors ¶ added in v0.6.0
func ProjectEditors() []string
ProjectEditors lists the host IDs `vegaload init` can set up in a project.
Types ¶
type Artifact ¶
type Artifact struct {
Kind string // "rules" or "mcp"
Host string // the host ID that reads this file: "claude-code" or "cursor"
RelPath string
Content string // rules content; empty for MCP configs
}
Artifact is one file `vegaload init` writes into a project.
func ProjectArtifacts ¶
func ProjectArtifacts() []Artifact
ProjectArtifacts lists, in a stable order, the files `vegaload init` writes for dir. doctor's --fix repairs the same files.
type ConfigState ¶
type ConfigState struct {
Config MCPConfig
Exists bool
Err error // file unreadable, or not valid JSON
Entry *Entry // nil when the file has no "vegaload" server
}
ConfigState is what Inspect found in one config file.
func Inspect ¶
func Inspect(c MCPConfig) ConfigState
Inspect reads c and reports whether it registers a "vegaload" server.
type Entry ¶
type Entry struct {
Command string `json:"command"`
Args []string `json:"args"`
Env map[string]string `json:"env,omitempty"`
}
Entry is a registered "vegaload" MCP server.
type Env ¶
type Env struct {
OS string // runtime.GOOS: "darwin", "linux" or "windows"
Home string // the user's home directory
AppData string // Windows only: the %APPDATA% folder; empty elsewhere
Dir string // the project directory being checked
LookPath func(name string) (string, error)
// DirExists reports whether a directory exists. Nil means the real
// file system; tests pass a fake so detection never depends on what
// happens to be installed on the machine running them.
DirExists func(path string) bool
}
Env is the slice of the machine a host adapter needs to answer its questions. Tests build one over a temp directory instead of the real home directory.
type Host ¶
type Host struct {
ID string
Name string
// Supported reports whether the host exists on osName. Nil means everywhere.
Supported func(osName string) bool
// Detect reports whether the host looks installed, with the evidence found.
Detect func(Env) (bool, string)
// Configs lists every MCP config file the host may read, project scope first.
Configs func(Env) []MCPConfig
// Rules lists the rules or skill files the host reads. Nil for hosts without any.
Rules func(Env) []RulesFile
}
Host is one agent host.
func Custom ¶
Custom returns a host for any MCP-capable tool, pointed at a config file the user names. It has no rules files.
func (Host) SupportedOn ¶
SupportedOn reports whether h exists on osName.
type MCPConfig ¶
type MCPConfig struct {
Host string
Scope Scope
Path string // absolute path
Key []string // path to the mcpServers object inside the JSON; nil means top level
// ReadOnly marks files doctor reports on but never rewrites,
// because VegaLoad does not own their structure.
ReadOnly bool
}
MCPConfig is one JSON file that can hold a host's "mcpServers" map.
type RulesFile ¶
RulesFile is an agent rules or skill file a host reads, with the content this version of VegaLoad ships for it.
type Scope ¶
type Scope string
Scope says whether a file lives in the project or in the user's home.
type WriteResult ¶
type WriteResult struct {
Path string `json:"path"`
Status string `json:"status"` // "created", "updated", or "skipped (exists)"
}
WriteResult records what a write did, for text and JSON reporting.
func MergeConfigFile ¶
func MergeConfigFile(path, exePath string, force bool) (WriteResult, error)
MergeConfigFile reads path (if it exists), adds or updates a "vegaload" MCP server entry pointing at exePath, and writes the result back, keeping every other key and server. See skills.MergeMCPServerConfig.
func MergeConfigFileEnv ¶ added in v0.9.1
func MergeConfigFileEnv(path, exePath string, force bool, env map[string]string) (WriteResult, error)
MergeConfigFileEnv is MergeConfigFile that also sets the given environment variables on the entry. See skills.MergeMCPServerConfigEnv for how an existing entry and its env are merged.