registry

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: 10 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 registry loads, validates and edits toolshed's catalog of tools.

The catalog is the built-in examples (registry.yaml, compiled in) with the user's own registry layered on top (~/.toolshed/registry.yaml). User entries win on ID collisions, and `examples: false` in the user file hides the built-ins entirely.

Index

Constants

View Source
const (
	SourceBuiltin = "builtin"
	SourceUser    = "user"
)
View Source
const (
	KindCommand = "command" // any executable that speaks MCP over stdio
	KindNPX     = "npx"     // an npm package run with `npx -y`
	KindUVX     = "uvx"     // a Python package run with `uvx`
	KindURL     = "url"     // a remote MCP server
)

Kinds of tool a Spec can describe.

Variables

This section is empty.

Functions

func AddUserEntry

func AddUserEntry(e Entry) error

AddUserEntry validates e and appends it to the user registry, replacing any existing user entry with the same ID. Comments elsewhere in the file are preserved.

func ApproveUserEntry added in v0.1.2

func ApproveUserEntry(id string) error

ApproveUserEntry clears the pending flag on a tool an agent added, so it can be started and installed.

func EnsureUserFile

func EnsureUserFile() error

EnsureUserFile creates the user registry (with an explanatory header) if it doesn't exist yet.

func Home

func Home() string

Home is toolshed's state directory: $TOOLSHED_HOME or ~/.toolshed.

func IsValidID

func IsValidID(s string) bool

IsValidID reports whether s is a usable tool ID (kebab-case).

func RemoveUserEntry

func RemoveUserEntry(id string) error

RemoveUserEntry deletes a tool from the user registry. Built-in examples can't be removed (hide them all with `examples: false`).

func SuggestID

func SuggestID(kind, source string) string

SuggestID derives a tool ID from what the user typed: "@acme/mcp-server-notes" → "notes", "https://mcp.deepwiki.com/mcp" → "deepwiki".

func UserPath

func UserPath() string

UserPath is the user registry: $TOOLSHED_REGISTRY or ~/.toolshed/registry.yaml.

func ValidateEntry

func ValidateEntry(e *Entry) error

ValidateEntry checks one entry for mistakes that would otherwise surface as confusing failures inside Claude Code or Codex.

Types

type Entry

type Entry struct {
	ID          string            `yaml:"id"`
	Name        string            `yaml:"name,omitempty"`
	Description string            `yaml:"description,omitempty"`
	Command     string            `yaml:"command,omitempty"`        // stdio server: executable (on PATH or absolute)
	Args        []string          `yaml:"args,omitempty"`           // stdio server: arguments
	URL         string            `yaml:"url,omitempty"`            // remote server (streamable HTTP)
	HeaderCmd   string            `yaml:"headers_helper,omitempty"` // remote: command printing JSON headers (Claude only)
	Env         map[string]string `yaml:"env,omitempty"`            // fixed environment variables
	Inputs      []Input           `yaml:"inputs,omitempty"`         // values prompted for at install
	Clients     []string          `yaml:"clients,omitempty"`        // restrict to "claude" and/or "codex"

	// Pending marks a tool an agent added through `toolshed mcp`. toolshed
	// won't start or install it until the user approves it (`toolshed
	// approve`, or the TUI), so an agent can't run a command of its choosing.
	Pending bool `yaml:"pending,omitempty"`

	Source string `yaml:"-"` // "builtin" or "user"
}

Entry is one tool: an MCP server toolshed can install into Claude Code and Codex. The yaml tags are the public file schema (docs/registry.md).

func (*Entry) CommandLine added in v0.1.2

func (e *Entry) CommandLine() string

CommandLine is what toolshed would run (or connect to) for this entry, for showing to the user before they approve it.

func (*Entry) DisplayName

func (e *Entry) DisplayName() string

DisplayName falls back to the ID when no name is set.

func (*Entry) IsRemote

func (e *Entry) IsRemote() bool

IsRemote reports whether the entry is a remote (HTTP) server.

func (*Entry) SecretGroup

func (e *Entry) SecretGroup(in Input) string

SecretGroup returns the keyring group an input's value is stored under.

func (*Entry) SecretKeys added in v0.1.2

func (e *Entry) SecretKeys() []string

SecretKeys lists the entry's secret inputs (what it gets from the keyring).

func (*Entry) Summary

func (e *Entry) Summary() string

Summary is the first line of the description.

func (*Entry) SupportsClient

func (e *Entry) SupportsClient(client string) bool

SupportsClient reports whether the entry may be installed into client. Remote servers with a headers helper are Claude-only (Codex has no equivalent), regardless of the clients list.

type File

type File struct {
	Examples *bool   `yaml:"examples,omitempty"` // user file only: false hides the built-in examples
	Tools    []Entry `yaml:"tools"`
}

File is the on-disk shape of a registry.

func Parse

func Parse(data []byte) (*File, error)

Parse decodes and validates a registry document.

type Input

type Input struct {
	Key      string `yaml:"key"`
	Label    string `yaml:"label,omitempty"`
	Help     string `yaml:"help,omitempty"`
	Secret   bool   `yaml:"secret,omitempty"`
	Optional bool   `yaml:"optional,omitempty"`
	Default  string `yaml:"default,omitempty"`
	Share    string `yaml:"share,omitempty"` // keyring group shared across tools; defaults to the entry ID
}

Input is a value the user provides at install time, passed to the server as an environment variable. Secret inputs live in the OS keyring.

type Registry

type Registry struct {
	Entries  []*Entry // display order: user entries first, then built-ins
	UserPath string
	// contains filtered or unexported fields
}

Registry is the merged, validated catalog.

func Load

func Load() (*Registry, error)

Load reads the built-in and user registries and merges them.

func (*Registry) Get

func (r *Registry) Get(id string) *Entry

Get returns the entry with the given ID, or nil.

type Spec

type Spec struct {
	Kind        string
	Source      string // command line, package (+ args), or URL
	ID          string // optional; derived from Source when empty
	Name        string
	Description string
	Secrets     []string // env vars to prompt for and keep in the keyring
}

Spec is the short form of a new tool, as typed by a person (or an agent): a kind plus "what to run". The TUI's add form, `toolshed add` and `toolshed mcp` all build entries through it.

func (Spec) Entry

func (s Spec) Entry() (Entry, error)

Entry converts the spec into a validated registry entry.

Jump to

Keyboard shortcuts

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