Skip to content

Providers

Providers are how Music Assistant reaches the outside world. This page helps you understand what kinds there are, what a provider folder holds, and what the server does with it from the moment it reads the manifest until it unloads it. To build one, go to Build a provider.

Every provider subclasses Provider (music_assistant/models/provider.py) through one of these base classes in music_assistant/models/:

ProviderType Base class What it adds
MUSIC MusicProvider A music source: a streaming service, local files, a media server, radio
PLAYER PlayerProvider A way to reach speakers. It registers a PlayerProtocol per device, see Players
METADATA MetadataProvider Images, descriptions, lyrics and other metadata for library items
PLUGIN PluginProvider Anything else, such as an audio source a player can play, or an AI, speech or image engine
AUDIO_ANALYSIS AudioAnalysisProvider Analysis of the audio of a track, such as beats, key or loudness

The core controllers also have a manifest, of type CORE. That is how their settings show up next to those of the providers.

A provider is a folder under music_assistant/providers/, named after its domain:

  • manifest.json: domain, name, type, requirements, whether more than one instance is allowed (multi_instance), whether it is built in (builtin), what it depends on (depends_on), and the mDNS or SSDP services it wants to hear about.
  • __init__.py: a module-level setup(mass, manifest, config) that returns the provider instance, and usually a SUPPORTED_FEATURES set it passes to the constructor.
  • setup_flow.py (optional): an interactive, multi-step setup. Its presence alone tells the server the provider has one.
  • strings.json: the English texts for its settings and messages.
  • icon.svg, icon_dark.svg, icon_monochrome.svg (or .png): the icons the app shows.

Larger providers split their code over more modules and often have their own README.md. The _demo_* folders are annotated templates; they only load in dev mode.

stateDiagram-v2
  [*] --> Known: manifest.json read
  Known --> Configured: config created
  Configured --> Loading: load_provider
  Loading --> Loaded: setup and handle_async_init succeed
  Loading --> RetryWait: handled error
  RetryWait --> Loading: after a delay
  Loading --> Failed: login error or bug
  Loaded --> Loading: config changed
  Loaded --> [*]: unload
  • Known. At startup the server reads every manifest.json, sets the tier, finds the icons and checks for a setup_flow.py.
  • Configured. A provider loads only when it has a config. Built-in providers get one by themselves. A few providers in DEFAULT_PROVIDERS (constants.py) are set up by the server once, some only after their devices were seen on the network. All others are added by the user, through the settings or a setup flow.
  • Loading. _load_provider in mass.py imports the module (for a core provider it first installs the pinned requirements), calls setup(), loads and validates the config, and calls handle_async_init(), each with a time limit. A provider with depends_on waits until that provider has loaded.
  • Loaded. The provider is registered and the music or player controller is told. In the background loaded_in_mass() runs, which is where a provider registers its own API commands. Then PROVIDERS_UPDATED is signaled and discovery runs for it.
  • RetryWait and Failed. The error is stored on the config as last_error, so the app can show it. A MusicAssistantError is retried after a growing delay. A login error, an UnsupportedSystemError or any other exception is not.
  • Config changed. By default Provider.update_config reloads the provider a second after a setting changes.
  • Unload. mass.unload_provider stops its library sync, unloads providers that depend on it, removes its players and calls unload(is_removed).

A provider declares what it can do as a set of ProviderFeature values, such as library sync or search for a music provider. Code checks it with provider.supports_feature() or finds providers with mass.get_providers_supporting_feature(). Pass the set to the constructor; do not override the supported_features property.

One provider domain can run as several instances when its manifest sets multi_instance, for example two accounts of one streaming service. Each instance has its own instance_id and config. Code that works with a loaded provider uses the instance id; the domain names the provider code.

  • Built-in providers (builtin in the manifest) are always configured and load also in safe mode. The allow_disable field says whether the user can switch one off.
  • The tier (ProviderTier) says who maintains a provider. CORE providers ship in the server repository. COMMUNITY providers live in their own repository and are installed through the community catalog.
  • The community catalog controller installs a community provider into the data folder, under community_providers/<domain>/. It registers the manifest only while the catalog’s index allows that version to load. From then on the provider loads like any other. Its requirements go into a folder of their own, never into the server’s environment.
  • During development, --dev-providers-dir loads providers from a folder outside the server, as community providers, in dev mode only.

Music Assistant is a project of the Open Home Foundation.