mcpconfig

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package mcpconfig writes MCP server entries into client config files (Claude Desktop, Cursor, Gemini CLI, Codex CLI, Claude Code) and detects which clients are installed on the host. Shared by the wick CLI (`wick mcp install`) and downstream apps built via wick (`./bin/app mcp install`) so the JSON/TOML merge logic lives in one place.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(c Client, name string, entry map[string]any) error

Install writes name → entry into the given client's config file, merging into existing mcpServers. Codex uses TOML.

func InstallMany

func InstallMany(targets []Client, name string, entry map[string]any, w io.Writer) error

InstallMany installs name → entry into every target. Successes/ failures are logged to w (use io.Discard for silent). Returns the last error so callers can decide whether to surface it.

func IsInstalled

func IsInstalled(c Client, name string) (present bool, installed bool)

IsInstalled reports whether name is present in the client's config. (false, false) means the file is missing or unreadable.

func Locations

func Locations() []string

Locations returns human-readable per-client config paths for the current OS, suitable for printing to a CLI user.

func SelfEntry

func SelfEntry() (map[string]any, error)

SelfEntry builds a minimal entry pointing at the current process binary's `mcp serve` subcommand — what downstream apps install into MCP clients so the client spawns the user's built app.

func Uninstall

func Uninstall(c Client, name string) error

Uninstall removes name from the given client's config.

func UninstallMany

func UninstallMany(targets []Client, name string, w io.Writer) error

UninstallMany removes name from every target.

func WickEntry

func WickEntry(cwd, mode string) map[string]any

WickEntry builds the entry written by `wick mcp install`. Non-dev modes point at the wick CLI binary with --mode and --project flags so the client can spawn wick from any CWD and rebuild/cache correctly. Dev mode falls back to "go run ." which requires the client to honor the cwd field.

Types

type Client

type Client struct {
	ID     string
	Label  string
	Path   string
	Format string // "json" or "toml-codex"
}

Client describes one MCP-aware client and where its config file lives.

func AllClients

func AllClients(cwd string) []Client

AllClients returns every supported client with its OS-specific config path resolved (paths may not exist yet — use Detected to filter).

func Detected

func Detected(cwd string) []Client

Detected returns clients whose parent config directory already exists — i.e., the host has the client installed (or has used it). Claude Code is always returned because its config is project-local.

func Find

func Find(cwd, id string) (Client, bool)

Find returns the client with the given id, or false.

func ResolveTargets

func ResolveTargets(cwd, clientID string) ([]Client, error)

ResolveTargets returns the clients to operate on. clientID="all" returns Detected(cwd); any other id returns the matching single client. Returns an error if the id doesn't match any known client.

Jump to

Keyboard shortcuts

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