mcpinstall

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: MIT Imports: 9 Imported by: 0

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

View Source
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 HostByKey

func HostByKey(key string) Host

HostByKey looks up a host by its stable key. Returns nil if not registered.

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

func ResolveTargets(names []string) ([]Host, error)

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.

const (
	// ScopeAuto picks per-project where supported, otherwise per-user.
	ScopeAuto Scope = iota
	// ScopeProject forces per-project config; errors if the host doesn't
	// support it.
	ScopeProject
	// ScopeUser forces per-user (global) config.
	ScopeUser
)

func (Scope) String

func (s Scope) String() string

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.

Jump to

Keyboard shortcuts

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