Documentation
¶
Overview ¶
Package install puts agentgate between an MCP host and the servers it is configured with, and takes it out again.
Every host keeps its MCP servers in a JSON file. install reads the servers from it, writes an agentgate config with those servers as upstreams, and replaces them in the host's file with a single entry that runs agentgate. The original entries are kept in a manifest, so uninstall can put the file back exactly as it was — the rest of the host's settings are never touched.
Index ¶
Constants ¶
const EntryName = "agentgate"
EntryName is the name of the one server entry agentgate leaves in a host's config.
Variables ¶
This section is empty.
Functions ¶
func GenerateConfig ¶
GenerateConfig writes the agentgate config for a host: its servers as upstreams, in shadow mode, with the packs that matter for any setup.
func GenerateTests ¶
GenerateTests writes starter policy tests for a config GenerateConfig wrote: what its packs must stop, and one thing they must let through.
Types ¶
type Candidate ¶
type Candidate struct {
Host Host
Status Status
Servers []Server
// Wrapped are the servers that will go behind agentgate; disabled ones
// stay where they are.
Wrapped []Server
}
Candidate is a host as init sees it.
type Env ¶
Env is where to look: the user's home and config directories, and the project directory for hosts with a per-project file.
type Host ¶
type Host struct {
// Name is how the host is called on the command line.
Name string `json:"name"`
// Title is how it is called in prose.
Title string `json:"title"`
// Path is its config file.
Path string `json:"path"`
// Key is the member of the file that holds the servers.
Key string `json:"key"`
// TypedEntries is set for hosts whose entries carry "type": "stdio".
TypedEntries bool `json:"typed_entries,omitempty"`
}
Host is an MCP host and where it keeps its servers.
type Installed ¶
type Installed struct {
Host Host `json:"host"`
// Servers is the host's servers member as it was, byte for byte.
Servers json.RawMessage `json:"servers"`
// Config is the agentgate config written for it.
Config string `json:"config"`
// Backup is a copy of the whole file as it was before.
Backup string `json:"backup"`
InstalledAt time.Time `json:"installed_at"`
}
Installed is one host agentgate was put in front of.
type Manifest ¶
type Manifest struct {
Hosts map[string]*Installed `json:"hosts"`
// contains filtered or unexported fields
}
Manifest is ~/.agentgate/installed.json: what init changed, so uninstall can change it back.
func LoadManifest ¶
LoadManifest reads the manifest in dir; a missing one is empty.
type Options ¶
type Options struct {
// Dir is agentgate's home, ~/.agentgate.
Dir string
// Binary is the absolute path of the agentgate executable the host
// will run.
Binary string
// Now stamps the generated files.
Now time.Time
}
Options control an install.
type Server ¶
type Server struct {
Name string
Command string
Args []string
Env map[string]string
Cwd string
URL string
Headers map[string]string
Disabled bool
// Raw is the entry exactly as the host's file had it.
Raw json.RawMessage
}
Server is one MCP server entry of a host's config.
type Status ¶
type Status string
Status is where a host stands.
const ( // StatusReady means the host has servers agentgate can be put in front of. StatusReady Status = "ready" // StatusInstalled means agentgate is already in front of it. StatusInstalled Status = "installed" // StatusEmpty means the host's config exists but lists no servers. StatusEmpty Status = "no servers" // StatusAbsent means there is no config file for the host. StatusAbsent Status = "not found" )