Documentation
¶
Overview ¶
Package mcpinstall configures supported AI coding agents to use devx as their MCP server. Each agent host has its own config file location and format; the Host interface hides those differences behind a uniform install/uninstall/status surface.
Index ¶
Constants ¶
const ServerEntryKey = "devx"
ServerEntryKey is the conventional name devx registers itself under in every host's MCP config. Stable string used for idempotency checks across installs.
Variables ¶
This section is empty.
Functions ¶
func AllHostKeys ¶
func AllHostKeys() []string
AllHostKeys returns the registered host keys in alphabetical order.
Types ¶
type Host ¶
type Host interface {
// Key is the stable lookup identifier (e.g. "claude-code").
Key() string
// DisplayName is the human-friendly name shown in tables and logs.
DisplayName() string
// Detect returns true if the host appears installed on this machine.
Detect() bool
// Status reports the current install state without making changes.
Status(opts Options) (Status, error)
// Install ensures the devx MCP entry exists in the host's config.
// Idempotent: re-running with the same Options is a no-op.
Install(opts Options) (InstallResult, error)
// Uninstall removes the devx MCP entry. Leaves all other host
// configuration untouched.
Uninstall(opts Options) (InstallResult, error)
}
Host is the contract every agent-tool adapter implements.
func Hosts ¶
func Hosts() []Host
Hosts returns the registered set of agent-host adapters. Adding support for a new host means adding an entry here — every other place in the package is host-agnostic.
Config paths and detection heuristics are best-effort and current as of the 2026 ecosystem. Hosts whose config format/location is unstable or whose integration model is plugin-based use the manualHost adapter and emit a copy-pasteable snippet instead.
func ResolveTargets ¶
ResolveTargets parses a list of host keys, returning matched hosts. If names is empty, returns every detected host. An unknown key produces an error with a hint of supported names.
type InstallResult ¶
type InstallResult struct {
HostKey string `json:"host"`
DisplayName string `json:"display_name"`
OK bool `json:"ok"`
Changed bool `json:"changed"`
ConfigPath string `json:"config_path,omitempty"`
Scope string `json:"scope,omitempty"`
Message string `json:"message"`
}
InstallResult is returned per host after an install/uninstall action.
type Options ¶
type Options struct {
// ProjectDir is the absolute path used as the root for project-scoped
// installs. Empty means cwd at call time.
ProjectDir string
// DevxBinary is the absolute path to the devx binary to invoke via
// `command`. Empty falls back to os.Executable().
DevxBinary string
// Scope controls per-project vs per-user when both are supported.
Scope Scope
// DryRun skips disk writes; just reports what would happen.
DryRun bool
}
Options control install behavior across hosts.
type Scope ¶
type Scope int
Scope picks where to write a host's MCP config. Project scope keeps each repo's tool set sandboxed and travels with the codebase; user scope is the only option for hosts that don't have per-project config.
type Status ¶
type Status struct {
HostKey string `json:"host"`
DisplayName string `json:"display_name"`
Detected bool `json:"detected"`
Installed bool `json:"installed"`
ConfigPath string `json:"config_path,omitempty"`
Scope string `json:"scope,omitempty"`
Command string `json:"command,omitempty"`
Note string `json:"note,omitempty"`
}
Status describes the current state of a host's devx MCP install.