cmd

package
v0.0.93 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

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

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-kubernetes [flags]                 # Starts the MCP server (default)
mcp-kubernetes serve [flags]           # Explicitly starts the MCP server
mcp-kubernetes version                 # Shows version information
mcp-kubernetes self-update             # Updates to latest release
mcp-kubernetes 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-kubernetes serve --transport stdio           # Default STDIO transport
mcp-kubernetes serve --transport sse --http-addr :8080 --sse-endpoint /sse
mcp-kubernetes serve --transport streamable-http --http-addr :9000 --http-endpoint /mcp

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

Index

Constants

View Source
const (
	OAuthProviderDex    = server.OAuthProviderDex
	OAuthProviderGoogle = server.OAuthProviderGoogle
)

OAuth provider constants - use server package constants for consistency

View Source
const (
	OAuthStorageTypeMemory = server.OAuthStorageTypeMemory
	OAuthStorageTypeValkey = server.OAuthStorageTypeValkey
)

Storage type constants - re-exported from server package for convenience.

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 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 CAPIModeConfig added in v0.0.68

type CAPIModeConfig struct {
	// Enabled enables CAPI federation mode for multi-cluster operations
	Enabled bool

	// Cache configuration
	CacheTTL             string
	CacheMaxEntries      int
	CacheCleanupInterval string

	// OAuthTokenLifetime is the expected lifetime of OAuth tokens from your provider.
	// If CacheTTL exceeds this value, a warning is logged. This helps prevent
	// authentication failures from using cached clients with expired tokens.
	// Defaults to 1 hour if not specified.
	OAuthTokenLifetime string

	// Connectivity configuration
	ConnectivityTimeout        string
	ConnectivityRetryAttempts  int
	ConnectivityRetryBackoff   string
	ConnectivityRequestTimeout string
	ConnectivityQPS            float32
	ConnectivityBurst          int
}

CAPIModeConfig holds CAPI federation mode configuration.

type OAuthServeConfig added in v0.0.43

type OAuthServeConfig struct {
	Enabled                            bool
	BaseURL                            string
	Provider                           string // "dex" or "google"
	GoogleClientID                     string
	GoogleClientSecret                 string
	DexIssuerURL                       string
	DexClientID                        string
	DexClientSecret                    string
	DexConnectorID                     string // optional: bypasses connector selection screen
	DexCAFile                          string // optional: CA certificate file for Dex TLS verification
	DexKubernetesAuthenticatorClientID string // optional: enables cross-client audience for K8s API auth
	DisableStreaming                   bool
	RegistrationToken                  string
	AllowPublicRegistration            bool
	AllowInsecureAuthWithoutState      bool
	AllowPrivateURLs                   bool // skip private IP validation for internal deployments
	MaxClientsPerIP                    int
	EncryptionKey                      string

	// Storage configuration
	Storage server.OAuthStorageConfig
}

OAuthServeConfig holds OAuth-specific configuration.

type OAuthStorageConfig added in v0.0.78

type OAuthStorageConfig = server.OAuthStorageConfig

OAuthStorageConfig holds configuration for OAuth token storage backend.

type OAuthStorageType added in v0.0.78

type OAuthStorageType = server.OAuthStorageType

OAuthStorageType represents the type of token storage backend.

type ServeConfig added in v0.0.43

type ServeConfig struct {
	// Transport settings
	Transport string
	HTTPAddr  string

	// Endpoint paths
	SSEEndpoint     string
	MessageEndpoint string
	HTTPEndpoint    string

	// Kubernetes client settings
	NonDestructiveMode bool
	DryRun             bool
	QPSLimit           float32
	BurstLimit         int
	DebugMode          bool
	InCluster          bool

	// OAuth configuration
	OAuth           OAuthServeConfig
	DownstreamOAuth bool

	// CAPI Mode configuration (multi-cluster federation)
	CAPIMode CAPIModeConfig
}

ServeConfig holds all configuration for the serve command.

type ValkeyStorageConfig added in v0.0.78

type ValkeyStorageConfig = server.ValkeyStorageConfig

ValkeyStorageConfig holds configuration for Valkey storage backend.

Jump to

Keyboard shortcuts

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