install

package
v1.223.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package install writes configured MCP servers into supported client config files.

Index

Constants

View Source
const (
	ScopeProject = "project"
	ScopeUser    = "user"

	ClientClaudeCode    = "claude-code"
	ClientCursor        = "cursor"
	ClientVSCode        = "vscode"
	ClientCodex         = "codex"
	ClientGemini        = "gemini"
	ClientClaudeDesktop = "claude-desktop"
	ClientWindsurf      = "windsurf"
	ClientCline         = "cline"
	ClientClineCLI      = "cline-cli"
	ClientZed           = "zed"
	ClientOpenCode      = "opencode"
	ClientGoose         = "goose"
	// ClientCopilotCLI is the standalone `copilot` CLI product
	// (https://docs.github.com/en/copilot/how-tos/copilot-cli), distinct
	// from ClientVSCode's GitHub Copilot *extension*. Both historically
	// aliased the string "github-copilot-cli" onto ClientVSCode; see
	// normalizeClient for why that changed.
	ClientCopilotCLI  = "copilot-cli"
	ClientAntigravity = "antigravity"
	ClientMCPorter    = "mcporter"
)

Variables

Functions

func DetectClients

func DetectClients(basePath, homeDir, scope string) []string

func ValidateScope

func ValidateScope(scope string) error

Types

type ConflictFunc

type ConflictFunc func(target Target, serverName string) (bool, error)

type Installer

type Installer struct {
	// contains filtered or unexported fields
}

func New

func New(options ...Option) (*Installer, error)

func (*Installer) Install

func (i *Installer) Install(servers map[string]schema.MCPServerConfig) (*Result, error)

func (*Installer) Uninstall

func (i *Installer) Uninstall(names []string) (*Result, error)

Uninstall removes the named servers from each resolved client target. Callers are responsible for resolving the server-name list before calling (e.g. defaulting to "all currently declared" when no names are given) -- Uninstall itself just removes whatever names it's given, mirroring Install's contract of receiving an already-resolved server map.

type Option

type Option func(*Options)

func WithAllClients

func WithAllClients(all bool) Option

func WithBasePath

func WithBasePath(path string) Option

func WithClients

func WithClients(clients []string) Option

func WithDryRun

func WithDryRun(dryRun bool) Option

func WithGitignore

func WithGitignore(gitignore bool) Option

func WithHomeDir

func WithHomeDir(path string) Option

func WithOnConflict

func WithOnConflict(fn ConflictFunc) Option

func WithOverwrite

func WithOverwrite(overwrite bool) Option

func WithScope

func WithScope(scope string) Option

type Options

type Options struct {
	BasePath   string
	HomeDir    string
	Scope      string
	Clients    []string
	AllClients bool
	Overwrite  bool
	DryRun     bool
	Gitignore  bool
	OnConflict ConflictFunc
}

type Result

type Result struct {
	CreatedFiles    []string
	UpdatedFiles    []string
	SkippedServers  []string
	GitignoredFiles []string
	// AddedServers lists server entries that didn't previously exist in a
	// given target and were newly written, formatted "<client>:<name>".
	AddedServers []string
	// UpdatedServers lists server entries that existed with different
	// content and were overwritten (confirmed or --force), formatted
	// "<client>:<name>".
	UpdatedServers []string
	// UnchangedServers lists server entries that already existed with
	// identical content, so nothing was written and no overwrite
	// confirmation was asked for, formatted "<client>:<name>".
	UnchangedServers []string
	// RemovedServers lists servers removed (or, in DryRun mode, that would be
	// removed) by Uninstall, formatted "<client>:<name>".
	RemovedServers []string
	// NotFoundServers lists servers Uninstall was asked to remove that
	// weren't present in a given target, formatted "<client>:<name>". This is
	// distinct from SkippedServers, which means a declined overwrite
	// confirmation during Install.
	NotFoundServers []string
}

type Target

type Target struct {
	Client string
	Scope  string
	Path   string
	Root   string
	Format string
}

func ResolveTarget

func ResolveTarget(basePath, homeDir, scope, client string) (Target, error)

Jump to

Keyboard shortcuts

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