cli

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0, MIT Imports: 17 Imported by: 0

Documentation

Overview

Package cli builds the template-mcp command tree.

The root command wires two transport subcommands onto the same transport-agnostic MCP server from internal/mcpserver: stdio, for clients that spawn the process and speak JSON-RPC over its standard streams, and http, for networked clients using the Streamable HTTP transport. Each transport lives in its own file (stdio.go, http.go) so a consumer can keep one transport and delete the other by removing a single file and its registration in NewRootCommand.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRootCommand

func NewRootCommand(options Options) *cobra.Command

NewRootCommand creates the template-mcp Cobra command tree.

The root command does no work on its own; it wires the two transport subcommands (stdio and http) onto the same MCP server. To produce a single-transport repository, delete the unwanted subcommand file and its registration call below.

Types

type BuildInfo

type BuildInfo struct {
	// Version is the release version.
	Version string
	// Commit is the source commit used to build the binary.
	Commit string
	// Date is the build timestamp.
	Date string
}

BuildInfo describes linker-injected build metadata printed by --version.

type Options

type Options struct {
	// In supplies the command input stream. For the stdio transport this is
	// the client's JSON-RPC message stream.
	In io.Reader
	// Out receives machine-readable command output, including the stdio
	// transport's JSON-RPC messages.
	Out io.Writer
	// Err receives diagnostics and human-readable status, including the MCP
	// server's logs.
	Err io.Writer
	// Build controls the root command version output.
	Build BuildInfo
	// Viper is the configuration instance used by the command tree. Flags are
	// bound to environment variables named after [templateinfo.EnvPrefix],
	// for example TEMPLATE_MCP_ADDR.
	Viper *viper.Viper
}

Options customizes root command construction.

Jump to

Keyboard shortcuts

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