Documentation
¶
Overview ¶
Package config provides configuration loading for the MCP server.
Index ¶
Constants ¶
const MaxSandboxTimeout = 600
MaxSandboxTimeout is the maximum allowed sandbox timeout in seconds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientConfig ¶
type ClientConfig struct {
Server ServerConfig `yaml:"server"`
Proxy ProxyConfig `yaml:"proxy"`
// contains filtered or unexported fields
}
ClientConfig is the subset of configuration needed by the CLI when operating as a server client.
func LoadClient ¶
func LoadClient(path string) (*ClientConfig, error)
LoadClient loads client configuration from the standard config locations.
func (*ClientConfig) Path ¶
func (c *ClientConfig) Path() string
Path returns the resolved path this client config was loaded from.
func (*ClientConfig) ServerURL ¶
func (c *ClientConfig) ServerURL() string
ServerURL returns the resolved server base URL for client use.
type Config ¶
type Config struct {
Server ServerConfig `yaml:"server"`
Sandbox SandboxConfig `yaml:"sandbox"`
Proxy ProxyConfig `yaml:"proxy"`
Storage StorageConfig `yaml:"storage"`
Observability ObservabilityConfig `yaml:"observability"`
// contains filtered or unexported fields
}
Config is the main configuration structure.
type ObservabilityConfig ¶
type ObservabilityConfig struct {
MetricsEnabled bool `yaml:"metrics_enabled"`
MetricsPort int `yaml:"metrics_port"`
}
ObservabilityConfig holds observability configuration.
type ProxyAuthConfig ¶
type ProxyAuthConfig struct {
// Mode describes the proxy auth flow. "oauth" is the legacy embedded proxy issuer,
// "oidc" is an external OpenID Connect issuer such as Dex.
Mode string `yaml:"mode,omitempty"`
// IssuerURL is the OAuth issuer URL for proxy authentication.
IssuerURL string `yaml:"issuer_url"`
// ClientID is the OAuth client ID for authentication.
ClientID string `yaml:"client_id"`
// Resource is the optional OAuth resource indicator to request.
// Leave empty for standard OIDC providers that do not use RFC 8707 resource parameters.
Resource string `yaml:"resource,omitempty"`
// RefreshTokenTTL is the expected lifetime of the refresh token issued by the
// OIDC provider. When set, the client will proactively refresh at 50% of this
// duration to keep the refresh token alive via provider rotation.
RefreshTokenTTL time.Duration `yaml:"refresh_token_ttl,omitempty"`
}
ProxyAuthConfig configures authentication for the proxy.
type ProxyConfig ¶
type ProxyConfig struct {
// URL is the base URL of the proxy server (e.g., http://localhost:18081).
URL string `yaml:"url"`
// Auth configures authentication for the proxy.
// Optional - if not set, the proxy must allow unauthenticated access.
Auth *ProxyAuthConfig `yaml:"auth,omitempty"`
}
ProxyConfig holds proxy connection configuration. The MCP server always connects to a proxy server via this config.
type SandboxConfig ¶
type SandboxConfig struct {
Backend string `yaml:"backend"`
Image string `yaml:"image"`
Timeout int `yaml:"timeout"`
MemoryLimit string `yaml:"memory_limit"`
CPULimit float64 `yaml:"cpu_limit"`
Network string `yaml:"network"`
// Instance identifies this server's sandbox containers with a custom label.
// Used to distinguish containers from different server instances (e.g., probe runner vs production).
// When set, containers are labeled with "io.ethpandaops-panda.instance=<value>".
Instance string `yaml:"instance,omitempty"`
// Session configuration for persistent execution environments.
Sessions SessionConfig `yaml:"sessions"`
// Logging configuration for sandbox executions.
Logging SandboxLoggingConfig `yaml:"logging"`
}
SandboxConfig holds sandbox execution configuration.
type SandboxLoggingConfig ¶
type SandboxLoggingConfig struct {
// LogCode logs the full Python code submitted to execute_python.
// Disabled by default as code may contain sensitive data.
LogCode bool `yaml:"log_code"`
// LogOutput logs stdout and stderr from execution.
// Disabled by default as output may be large or contain sensitive data.
LogOutput bool `yaml:"log_output"`
}
SandboxLoggingConfig holds logging configuration for sandbox executions.
type ServerConfig ¶
type ServerConfig struct {
Host string `yaml:"host"`
Port int `yaml:"port"`
BaseURL string `yaml:"base_url"`
SandboxURL string `yaml:"sandbox_url,omitempty"`
URL string `yaml:"url,omitempty"`
// Deprecated: Transport is accepted for backwards compatibility but ignored.
// The server always runs HTTP with both SSE and streamable-http transports.
Transport string `yaml:"transport,omitempty"`
}
ServerConfig holds server-specific configuration.
type SessionConfig ¶
type SessionConfig struct {
// Enabled controls whether session support is available. Defaults to true.
Enabled *bool `yaml:"enabled,omitempty"`
// TTL is the duration after which an idle session is destroyed (since last use).
TTL time.Duration `yaml:"ttl"`
// MaxDuration is the maximum lifetime of a session regardless of activity.
MaxDuration time.Duration `yaml:"max_duration"`
// MaxSessions is the maximum number of concurrent sessions allowed.
MaxSessions int `yaml:"max_sessions"`
}
SessionConfig holds configuration for persistent sandbox sessions.
func (*SessionConfig) IsEnabled ¶
func (c *SessionConfig) IsEnabled() bool
IsEnabled returns whether sessions are enabled (defaults to true).
type StorageConfig ¶
type StorageConfig struct {
// BaseDir is the directory where uploaded files are stored.
// Defaults to ~/.panda/data/storage.
BaseDir string `yaml:"base_dir,omitempty"`
// CacheDir is the directory for the local embedding vector cache.
// Defaults to a "cache" sibling of BaseDir.
CacheDir string `yaml:"cache_dir,omitempty"`
}
StorageConfig holds configuration for local file storage.