Documentation
¶
Overview ¶
Package clients registers MCP servers with Claude Code and Codex, and reads back what each client currently has configured.
Registration always goes through the clients' own CLIs (`claude mcp add-json`, `codex mcp add`) so toolshed never writes their config formats itself. Detection reads the config files directly because it's ~1000x faster than `claude mcp list`, which health-checks every server.
Index ¶
Constants ¶
const ( Claude = "claude" Codex = "codex" )
Variables ¶
var All = []string{Claude, Codex}
All lists supported clients in display order.
Functions ¶
func AvailableClients ¶
func AvailableClients() []string
AvailableClients returns the installed clients, in display order.
func Detect ¶
func Detect() map[string]*Installation
Detect returns every server registered in Claude Code or Codex, keyed by name (Codex's underscore names are folded into their hyphen form). Unreadable or missing config files are treated as empty.
func Register ¶
Register adds (or replaces) a server in one client. scope applies to Claude only ("user", "local" or "project"); Codex registrations are always global.
Replacing means remove-then-add, since neither CLI has an "update". If the add fails, the previous registration is put back, so a failed update never leaves the tool uninstalled.
func Unregister ¶
Unregister removes a server from one client.
Types ¶
type Config ¶
type Config struct {
Type string `json:"type"` // "stdio" or "http"
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
URL string `json:"url,omitempty"`
HeadersHelper string `json:"headersHelper,omitempty"`
}
Config is a server registration, in Claude Code's add-json shape.
type Installation ¶
type Installation struct {
Name string
ClaudeScope string // "user", "project", "local", or "" when not in Claude
Codex bool
Config Config // Claude's config if present, else Codex's
CodexConfig Config // Codex's own config, when Codex has it
}
Installation is where one server name is registered.
func (Installation) Clients ¶
func (i Installation) Clients() []string
Clients returns the clients this server is registered in.