cmd

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package cmd provides the command-line interface for mcp-capi.

This package implements a Cobra-based CLI with multiple subcommands:

  • serve: Starts the MCP server (default behavior when no subcommand is provided)
  • version: Displays the application version
  • self-update: Updates the binary to the latest version from GitHub releases

The CLI maintains backwards compatibility by running the serve command when no subcommand is specified, preserving the original behavior of the application.

Command Structure:

mcp-capi [flags]                       # Starts the MCP server (default)
mcp-capi serve [flags]                 # Explicitly starts the MCP server
mcp-capi version                       # Shows version information
mcp-capi self-update                   # Updates to latest release
mcp-capi help [command]                # Shows help information

The serve command supports multiple transport options:

  • stdio: Standard input/output (default) - for command-line integration
  • sse: Server-Sent Events over HTTP - for web-based clients
  • streamable-http: Streamable HTTP transport - for HTTP-based integration

Transport Configuration Examples:

mcp-capi serve --transport stdio             # Default STDIO transport
mcp-capi serve --transport sse --http-addr :8080 --sse-endpoint /sse
mcp-capi serve --transport streamable-http --http-addr :9000 --http-endpoint /mcp

The serve command also supports configuration flags for controlling Cluster API client behavior, including non-destructive mode, dry-run mode, and provider configuration settings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Execute is the main entry point for the CLI application. It initializes and executes the root command, which in turn handles subcommands and flags. This function is called by main.main().

func RunServe added in v0.0.26

func RunServe(cfg ServeConfig) error

RunServe contains the main server logic with support for multiple transports This function is exported to allow testing

func SetVersion

func SetVersion(v string)

SetVersion sets the version for the root command. This function is typically called from the main package to inject the application version at build time.

Types

type ServeConfig added in v0.1.0

type ServeConfig struct {
	KubeconfigPath  string
	Transport       string
	HTTPAddr        string
	SSEEndpoint     string
	MessageEndpoint string
	HTTPEndpoint    string
	// OAuth is nil when authentication is disabled.
	OAuth *oauth.Config
	// DownstreamOAuth makes the server act as the caller against Kubernetes.
	DownstreamOAuth bool
	// ReadOnly registers only reading tools and refuses every mutating call.
	ReadOnly bool
	// GitOpsGuard refuses mutating calls on GitOps- or Helm-owned objects.
	GitOpsGuard bool
	// ExposeKubeconfig offers capi_get_kubeconfig and Secret-carrying backups.
	ExposeKubeconfig bool
	Debug            bool
}

ServeConfig is the resolved configuration of the serve command.

Jump to

Keyboard shortcuts

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