Documentation
¶
Overview ¶
Package config loads ARR-MCP configuration and resolves service instances.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var KnownServices = []string{"sonarr", "radarr", "prowlarr", "bazarr", "qbittorrent", "nzbget"}
KnownServices lists the services this build can expose tools for. Config referencing anything else is rejected rather than silently ignored.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Server ServerConfig `yaml:"server"`
Permissions Permissions `yaml:"permissions"`
Services map[string][]Instance `yaml:"services"`
}
Config is the fully resolved server configuration.
func Load ¶
Load reads configuration from a YAML file. When path is empty it falls back to building a single default instance per service from environment variables.
func (*Config) ConfiguredServices ¶
ConfiguredServices returns the services that have at least one instance.
func (*Config) EffectiveMode ¶
EffectiveMode returns the permission mode governing inst, preferring the instance override over the global policy.
func (*Config) EffectivePermissions ¶
func (c *Config) EffectivePermissions(inst *Instance) Permissions
EffectivePermissions returns the full permission policy governing inst.
func (*Config) InstanceNames ¶
InstanceNames returns configured instance names for service, in config order.
type CredentialKind ¶ added in v1.1.0
type CredentialKind int
CredentialKind says which secret fields a service authenticates with.
const ( // CredentialAPIKey services take apiKey (or <SERVICE>_API_KEY). CredentialAPIKey CredentialKind = iota // CredentialUserPass services take username and password (or // <SERVICE>_USERNAME and <SERVICE>_PASSWORD). CredentialUserPass )
Supported credential kinds.
func CredentialKindFor ¶ added in v1.1.0
func CredentialKindFor(service string) CredentialKind
CredentialKindFor returns how service authenticates. Unknown services default to an API key, matching the *arr contract.
type Fallback ¶
type Fallback string
Fallback decides what happens when the client cannot prompt the user.
type Instance ¶
type Instance struct {
Name string `yaml:"name"`
URL string `yaml:"url"`
// APIKey authenticates services that take a key header (Sonarr, Radarr,
// Prowlarr, Bazarr). Username and Password authenticate the download
// clients (qBittorrent, NZBGet). CredentialKindFor says which applies.
APIKey string `yaml:"apiKey"`
Username string `yaml:"username"`
Password string `yaml:"password"`
Default bool `yaml:"default"`
// Permissions optionally overrides the global policy for this instance.
Permissions *Permissions `yaml:"permissions"`
}
Instance is a single configured endpoint for a service.
type Mode ¶
type Mode string
Mode controls whether mutating tools are exposed and whether they require confirmation before running.
const ( // ModeReadOnly registers only read tools; mutating tools are invisible. ModeReadOnly Mode = "readonly" // ModeConfirm registers all tools but confirms before mutating ones run. ModeConfirm Mode = "confirm" // ModeFull registers all tools and runs them without confirmation. ModeFull Mode = "full" )
Supported permission modes.
type Permissions ¶
type Permissions struct {
Mode Mode `yaml:"mode"`
ConfirmScope Scope `yaml:"confirmScope"`
Fallback Fallback `yaml:"fallback"`
}
Permissions describes how mutating tools are treated.
type Scope ¶
type Scope string
Scope selects which access tiers require confirmation under ModeConfirm.
type ServerConfig ¶
type ServerConfig struct {
Transport string `yaml:"transport"`
Addr string `yaml:"addr"`
LogLevel string `yaml:"logLevel"`
}
ServerConfig holds transport and logging settings.