config

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config loads ARR-MCP configuration and resolves service instances.

Index

Constants

This section is empty.

Variables

View Source
var KnownServices = []string{"sonarr", "radarr", "prowlarr", "bazarr", "qbittorrent", "nzbget", "maintainerr", "seerr", "jellyfin", "jellystat", "synology"}

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

func Load(path string) (*Config, error)

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

func (c *Config) ConfiguredServices() []string

ConfiguredServices returns the services that have at least one instance.

func (*Config) EffectiveMode

func (c *Config) EffectiveMode(inst *Instance) Mode

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

func (c *Config) InstanceNames(service string) []string

InstanceNames returns configured instance names for service, in config order.

func (*Config) Resolve

func (c *Config) Resolve(service, name string) (*Instance, error)

Resolve returns the instance of service selected by name. An empty name selects the instance marked default, or the sole instance when only one is configured. Errors name the valid instances so the caller can correct itself.

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
	// CredentialNone services take no credentials at all, only a url.
	CredentialNone
)

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.

const (
	// FallbackDeny refuses the call when confirmation is impossible.
	FallbackDeny Fallback = "deny"
	// FallbackAllow runs the call when confirmation is impossible.
	FallbackAllow Fallback = "allow"
)

Supported fallback behaviours.

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"`
	// AllowedPaths fences the Synology file-changing tools: absolute DSM
	// paths (a share or a folder in one). Empty means those tools refuse
	// everything. Only synology accepts it.
	AllowedPaths []string `yaml:"allowedPaths"`
}

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.

const (
	// ScopeWrite confirms both write and destructive tools.
	ScopeWrite Scope = "write"
	// ScopeDestructive confirms only destructive tools. This is the default.
	ScopeDestructive Scope = "destructive"
)

Supported confirmation scopes. ScopeDestructive is the default: reads, creates and updates run, and only deletes ask first.

type ServerConfig

type ServerConfig struct {
	Transport string `yaml:"transport"`
	Addr      string `yaml:"addr"`
	LogLevel  string `yaml:"logLevel"`
}

ServerConfig holds transport and logging settings.

Jump to

Keyboard shortcuts

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