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 ¶
- func Install(c Client, name string, entry map[string]any) error
- func InstallMany(targets []Client, name string, entry map[string]any, w io.Writer) error
- func IsInstalled(c Client, name string) (present bool, installed bool)
- func Locations() []string
- func SelfEntry() (map[string]any, error)
- func Uninstall(c Client, name string) error
- func UninstallMany(targets []Client, name string, w io.Writer) error
- func WickEntry(cwd, mode string) map[string]any
- type Client
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Install ¶
Install writes name → entry into the given client's config file, merging into existing mcpServers. Codex uses TOML.
func InstallMany ¶
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 ¶
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 ¶
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 UninstallMany ¶
UninstallMany removes name from every target.
func WickEntry ¶
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 ¶
Client describes one MCP-aware client and where its config file lives.
func AllClients ¶
AllClients returns every supported client with its OS-specific config path resolved (paths may not exist yet — use Detected to filter).
func Detected ¶
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 ResolveTargets ¶
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.