Help us shape the future of Go! Take the 2026 Go Developer Survey

cli

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 18 Imported by: 1

Documentation

Overview

Package cli is the `mcp` command tree a Cobra application mounts to serve itself over MCP: start (stdio), stream (Streamable HTTP under the estate's controls lifecycle), tools (the offline catalogue export) and the claude, cursor and vscode helpers that register the server with an editor. It keeps ophis's command spellings so existing scripts and client entries keep working.

A serving command binds the completed root when it runs, through the cobra package, and hosts the registry through the server package. Command stamps its own tree with cobra.Omit so it never binds itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(opts ...Option) *cobracmd.Command

Command builds the `mcp` command tree ophis established: start, stream and tools serve or export the completed root the command belongs to, and the claude, cursor and vscode helpers manage client configuration. The tree is stamped Omit so it never binds itself. Binding happens when a serving command runs, by which time every command is registered.

Types

type Option

type Option func(*config)

Option configures Command.

func WithBinding

func WithBinding(opts ...cobra.BindingOption) Option

WithBinding passes options to the Cobra binding built when a serving command runs: the exposure policy, flag filter, codecs, limits and grouping.

func WithLogLevel

func WithLogLevel(level *slog.LevelVar) Option

WithLogLevel shares the level variable the --log-level flag sets, so a host whose logging is already configured (GTB's root, for one) sees the change.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger replaces the default stderr text logger. It must not write to stdout: on the stdio transport that stream carries the protocol.

func WithServer

func WithServer(opts ...server.Option) Option

WithServer passes options to the protocol server: the publication mode, identity, resources and Apps. The logger is supplied by the command.

func WithServerName

func WithServerName(name string) Option

WithServerName sets the entry name the editor helpers write; the default is the root command's name.

func WithShutdownBudget

func WithShutdownBudget(budget time.Duration) Option

WithShutdownBudget bounds how long start and stream wait for the protocol drain and the binding's cleanup together on exit. The default is ten seconds.

func WithTrustedOrigins

func WithTrustedOrigins(origins ...string) Option

WithTrustedOrigins adds browser origins stream trusts besides the request's own; --origin adds more at run time.

Jump to

Keyboard shortcuts

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