config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

internal/config/config.go

Index

Constants

View Source
const (
	// DefaultAutoScalingMultiplier is the default multiplier for scaling up/down (25%)
	DefaultAutoScalingMultiplier float32 = 0.25

	// DefaultTargetCPUUtilization is the default target CPU utilization for auto-scaling
	DefaultTargetCPUUtilization int32 = 70

	// DefaultMinConcurrentTasks is the default minimum number of concurrent tasks
	DefaultMinConcurrentTasks int32 = 1

	// DefaultMaxConcurrentTasks is the default maximum number of concurrent tasks
	DefaultMaxConcurrentTasks int32 = 10

	// DefaultScaleUpCooldown is the default cooldown period for scaling up
	DefaultScaleUpCooldown = 30 * time.Second

	// DefaultScaleDownCooldown is the default cooldown period for scaling down
	DefaultScaleDownCooldown = 5 * time.Minute

	// DefaultMetricsInterval is the default interval for collecting metrics
	DefaultMetricsInterval = 15 * time.Second
)

Auto-scaling constants

View Source
const (
	// DefaultTaskTimeout is the default timeout for tasks
	DefaultTaskTimeout = 30 * time.Minute

	// DefaultRetryAttempts is the default number of retry attempts
	DefaultRetryAttempts int32 = 3

	// DefaultBackoffMultiplier is the default backoff multiplier for retries
	DefaultBackoffMultiplier float32 = 2.0

	// DefaultInitialBackoff is the default initial backoff duration
	DefaultInitialBackoff = 1 * time.Second

	// DefaultMaxBackoff is the default maximum backoff duration
	DefaultMaxBackoff = 60 * time.Second
)

Task scheduler constants

View Source
const (
	// DefaultHealthCheckInterval is the default interval for health checks
	DefaultHealthCheckInterval = 30 * time.Second

	// DefaultHealthCheckTimeout is the default timeout for health checks
	DefaultHealthCheckTimeout = 5 * time.Second

	// DefaultReconnectInterval is the default interval for reconnection attempts
	DefaultReconnectInterval = 10 * time.Second

	// DefaultMaxReconnectAttempts is the default maximum number of reconnection attempts
	DefaultMaxReconnectAttempts int32 = 5
)

Connection and health check constants

View Source
const (
	// DefaultMemoryLimit is the default memory limit for containers
	DefaultMemoryLimit = "512Mi"

	// DefaultCPULimit is the default CPU limit for containers
	DefaultCPULimit = "500m"

	// DefaultMemoryRequest is the default memory request for containers
	DefaultMemoryRequest = "256Mi"

	// DefaultCPURequest is the default CPU request for containers
	DefaultCPURequest = "100m"
)

Resource limits constants

View Source
const (
	// DefaultReconcileInterval is the default reconciliation interval
	DefaultReconcileInterval = 2 * time.Minute

	// DefaultReconcileTimeout is the default reconciliation timeout
	DefaultReconcileTimeout = 5 * time.Minute

	// DefaultRequeueAfterError is the default requeue duration after an error
	DefaultRequeueAfterError = 30 * time.Second
)

Reconciliation constants

View Source
const (
	// LowUtilizationThreshold is the threshold below which we consider scaling down
	// This is calculated as TargetCPUUtilization / 2
	LowUtilizationDivisor float32 = 2.0

	// ScaleUpThreshold is the threshold above which we consider scaling up
	// This uses the TargetCPUUtilization directly
	ScaleUpThreshold = "target_cpu_utilization"
)

Utilization thresholds

Variables

This section is empty.

Functions

func ConvertToEnvList

func ConvertToEnvList(env map[string]string) []string

ConvertToEnvList converts an environment map to a list of KEY=VALUE strings

func GetProjectName

func GetProjectName(filePath string) string

GetProjectName returns the project name based on the directory containing the config file

func IsCapabilityEnabled

func IsCapabilityEnabled(server ServerConfig, capability string) bool

IsCapabilityEnabled checks if a capability is enabled for a server

func MergeEnv

func MergeEnv(serverEnv, extraEnv map[string]string) map[string]string

MergeEnv merges the provided env vars with the server's env vars

func SaveConfig

func SaveConfig(filePath string, config *ComposeConfig) error

SaveConfig saves the configuration to a file

func ToYAML

func ToYAML(config *ComposeConfig) (string, error)

ToYAML converts the configuration to YAML string

func ValidateConfig

func ValidateConfig(config *ComposeConfig) error

In internal/config/config.go, change the function signature to make it public:

Types

type AIConfig

type AIConfig struct {
	DefaultProvider   string                      `yaml:"default_provider,omitempty"`
	Providers         map[string]AIProviderConfig `yaml:"providers,omitempty"`
	FallbackProviders []string                    `yaml:"fallback_providers,omitempty"`
}

AIConfig defines AI provider configuration

type AIProviderConfig

type AIProviderConfig struct {
	APIKey       string  `yaml:"api_key,omitempty"`
	Endpoint     string  `yaml:"endpoint,omitempty"`
	DefaultModel string  `yaml:"default_model,omitempty"`
	MaxTokens    int     `yaml:"max_tokens,omitempty"`
	Temperature  float64 `yaml:"temperature,omitempty"`
	Timeout      string  `yaml:"timeout,omitempty"`
}

AIProviderConfig defines configuration for a specific AI provider

type AccessControlConfig

type AccessControlConfig struct {
	Resources []AccessRule `yaml:"resources,omitempty"`
	Tools     []AccessRule `yaml:"tools,omitempty"`
}

AccessControlConfig defines access control rules

type AccessRule

type AccessRule struct {
	Path   string `yaml:"path,omitempty"`
	Name   string `yaml:"name,omitempty"`
	Access string `yaml:"access"` // read-only, read-write, deny
}

AccessRule defines an access rule for resources or tools

type AuditConfig

type AuditConfig struct {
	Enabled   bool            `yaml:"enabled"`
	LogLevel  string          `yaml:"log_level"`
	Storage   string          `yaml:"storage"`
	Retention RetentionConfig `yaml:"retention"`
	Events    []string        `yaml:"events"`
}

Audit Configuration

type AuthConfig

type AuthConfig struct {
	Type        string `yaml:"type"` // api_key, oauth, none
	Header      string `yaml:"header,omitempty"`
	TokenSource string `yaml:"token_source,omitempty"`
}

AuthConfig defines authentication configuration

type BuildConfig

type BuildConfig struct {
	Context    string            `yaml:"context,omitempty"`
	Dockerfile string            `yaml:"dockerfile,omitempty"`
	Args       map[string]string `yaml:"args,omitempty"` // For --build-arg
	Target     string            `yaml:"target,omitempty"`
	NoCache    bool              `yaml:"no_cache,omitempty"`
	Pull       bool              `yaml:"pull,omitempty"`
	Platform   string            `yaml:"platform,omitempty"`
}

type CapabilityOptConfig

type CapabilityOptConfig struct {
	Resources ResourcesCapOpt `yaml:"resources,omitempty"`
	Tools     ToolsCapOpt     `yaml:"tools,omitempty"`
	Prompts   PromptsCapOpt   `yaml:"prompts,omitempty"`
	Sampling  SamplingCapOpt  `yaml:"sampling,omitempty"`
	Logging   LoggingCapOpt   `yaml:"logging,omitempty"`
}

CapabilityOptConfig defines capability-specific options

type ComposeConfig

type ComposeConfig struct {
	Version       string                       `yaml:"version"`
	Registry      RegistryConfig               `yaml:"registry,omitempty"`
	ProxyAuth     ProxyAuthConfig              `yaml:"proxy_auth,omitempty"`
	OAuth         *OAuthConfig                 `yaml:"oauth,omitempty"`
	Audit         *AuditConfig                 `yaml:"audit,omitempty"`
	RBAC          *RBACConfig                  `yaml:"rbac,omitempty"`
	Users         map[string]*User             `yaml:"users,omitempty"`
	OAuthClients  map[string]*OAuthClient      `yaml:"oauth_clients,omitempty"`
	Servers       map[string]ServerConfig      `yaml:"servers"`
	Connections   map[string]ConnectionConfig  `yaml:"connections,omitempty"`
	Logging       LoggingConfig                `yaml:"logging,omitempty"`
	Monitoring    MonitoringConfig             `yaml:"monitoring,omitempty"`
	Development   DevelopmentConfig            `yaml:"development,omitempty"`
	Environments  map[string]EnvironmentConfig `yaml:"environments,omitempty"`
	CurrentEnv    string                       `yaml:"-"`
	Dashboard     DashboardConfig              `yaml:"dashboard,omitempty"`
	Networks      map[string]NetworkConfig     `yaml:"networks,omitempty"` // Deprecated: Kubernetes handles networking
	Volumes       map[string]VolumeConfig      `yaml:"volumes,omitempty"`
	TaskScheduler *TaskScheduler               `yaml:"task_scheduler,omitempty"`
	Memory        MemoryConfig                 `yaml:"memory"`
	AI            AIConfig                     `yaml:"ai,omitempty"`
}

ComposeConfig represents the entire mcp-compose.yaml file

func LoadConfig

func LoadConfig(filePath string) (*ComposeConfig, error)

LoadConfig loads and parses the compose file with environment support

func (*ComposeConfig) GetRegistryImage

func (c *ComposeConfig) GetRegistryImage(imageName string) string

GetRegistryImage returns the full image name with registry prefix

type ConnectionConfig

type ConnectionConfig struct {
	Transport      string        `yaml:"transport"` // stdio, http+sse, tcp, websocket
	Port           int           `yaml:"port,omitempty"`
	Host           string        `yaml:"host,omitempty"`
	Path           string        `yaml:"path,omitempty"`
	Expose         bool          `yaml:"expose,omitempty"`
	TLS            bool          `yaml:"tls,omitempty"`
	CertFile       string        `yaml:"cert_file,omitempty"`
	KeyFile        string        `yaml:"key_file,omitempty"`
	Authentication string        `yaml:"auth,omitempty"` // none, basic, token
	Timeouts       TimeoutConfig `yaml:"timeouts,omitempty"`
}

ConnectionConfig represents connection settings for MCP communication

type DashboardAdminLogin

type DashboardAdminLogin struct {
	Enabled        bool   `yaml:"enabled"`
	SessionTimeout string `yaml:"session_timeout"`
}

type DashboardConfig

type DashboardConfig struct {
	Enabled      bool                 `yaml:"enabled,omitempty"`
	Port         int                  `yaml:"port,omitempty"`
	Host         string               `yaml:"host,omitempty"`
	ProxyURL     string               `yaml:"proxy_url,omitempty"`
	PostgresURL  string               `yaml:"postgres_url,omitempty"`
	Theme        string               `yaml:"theme,omitempty"`
	LogStreaming bool                 `yaml:"log_streaming,omitempty"`
	ConfigEditor bool                 `yaml:"config_editor,omitempty"`
	Metrics      bool                 `yaml:"metrics,omitempty"`
	Security     *DashboardSecurity   `yaml:"security,omitempty"`
	AdminLogin   *DashboardAdminLogin `yaml:"admin_login,omitempty"`
}

DashboardConfig defines configuration for the MCP-Compose Dashboard

type DashboardSecurity

type DashboardSecurity struct {
	Enabled          bool `yaml:"enabled"`
	OAuthConfig      bool `yaml:"oauth_config"`
	ClientManagement bool `yaml:"client_management"`
	UserManagement   bool `yaml:"user_management"`
	AuditLogs        bool `yaml:"audit_logs"`
}

type DeployConfig

type DeployConfig struct {
	Resources     ResourcesDeployConfig `yaml:"resources,omitempty"`
	RestartPolicy string                `yaml:"restart_policy,omitempty"`
	Replicas      int                   `yaml:"replicas,omitempty"`
	UpdateConfig  UpdateConfig          `yaml:"update_config,omitempty"`
}

Deploy configuration for resource management

type DevelopmentConfig

type DevelopmentConfig struct {
	Inspector InspectorConfig `yaml:"inspector,omitempty"`
	Testing   TestingConfig   `yaml:"testing,omitempty"`
}

DevelopmentConfig defines development and testing tools configuration

type EnvironmentConfig

type EnvironmentConfig struct {
	Servers map[string]ServerOverrideConfig `yaml:"servers,omitempty"`
}

EnvironmentConfig defines environment-specific configuration overrides

type HealthCheck

type HealthCheck struct {
	Test        []string `yaml:"test,omitempty"`
	Interval    string   `yaml:"interval,omitempty"`
	Timeout     string   `yaml:"timeout,omitempty"`
	Retries     int      `yaml:"retries,omitempty"`
	StartPeriod string   `yaml:"start_period,omitempty"`
	Endpoint    string   `yaml:"endpoint,omitempty"` // Legacy support
	Action      string   `yaml:"action,omitempty"`   // Action when health check fails
}

HealthCheck defines health check configuration (UPDATED)

type HumanControlConfig

type HumanControlConfig struct {
	RequireApproval     bool     `yaml:"require_approval,omitempty"`
	AutoApprovePatterns []string `yaml:"auto_approve_patterns,omitempty"`
	BlockPatterns       []string `yaml:"block_patterns,omitempty"`
	MaxTokens           int      `yaml:"max_tokens,omitempty"`
	AllowedModels       []string `yaml:"allowed_models,omitempty"`
	TimeoutSeconds      int      `yaml:"timeout_seconds,omitempty"`
}

type IPAMConfig

type IPAMConfig struct {
	Driver  string            `yaml:"driver,omitempty"`
	Config  []IPAMConfigEntry `yaml:"config,omitempty"`
	Options map[string]string `yaml:"options,omitempty"`
}

type IPAMConfigEntry

type IPAMConfigEntry struct {
	Subnet  string `yaml:"subnet,omitempty"`
	Gateway string `yaml:"gateway,omitempty"`
}

type InspectorConfig

type InspectorConfig struct {
	Enabled bool `yaml:"enabled,omitempty"`
	Port    int  `yaml:"port,omitempty"`
}

InspectorConfig defines MCP Inspector configuration

type LifecycleConfig

type LifecycleConfig struct {
	PreStart     string              `yaml:"pre_start,omitempty"`
	PostStart    string              `yaml:"post_start,omitempty"`
	PreStop      string              `yaml:"pre_stop,omitempty"`
	PostStop     string              `yaml:"post_stop,omitempty"`
	HealthCheck  HealthCheck         `yaml:"health_check,omitempty"`
	HumanControl *HumanControlConfig `yaml:"human_control,omitempty"`
}

LifecycleConfig defines server lifecycle hooks

type LogDestination

type LogDestination struct {
	Type string `yaml:"type"` // file, stdout
	Path string `yaml:"path,omitempty"`
}

LogDestination defines a log destination

type LoggingCapOpt

type LoggingCapOpt struct {
	Enabled bool `yaml:"enabled"`
}

LoggingCapOpt defines options for logging capability

type LoggingConfig

type LoggingConfig struct {
	Level        string           `yaml:"level,omitempty"`
	Format       string           `yaml:"format,omitempty"`
	Destinations []LogDestination `yaml:"destinations,omitempty"`
}

LoggingConfig defines global logging configuration

type MemoryConfig

type MemoryConfig struct {
	Enabled          bool              `yaml:"enabled"`
	Port             int               `yaml:"port"`
	Host             string            `yaml:"host"`
	DatabaseURL      string            `yaml:"database_url"`
	PostgresEnabled  bool              `yaml:"postgres_enabled"`
	PostgresPort     int               `yaml:"postgres_port"`
	PostgresDB       string            `yaml:"postgres_db"`
	PostgresUser     string            `yaml:"postgres_user"`
	PostgresPassword string            `yaml:"postgres_password"`
	CPUs             string            `yaml:"cpus"`
	Memory           string            `yaml:"memory"`
	PostgresCPUs     string            `yaml:"postgres_cpus"`
	PostgresMemory   string            `yaml:"postgres_memory"`
	Volumes          []string          `yaml:"volumes"`
	Authentication   *ServerAuthConfig `yaml:"authentication"`
}

type MetricsConfig

type MetricsConfig struct {
	Enabled bool `yaml:"enabled,omitempty"`
	Port    int  `yaml:"port,omitempty"`
}

MetricsConfig defines metrics configuration

type ModelConfig

type ModelConfig struct {
	Name        string  `yaml:"name"`
	Provider    string  `yaml:"provider,omitempty"`
	MaxTokens   int     `yaml:"max_tokens,omitempty"`
	Temperature float64 `yaml:"temperature,omitempty"`
	TopP        float64 `yaml:"top_p,omitempty"`
	TopK        int     `yaml:"top_k,omitempty"`
}

ModelConfig defines a model configuration for sampling

type MonitoringConfig

type MonitoringConfig struct {
	Metrics MetricsConfig `yaml:"metrics,omitempty"`
}

MonitoringConfig defines monitoring configuration

type NetworkConfig

type NetworkConfig struct {
	Driver      string            `yaml:"driver,omitempty"`
	DriverOpts  map[string]string `yaml:"driver_opts,omitempty"`
	Attachable  bool              `yaml:"attachable,omitempty"`
	Enable_ipv6 bool              `yaml:"enable_ipv6,omitempty"`
	IPAM        IPAMConfig        `yaml:"ipam,omitempty"`
	Internal    bool              `yaml:"internal,omitempty"`
	Labels      map[string]string `yaml:"labels,omitempty"`
	External    bool              `yaml:"external,omitempty"`
}

Network configuration

type OAuthClient

type OAuthClient struct {
	ClientID     string   `yaml:"client_id"`
	ClientSecret *string  `yaml:"client_secret"`
	Name         string   `yaml:"name"`
	Description  string   `yaml:"description"`
	RedirectURIs []string `yaml:"redirect_uris"`
	Scopes       []string `yaml:"scopes"`
	GrantTypes   []string `yaml:"grant_types"`
	PublicClient bool     `yaml:"public_client"`
	AutoApprove  bool     `yaml:"auto_approve"`
}

OAuth Clients

type OAuthClientConfig

type OAuthClientConfig struct {
	ClientID     string   `yaml:"client_id"`
	ClientSecret string   `yaml:"client_secret,omitempty"`
	Name         string   `yaml:"name"`
	Description  string   `yaml:"description,omitempty"`
	RedirectURIs []string `yaml:"redirect_uris"`
	Scopes       []string `yaml:"scopes"`
	GrantTypes   []string `yaml:"grant_types"`
	PublicClient bool     `yaml:"public_client,omitempty"`
	AutoApprove  bool     `yaml:"auto_approve,omitempty"`
}

type OAuthConfig

type OAuthConfig struct {
	Enabled         bool                `yaml:"enabled"`
	Issuer          string              `yaml:"issuer"`
	Endpoints       OAuthEndpoints      `yaml:"endpoints"`
	Tokens          TokenConfig         `yaml:"tokens"`
	Security        OAuthSecurityConfig `yaml:"security"`
	GrantTypes      []string            `yaml:"grant_types"`
	ResponseTypes   []string            `yaml:"response_types"`
	ScopesSupported []string            `yaml:"scopes_supported"`
}

OAuth 2.1 Configuration

type OAuthEndpoints

type OAuthEndpoints struct {
	Authorization string `yaml:"authorization"`
	Token         string `yaml:"token"`
	UserInfo      string `yaml:"userinfo"`
	Revoke        string `yaml:"revoke"`
	Discovery     string `yaml:"discovery"`
}

type OAuthSecurityConfig

type OAuthSecurityConfig struct {
	RequirePKCE bool `yaml:"require_pkce"`
}

type PromptConfig

type PromptConfig struct {
	Name        string           `yaml:"name"`
	Template    string           `yaml:"template"`
	Description string           `yaml:"description,omitempty"`
	Variables   []PromptVariable `yaml:"variables,omitempty"`
}

PromptConfig defines a prompt template configuration

type PromptVariable

type PromptVariable struct {
	Name        string      `yaml:"name"`
	Type        string      `yaml:"type"`
	Required    bool        `yaml:"required,omitempty"`
	Description string      `yaml:"description,omitempty"`
	Default     interface{} `yaml:"default,omitempty"`
}

PromptVariable defines a variable used in a prompt template

type PromptsCapOpt

type PromptsCapOpt struct {
	Enabled     bool `yaml:"enabled"`
	ListChanged bool `yaml:"list_changed,omitempty"`
}

PromptsCapOpt defines options for prompts capability

type ProxyAuthConfig

type ProxyAuthConfig struct {
	Enabled       bool   `yaml:"enabled,omitempty"`
	APIKey        string `yaml:"api_key,omitempty"`        // If you want to store the API key in the config file
	OAuthFallback bool   `yaml:"oauth_fallback,omitempty"` // Allow OAuth as fallback
}

ProxyAuthConfig defines authentication settings for the proxy itself

type RBACConfig

type RBACConfig struct {
	Enabled bool            `yaml:"enabled"`
	Scopes  []Scope         `yaml:"scopes"`
	Roles   map[string]Role `yaml:"roles"`
}

RBAC Configuration

type RegistryConfig

type RegistryConfig struct {
	URL      string `yaml:"url,omitempty"`      // Registry URL (e.g., "localhost:5000", "192.168.1.100:5000", "registry.example.com")
	Username string `yaml:"username,omitempty"` // Registry username for authentication
	Password string `yaml:"password,omitempty"` // Registry password for authentication
	Insecure bool   `yaml:"insecure,omitempty"` // Allow insecure connections to registry
}

RegistryConfig defines container registry configuration

type ResourceLimitsConfig

type ResourceLimitsConfig struct {
	CPUs        string `yaml:"cpus,omitempty"`
	Memory      string `yaml:"memory,omitempty"`
	MemorySwap  string `yaml:"memory_swap,omitempty"`
	PIDs        int    `yaml:"pids,omitempty"`
	BlkioWeight int    `yaml:"blkio_weight,omitempty"`
}

type ResourcePath

type ResourcePath struct {
	Source   string `yaml:"source"`
	Target   string `yaml:"target"`
	Watch    bool   `yaml:"watch,omitempty"`
	ReadOnly bool   `yaml:"read_only,omitempty"`
}

ResourcePath defines a resource path mapping

type ResourceTest

type ResourceTest struct {
	Path           string `yaml:"path"`
	ExpectedStatus string `yaml:"expected_status"`
}

ResourceTest defines a resource test

type ResourcesCapOpt

type ResourcesCapOpt struct {
	Enabled     bool `yaml:"enabled"`
	ListChanged bool `yaml:"list_changed,omitempty"`
	Subscribe   bool `yaml:"subscribe,omitempty"`
}

ResourcesCapOpt defines options for resources capability

type ResourcesConfig

type ResourcesConfig struct {
	Paths        []ResourcePath `yaml:"paths,omitempty"`
	SyncInterval string         `yaml:"sync_interval,omitempty"`
	CacheTTL     int            `yaml:"cache_ttl,omitempty"`
	Watch        bool           `yaml:"watch,omitempty"`
}

ResourcesConfig defines resource-related configuration for a server

type ResourcesDeployConfig

type ResourcesDeployConfig struct {
	Limits       ResourceLimitsConfig `yaml:"limits,omitempty"`
	Reservations ResourceLimitsConfig `yaml:"reservations,omitempty"`
}

type RetentionConfig

type RetentionConfig struct {
	MaxEntries int    `yaml:"max_entries"`
	MaxAge     string `yaml:"max_age"`
}

type Role

type Role struct {
	Name        string   `yaml:"name"`
	Description string   `yaml:"description"`
	Scopes      []string `yaml:"scopes"`
}

type SamplingCapOpt

type SamplingCapOpt struct {
	Enabled bool `yaml:"enabled"`
}

SamplingCapOpt defines options for sampling capability

type SamplingConfig

type SamplingConfig struct {
	Models []ModelConfig `yaml:"models,omitempty"`
}

SamplingConfig defines sampling configuration for a server

type Scope

type Scope struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
}

type SecurityConfig

type SecurityConfig struct {
	Auth          AuthConfig          `yaml:"auth,omitempty"`
	AccessControl AccessControlConfig `yaml:"access_control,omitempty"`

	// Container security capabilities
	AllowHostMounts    []string          `yaml:"allow_host_mounts,omitempty"`
	AllowPrivilegedOps bool              `yaml:"allow_privileged_ops,omitempty"`
	TrustedImage       bool              `yaml:"trusted_image,omitempty"`
	NoNewPrivileges    bool              `yaml:"no_new_privileges,omitempty"`
	AppArmor           string            `yaml:"apparmor,omitempty"`
	Seccomp            string            `yaml:"seccomp,omitempty"`
	SELinux            map[string]string `yaml:"selinux,omitempty"`
}

SecurityConfig defines security settings for a server (UPDATED)

type ServerAuthConfig

type ServerAuthConfig struct {
	Enabled       bool     `yaml:"enabled"`
	RequiredScope string   `yaml:"required_scope,omitempty"`
	OptionalAuth  bool     `yaml:"optional_auth,omitempty"`
	Scopes        []string `yaml:"scopes,omitempty"`
	AllowAPIKey   *bool    `yaml:"allow_api_key,omitempty"`
}

type ServerConfig

type ServerConfig struct {
	// Process-based setup
	Command         string              `yaml:"command,omitempty"`
	Args            []string            `yaml:"args,omitempty"`
	Image           string              `yaml:"image,omitempty"`
	Build           BuildConfig         `yaml:"build,omitempty"`
	Runtime         string              `yaml:"runtime,omitempty"`
	Pull            bool                `yaml:"pull,omitempty"`
	WorkDir         string              `yaml:"workdir,omitempty"`
	Env             map[string]string   `yaml:"env,omitempty"`
	Ports           []string            `yaml:"ports,omitempty"`
	HttpPort        int                 `yaml:"http_port,omitempty"`
	HttpPath        string              `yaml:"http_path,omitempty"`
	Protocol        string              `yaml:"protocol,omitempty"` // "http", "sse", or "stdio" (default)
	StdioHosterPort int                 `yaml:"stdio_hoster_port,omitempty"`
	Capabilities    []string            `yaml:"capabilities,omitempty"`
	DependsOn       []string            `yaml:"depends_on,omitempty"`
	Volumes         []string            `yaml:"volumes,omitempty"`
	Resources       ResourcesConfig     `yaml:"resources,omitempty"`
	Tools           []ToolConfig        `yaml:"tools,omitempty"`
	Prompts         []PromptConfig      `yaml:"prompts,omitempty"`
	Sampling        SamplingConfig      `yaml:"sampling,omitempty"`
	Security        SecurityConfig      `yaml:"security,omitempty"`
	Lifecycle       LifecycleConfig     `yaml:"lifecycle,omitempty"`
	CapabilityOpt   CapabilityOptConfig `yaml:"capability_options,omitempty"`
	NetworkMode     string              `yaml:"network_mode,omitempty"` // Deprecated: Kubernetes handles networking
	Networks        []string            `yaml:"networks,omitempty"`     // Deprecated: Kubernetes handles networking
	Authentication  *ServerAuthConfig   `yaml:"authentication,omitempty"`
	OAuth           *ServerOAuthConfig  `yaml:"oauth,omitempty"`
	SSEPath         string              `yaml:"sse_path,omitempty"`      // Path for SSE endpoint
	SSEPort         int                 `yaml:"sse_port,omitempty"`      // Port for SSE (if different from http_port)
	SSEHeartbeat    int                 `yaml:"sse_heartbeat,omitempty"` // SSE heartbeat interval in seconds

	// Container security and resource options
	Privileged    bool              `yaml:"privileged,omitempty"`
	User          string            `yaml:"user,omitempty"`
	Groups        []string          `yaml:"groups,omitempty"`
	ReadOnly      bool              `yaml:"read_only,omitempty"`
	Tmpfs         []string          `yaml:"tmpfs,omitempty"`
	CapAdd        []string          `yaml:"cap_add,omitempty"`
	CapDrop       []string          `yaml:"cap_drop,omitempty"`
	SecurityOpt   []string          `yaml:"security_opt,omitempty"`
	Deploy        DeployConfig      `yaml:"deploy,omitempty"`
	RestartPolicy string            `yaml:"restart,omitempty"`
	StopSignal    string            `yaml:"stop_signal,omitempty"`
	StopTimeout   *int              `yaml:"stop_grace_period,omitempty"`
	HealthCheck   *HealthCheck      `yaml:"healthcheck,omitempty"`
	Hostname      string            `yaml:"hostname,omitempty"`
	DomainName    string            `yaml:"domainname,omitempty"`
	DNS           []string          `yaml:"dns,omitempty"`
	DNSSearch     []string          `yaml:"dns_search,omitempty"`
	ExtraHosts    []string          `yaml:"extra_hosts,omitempty"`
	LogDriver     string            `yaml:"log_driver,omitempty"`
	LogOptions    map[string]string `yaml:"log_options,omitempty"`
	Labels        map[string]string `yaml:"labels,omitempty"`
	Annotations   map[string]string `yaml:"annotations,omitempty"`
	Platform      string            `yaml:"platform,omitempty"`
}

type ServerOAuthConfig

type ServerOAuthConfig struct {
	Enabled             bool     `yaml:"enabled"`
	RequiredScope       string   `yaml:"required_scope"`
	AllowAPIKeyFallback bool     `yaml:"allow_api_key_fallback"`
	OptionalAuth        bool     `yaml:"optional_auth"`
	AllowedClients      []string `yaml:"allowed_clients"`
}

type ServerOverrideConfig

type ServerOverrideConfig struct {
	Env       map[string]string `yaml:"env,omitempty"`
	Resources ResourcesConfig   `yaml:"resources,omitempty"`
}

ServerOverrideConfig defines environment-specific server overrides

type TaskScheduler

type TaskScheduler struct {
	Enabled          bool              `yaml:"enabled"`
	Port             int               `yaml:"port"`
	Host             string            `yaml:"host"`
	DatabasePath     string            `yaml:"database_path"`    // SQLite database path (legacy)
	DatabaseURL      string            `yaml:"database_url"`     // PostgreSQL connection string
	PostgresEnabled  bool              `yaml:"postgres_enabled"` // Use PostgreSQL instead of SQLite
	LogLevel         string            `yaml:"log_level"`
	OpenRouterAPIKey string            `yaml:"openrouter_api_key"`
	OpenRouterModel  string            `yaml:"openrouter_model"`
	OllamaURL        string            `yaml:"ollama_url"`
	OllamaModel      string            `yaml:"ollama_model"`
	MCPProxyURL      string            `yaml:"mcp_proxy_url"`
	MCPProxyAPIKey   string            `yaml:"mcp_proxy_api_key"`
	OpenWebUIEnabled bool              `yaml:"openwebui_enabled"`
	Workspace        string            `yaml:"workspace"`
	CPUs             string            `yaml:"cpus"`
	Memory           string            `yaml:"memory"`
	Volumes          []string          `yaml:"volumes"`
	Env              map[string]string `yaml:"env"`
}

type TestScenario

type TestScenario struct {
	Name      string         `yaml:"name"`
	Tools     []ToolTest     `yaml:"tools,omitempty"`
	Resources []ResourceTest `yaml:"resources,omitempty"`
}

TestScenario defines a test scenario

type TestingConfig

type TestingConfig struct {
	Scenarios []TestScenario `yaml:"scenarios,omitempty"`
}

TestingConfig defines testing framework configuration

type TimeoutConfig

type TimeoutConfig struct {
	Connect       string `yaml:"connect,omitempty"`        // Default: "10s"
	Read          string `yaml:"read,omitempty"`           // Default: "30s"
	Write         string `yaml:"write,omitempty"`          // Default: "30s"
	Idle          string `yaml:"idle,omitempty"`           // Default: "60s"
	HealthCheck   string `yaml:"health_check,omitempty"`   // Default: "5s"
	Shutdown      string `yaml:"shutdown,omitempty"`       // Default: "30s"
	LifecycleHook string `yaml:"lifecycle_hook,omitempty"` // Default: "30s"
}

TimeoutConfig defines configurable timeout values

func (TimeoutConfig) GetConnectTimeout

func (tc TimeoutConfig) GetConnectTimeout() time.Duration

GetTimeoutDuration returns a timeout duration with fallback to default

func (TimeoutConfig) GetHealthCheckTimeout

func (tc TimeoutConfig) GetHealthCheckTimeout() time.Duration

func (TimeoutConfig) GetIdleTimeout

func (tc TimeoutConfig) GetIdleTimeout() time.Duration

func (TimeoutConfig) GetLifecycleHookTimeout

func (tc TimeoutConfig) GetLifecycleHookTimeout() time.Duration

func (TimeoutConfig) GetReadTimeout

func (tc TimeoutConfig) GetReadTimeout() time.Duration

func (TimeoutConfig) GetShutdownTimeout

func (tc TimeoutConfig) GetShutdownTimeout() time.Duration

func (TimeoutConfig) GetWriteTimeout

func (tc TimeoutConfig) GetWriteTimeout() time.Duration

type TokenConfig

type TokenConfig struct {
	AccessTokenTTL  string `yaml:"access_token_ttl"`
	RefreshTokenTTL string `yaml:"refresh_token_ttl"`
	CodeTTL         string `yaml:"authorization_code_ttl"`
	Algorithm       string `yaml:"algorithm"`
}

type ToolConfig

type ToolConfig struct {
	Name        string             `yaml:"name"`
	Description string             `yaml:"description,omitempty"`
	Parameters  []ToolParameter    `yaml:"parameters,omitempty"`
	Timeout     string             `yaml:"timeout,omitempty"`
	Mocks       []ToolMockResponse `yaml:"mocks,omitempty"`
}

ToolConfig defines a tool configuration

type ToolMockResponse

type ToolMockResponse struct {
	Input    map[string]interface{} `yaml:"input"`
	Response map[string]interface{} `yaml:"response"`
	Status   string                 `yaml:"status,omitempty"`
}

ToolMockResponse defines a mock response for testing a tool

type ToolParameter

type ToolParameter struct {
	Name        string      `yaml:"name"`
	Type        string      `yaml:"type"`
	Required    bool        `yaml:"required,omitempty"`
	Description string      `yaml:"description,omitempty"`
	Default     interface{} `yaml:"default,omitempty"`
}

ToolParameter defines a parameter for a tool

type ToolTest

type ToolTest struct {
	Name           string                 `yaml:"name"`
	Input          map[string]interface{} `yaml:"input"`
	ExpectedStatus string                 `yaml:"expected_status"`
}

ToolTest defines a tool test

type ToolsCapOpt

type ToolsCapOpt struct {
	Enabled     bool `yaml:"enabled"`
	ListChanged bool `yaml:"list_changed,omitempty"`
}

ToolsCapOpt defines options for tools capability

type UpdateConfig

type UpdateConfig struct {
	Parallelism     int    `yaml:"parallelism,omitempty"`
	Delay           string `yaml:"delay,omitempty"`
	FailureAction   string `yaml:"failure_action,omitempty"`
	Monitor         string `yaml:"monitor,omitempty"`
	MaxFailureRatio string `yaml:"max_failure_ratio,omitempty"`
}

type User

type User struct {
	Username     string    `yaml:"username"`
	Email        string    `yaml:"email"`
	PasswordHash string    `yaml:"password_hash"`
	Role         string    `yaml:"role"`
	Enabled      bool      `yaml:"enabled"`
	CreatedAt    time.Time `yaml:"created_at"`
}

User Management

type VolumeConfig

type VolumeConfig struct {
	Driver     string            `yaml:"driver,omitempty"`
	DriverOpts map[string]string `yaml:"driver_opts,omitempty"`
	External   bool              `yaml:"external,omitempty"`
	Labels     map[string]string `yaml:"labels,omitempty"`
}

Volume configuration

Jump to

Keyboard shortcuts

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