clients

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const (
	Claude = "claude"
	Codex  = "codex"
)

Variables

View Source
var All = []string{Claude, Codex}

All lists supported clients in display order.

Functions

func Available

func Available(client string) bool

Available reports whether a client's CLI is on PATH.

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 GitRoot

func GitRoot() string

GitRoot returns the current git repository root, or "".

func Register

func Register(client, name string, cfg Config, scope string) error

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

func Unregister(client, name, scope string) error

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.

Jump to

Keyboard shortcuts

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