Documentation
¶
Overview ¶
Package app provides the entry point for the toolhive command-line application.
Index ¶
- Constants
- Variables
- func AddOIDCFlags(cmd *cobra.Command)
- func AddRunFlags(cmd *cobra.Command, config *RunFlags)
- func BuildRunnerConfig(ctx context.Context, runConfig *RunFlags, serverOrImage string, ...) (*runner.RunConfig, error)
- func GetStringFlagOrEmpty(cmd *cobra.Command, flagName string) string
- func IsCompletionCommand(args []string) bool
- func IsOIDCEnabled(cmd *cobra.Command) bool
- func NewRootCmd(enableUpdates bool) *cobra.Command
- func SetSecretsProvider(provider secrets.ProviderType) error
- func ValidateAndNormaliseHostFlag(host string) (string, error)
- type AuthInfo
- type RunFlags
Constants ¶
const ( // FormatJSON is the JSON output format FormatJSON = "json" // FormatText is the text output format FormatText = "text" )
Output format constants
Variables ¶
var OtelCmd = &cobra.Command{
Use: "otel",
Short: "Manage OpenTelemetry configuration",
Long: "Configure OpenTelemetry settings for observability and monitoring of MCP servers.",
}
OtelCmd is the parent command for OpenTelemetry configuration
Functions ¶
func AddOIDCFlags ¶
AddOIDCFlags adds OIDC validation flags to the provided command.
func AddRunFlags ¶ added in v0.2.1
AddRunFlags adds all the run flags to a command
func BuildRunnerConfig ¶ added in v0.2.1
func BuildRunnerConfig( ctx context.Context, runConfig *RunFlags, serverOrImage string, cmdArgs []string, debugMode bool, cmd *cobra.Command, ) (*runner.RunConfig, error)
BuildRunnerConfig creates a runner.RunConfig from the configuration
func GetStringFlagOrEmpty ¶
GetStringFlagOrEmpty tries to get the string value of the given flag. If the flag doesn't exist or there's an error, it returns an empty string.
func IsCompletionCommand ¶
IsCompletionCommand checks if the command being run is the completion command
func IsOIDCEnabled ¶
IsOIDCEnabled returns true if OIDC validation is enabled for the given command. OIDC validation is considered enabled if either the OIDC issuer or the JWKS URL flag is provided.
func NewRootCmd ¶
NewRootCmd creates a new root command for the ToolHive CLI.
func SetSecretsProvider ¶
func SetSecretsProvider(provider secrets.ProviderType) error
SetSecretsProvider sets the secrets provider type in the configuration. It validates the input, tests the provider functionality, and updates the configuration. Choices are `encrypted`, `1password`, and `none`.
func ValidateAndNormaliseHostFlag ¶ added in v0.0.34
ValidateAndNormaliseHostFlag validates and normalizes the host flag resolving it to an IP address if hostname is provided
Types ¶
type AuthInfo ¶ added in v0.0.40
AuthInfo contains authentication information extracted from WWW-Authenticate header
type RunFlags ¶ added in v0.2.1
type RunFlags struct {
// Transport and proxy settings
Transport string
ProxyMode string
Host string
ProxyPort int
TargetPort int
TargetHost string
// Server configuration
Name string
Group string
PermissionProfile string
Env []string
Volumes []string
Secrets []string
// Security and audit
AuthzConfig string
AuditConfig string
EnableAudit bool
K8sPodPatch string
// Image verification
CACertPath string
VerifyImage string
// OIDC configuration
ThvCABundle string
JWKSAuthTokenFile string
JWKSAllowPrivateIP bool
// Telemetry configuration
OtelEndpoint string
OtelServiceName string
OtelSamplingRate float64
OtelHeaders []string
OtelInsecure bool
OtelEnablePrometheusMetricsPath bool
OtelEnvironmentVariables []string // renamed binding to otel-env-vars
// Network isolation
IsolateNetwork bool
// Labels
Labels []string
// Execution mode
Foreground bool
// Tools filter
ToolsFilter []string
// Configuration import
FromConfig string
// Ignore functionality
IgnoreGlobally bool
PrintOverlays bool
}
RunFlags holds the configuration for running MCP servers