shed

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 15 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 shed implements toolshed's operations (install, uninstall, exec, probe) on top of the registry, the client adapters and the keyring. The CLI and the TUI are both thin front ends over this package.

Index

Constants

This section is empty.

Variables

View Source
var ErrPending = errors.New("added by your agent and not approved yet")

ErrPending is returned for tools an agent added that the user hasn't approved yet.

View Source
var PackageProbeTimeout = 90 * time.Second

PackageProbeTimeout is the longer bound for npx and uvx servers, whose first start downloads the package.

View Source
var ProbeTimeout = 20 * time.Second

ProbeTimeout bounds how long Probe waits for a server.

Functions

func BuildConfig

func BuildConfig(e *registry.Entry, vals Values, scope string) (clients.Config, error)

BuildConfig produces the client registration for an entry. Secret values are written to the keyring and the server is wrapped in `toolshed exec`; without a keyring they fall back to plain env vars in the client config.

For project scope the wrapper is the bare `toolshed` command rather than this binary's absolute path, because .mcp.json is shared through the repository and teammates have toolshed installed in other places.

func CellarToOpt

func CellarToOpt(p string) string

CellarToOpt rewrites /…/Cellar/<formula>/<version>/rest to /…/opt/<formula>/rest.

func CheckApproved added in v0.1.2

func CheckApproved(e *registry.Entry) error

CheckApproved refuses tools an agent added until the user has seen what they run and approved them. Install and Probe both call it, so no front end (CLI, TUI, MCP) can start an unapproved command.

func CheckCommand

func CheckCommand(e *registry.Entry) error

CheckCommand verifies a local server's command can be found, so a typo fails at install instead of as a silent "failed to connect" in the client.

func EntryEnv

func EntryEnv(e *registry.Entry) []string

EntryEnv is ExecEnv for running an entry directly (used by Probe): fixed env, input defaults, and the entry's secrets from the keyring.

func ExecArgs

func ExecArgs(e *registry.Entry, refs []SecretRef) []string

ExecArgs builds the self-contained arguments for `toolshed exec`:

exec <id> --secret KEY=group ... -- <command> <args...>

Everything exec needs is in the arguments, so a registered server keeps working even if the registry file moves or isn't visible to the client.

func ExecEnv

func ExecEnv(extra map[string]string, refs []SecretRef) []string

ExecEnv returns the environment for running a server: the current environment plus extra fixed values, with secrets from the keyring filled in for any key not already set (explicit env always wins).

func Install

func Install(e *registry.Entry, vals Values, opts InstallOptions) ([]string, error)

Install stores secrets, builds the client config and registers the tool with every target client. It fails if any client fails.

func SelfPath

func SelfPath() (string, error)

SelfPath is the absolute path of the running toolshed binary, with Homebrew's versioned Cellar path rewritten to the stable opt symlink so registrations survive `brew upgrade`.

func Targets

func Targets(e *registry.Entry, opts InstallOptions) []string

Targets returns the clients an install would write to.

func Uninstall

func Uninstall(reg *registry.Registry, e *registry.Entry, inst *clients.Installation, purge bool) error

Uninstall removes the tool from every client it's registered in. With purge it also deletes its secrets, except groups still used by another installed tool.

Types

type InstallOptions

type InstallOptions struct {
	Scope   string   // "user" (default) or "project"; project applies to Claude only
	Clients []string // targets; empty means every available client the entry supports
}

InstallOptions controls where a tool is installed.

type SecretRef

type SecretRef struct{ Key, Group string }

SecretRef names a keyring entry to load into the environment.

type Tool

type Tool struct {
	Name        string
	Description string
	Destructive bool // the server says this tool may modify or delete things
}

Tool is one tool a server advertises.

func Probe

func Probe(ctx context.Context, e *registry.Entry) ([]Tool, error)

Probe starts (or connects to) a server, performs the MCP handshake and returns the tools it advertises. It is the "does this actually work?" check: if Probe succeeds, Claude Code and Codex will be able to talk to it.

type Values

type Values map[string]string

Values maps input keys to the values the user chose.

func Resolve

func Resolve(e *registry.Entry, inst *clients.Installation, overrides Values) (Values, []registry.Input)

Resolve fills in input values from, in order: explicit overrides, the currently installed config (so updates keep earlier choices), the keyring (secrets), and defaults. It returns the values plus the required inputs that are still missing, which the caller should prompt for.

Jump to

Keyboard shortcuts

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