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 ¶
- func Command(opts ...Option) *cobracmd.Command
- type Option
- func WithBinding(opts ...cobra.BindingOption) Option
- func WithLogLevel(level *slog.LevelVar) Option
- func WithLogger(logger *slog.Logger) Option
- func WithServer(opts ...server.Option) Option
- func WithServerName(name string) Option
- func WithShutdownBudget(budget time.Duration) Option
- func WithTrustedOrigins(origins ...string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func 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 ¶
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 ¶
WithLogger replaces the default stderr text logger. It must not write to stdout: on the stdio transport that stream carries the protocol.
func WithServer ¶
WithServer passes options to the protocol server: the publication mode, identity, resources and Apps. The logger is supplied by the command.
func WithServerName ¶
WithServerName sets the entry name the editor helpers write; the default is the root command's name.
func WithShutdownBudget ¶
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 ¶
WithTrustedOrigins adds browser origins stream trusts besides the request's own; --origin adds more at run time.