Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRootCommand ¶ added in v0.29.0
GetRootCommand returns the root command with the version set. This function is the main entry point for the MCPHost CLI and should be called from main.go with the appropriate version string.
func InitConfig ¶ added in v0.31.0
func InitConfig()
InitConfig initializes the configuration for MCPHost by loading config files, environment variables, and hooks configuration. It follows this priority order: 1. Command-line specified config file (--config flag) 2. Current directory config file (.mcphost or .mcp) 3. Home directory config file (~/.mcphost or ~/.mcp) 4. Environment variables (MCPHOST_* prefix) This function is automatically called by cobra before command execution.
func LoadConfigWithEnvSubstitution ¶ added in v0.31.0
LoadConfigWithEnvSubstitution loads a config file with environment variable substitution. It reads the config file, replaces any ${ENV_VAR} patterns with their corresponding environment variable values, and then parses the resulting configuration using viper. The function automatically detects JSON or YAML format based on file extension. Returns an error if the file cannot be read, environment variable substitution fails, or the configuration cannot be parsed.
Types ¶
type AgenticLoopConfig ¶ added in v0.13.1
type AgenticLoopConfig struct {
// Mode configuration
IsInteractive bool // true for interactive mode, false for non-interactive
InitialPrompt string // initial prompt for non-interactive mode
ContinueAfterRun bool // true to continue to interactive mode after initial run (--no-exit)
// UI configuration
Quiet bool // suppress all output except final response
// Context data
ServerNames []string // for slash commands
ToolNames []string // for slash commands
ModelName string // for display
MCPConfig *config.Config // for continuing to interactive mode
SessionManager *session.Manager // for session persistence
}
AgenticLoopConfig configures the behavior of the unified agentic loop. This struct controls how the main interaction loop operates, whether in interactive or non-interactive mode, and manages various UI and session options.
type Variable ¶ added in v0.16.0
type Variable struct {
Name string // The name of the variable as it appears in the script
DefaultValue string // The default value if specified using ${variable:-default} syntax
HasDefault bool // Whether this variable has a default value
}
Variable represents a script variable with optional default value. Variables can be declared in scripts using ${variable} syntax for required variables or ${variable:-default} syntax for variables with default values.