Skip to main content
Glama

libretime-mcp

A Model Context Protocol server that connects Claude (or any MCP-compatible AI client) to a LibreTime radio station via its REST API. Ask Claude to check your schedule, manage files, pull listener stats, and more — directly from your station.

Two ways to run it:

  • stdio — Claude Desktop spawns it as a subprocess. No hosting required. Best if you just want AI tooling on your own machine.

  • HTTP — Self-host it as a network server. Best for advanced setups where you want to connect a remote MCP client or integrate with another service.

Tools

Tools are organised into subdirectories under src/tools/ — one file per tool.

Read-only (client & admin)

  • get_shows — list all shows

  • get_show — get a single show by ID

  • get_show_instances — list scheduled show slots (filterable by show, date range)

  • get_schedule — broadcast schedule

  • get_stream_state — current on-air state

  • get_station_info — station name, timezone, and configuration

Analytics (admin)

  • get_listener_counts — disabled (API returns full history with no filtering, ~120k records)

  • get_playout_history — recent playout history with track metadata

Media library (admin)

  • search_files — search your media library

  • upload_file — upload an audio file via drag-and-drop UI (works in both stdio and HTTP modes — see File Upload)

  • update_file_metadata — edit track metadata

  • delete_file — remove a file

Shows & scheduling (admin)

  • create_show — create a new show

  • schedule_file — schedule an uploaded file into a show instance

Playlists (admin)

  • get_playlists — list all playlists

  • create_playlist — create a new playlist

  • get_playlist_contents — list items in a playlist

  • add_to_playlist — add a file or stream to a playlist

Users (admin)

  • get_users — list station users (pass include_email: true to include email addresses, omitted by default)

  • get_hosts — list show hosts with their show assignments

Related MCP server: lastfm-mcp

File Upload

upload_file renders a drag-and-drop UI in the Claude chat window. It works the same way in both transport modes:

  • HTTP mode — the UI posts directly to the MCP server's /upload endpoint

  • stdio mode — the admin server spins up a lightweight sidecar HTTP server (default port 4000) that the UI posts to. The MCP protocol itself continues over stdio; the upload is a side-channel.

Both modes use the same upload token generated at startup, so there's no separate configuration needed. To change the sidecar port in stdio mode set UPLOAD_PORT in your environment.

Option 1 — Claude Desktop (stdio)

No hosting required. Claude Desktop spawns the server as a subprocess and manages its lifecycle.

Global install

npm install -g @powerfm/libretime-mcp

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "libretime": {
      "command": "libretime-mcp",
      "args": [],
      "env": {
        "LIBRETIME_URL": "https://your-instance.example.com",
        "LIBRETIME_USER": "user",
        "LIBRETIME_PASS": "pass",
        "LIBRETIME_API_KEY": "your_libretime_api_key"
      }
    }
  }
}

LIBRETIME_API_KEY is the general.api_key value from your LibreTime config.yml. It is required for file uploads — omit it if you are using the read-only client.

Use libretime-mcp-client instead of libretime-mcp for read-only access and ommit LIBRETIME_API_KEY.

npx (no install)

{
  "mcpServers": {
    "libretime": {
      "command": "npx",
      "args": ["@powerfm/libretime-mcp"],
      "env": {
        "LIBRETIME_URL": "https://your-instance.example.com",
        "LIBRETIME_USER": "user",
        "LIBRETIME_PASS": "pass",
        "LIBRETIME_API_KEY": "libretime-api-key"
      }
    }
  }
}

From source

Clone the repo, create a .env file with your credentials (see Development below), then point Claude Desktop at the local build:

{
  "mcpServers": {
    "libretime": {
      "command": "node",
      "args": ["/absolute/path/to/libretime-mcp/dist/stdio/admin.js"],
      "env": {
        "LIBRETIME_URL": "https://your-instance.example.com",
        "LIBRETIME_USER": "user",
        "LIBRETIME_PASS": "pass"
      }
    }
  }
}

Option 2 — Self-hosted HTTP server

Best for advanced setups — connect any MCP-compatible client over the network.

Install:

npm install -g @powerfm/libretime-mcp

Set environment variables:

LIBRETIME_URL=https://your-libretime-instance.example.com
LIBRETIME_USER=your_api_username
LIBRETIME_PASS=your_api_password
MCP_API_KEY=your_secret_api_key     # clients must send this as a Bearer token
MCP_PORT=3000                        # optional, defaults to 3000 (admin) / 3001 (client)
CORS_ORIGIN=https://your-app.example.com  # optional, lock CORS to a specific origin (default: reflect any)

Generate a random API key:

libretime-mcp-keygen

Start the server:

libretime-mcp-http           # full access, port 3000
libretime-mcp-client-http    # read-only, port 3001

Clients must send:

POST /mcp
Authorization: Bearer <MCP_API_KEY>

Requests without a valid key receive 401 Unauthorized.

Development

git clone https://github.com/nelsonra/libretime-mcp.git
cd libretime-mcp
npm install
cp .env.example .env   # fill in your credentials
# Dev (tsx watch — restarts on save)
npm run dev:client          # read-only stdio
npm run dev:admin           # full-access stdio
npm run dev:client-http     # read-only HTTP (port 3001)
npm run dev:admin-http      # full-access HTTP (port 3000)

# Build
npm run build

# Tests
npm test

# MCP Inspector — browse and call tools interactively
npm run inspect:admin           # stdio admin server
npm run inspect:client          # stdio read-only server
npm run inspect:admin-http      # HTTP admin (start the server first, then run this)
npm run inspect:client-http     # HTTP read-only (start the server first, then run this)

The inspector opens a browser UI at http://localhost:5173 where you can list tools, see their schemas, and call them with custom inputs.

Servers

Command

Transport

Port

Access

libretime-mcp

stdio

—

Admin

libretime-mcp-client

stdio

—

Read-only

libretime-mcp-http

HTTP

3000

Admin

libretime-mcp-client-http

HTTP

3001

Read-only

Available Tools

19 tools
add_to_playlistA

Add a file or stream to a playlist. Use get_playlist_contents to check the current contents and determine the next position.

Inputs: playlist_id (required), file_id, position, stream_id.

create_playlistA

Create a new playlist in LibreTime. Returns the playlist ID for use with add_to_playlist.

Inputs: name (required), description.

create_showA

Create a new show in LibreTime. Returns the created show with its ID, which can be used to schedule instances.

Inputs: name (required), url, genre, description.

delete_fileC

Delete a file from the LibreTime media library by its ID.

Inputs: file_id (required).

get_hostsA

Get all show-to-host assignments. Enriches each entry with user details so you can see which presenter hosts which show by name.

Inputs: no named parameters.

get_playlist_contentsC

List the contents of a playlist.

Inputs: playlist_id (required).

get_playlistsB

List all playlists in the LibreTime media library.

Inputs: no named parameters.

get_playout_historyB

Get the history of tracks that have played on PowerFM. Enriches each entry with track title and artist from the file library. Use starts and ends to filter by time range (ISO 8601).

Inputs: ends, starts.

get_scheduleB

Get the broadcast schedule for a date range. Use starts_after and starts_before to filter by date (ISO 8601 format, e.g. 2024-06-01T00:00:00Z).

Inputs: starts_after (required), starts_before (required).

get_showA

Get details of a single LibreTime show by ID.

Inputs: id (required).

get_show_instancesA

List scheduled instances of a show. Optionally filter by show ID or date range.

Inputs: show_id, starts_after, starts_before.

get_showsA

List all shows registered in LibreTime. Returns each show's id, name, description, and genre.

Inputs: no named parameters.

get_station_infoC

Get basic station information such as the station name.

Inputs: no named parameters.

get_stream_stateA

Check whether the PowerFM station is currently broadcasting live.

Inputs: no named parameters.

get_usersB

List all LibreTime users (presenters and admins). Returns id, username, name, and role. Roles: G = Guest, H = Host, P = Manager, A = Admin.

Inputs: include_email.

schedule_fileA

Schedule an uploaded file into a show instance at a specific time. Fetches the file duration automatically to calculate the end time. Use get_show_instances to find the instance ID for the show slot you want to fill.

Inputs: file_id (required), starts_at (required), instance_id (required), position.

search_filesA

Search the LibreTime media library. Optionally filter by genre. Returns file id, name, track title, artist, album, length, and mime type.

Inputs: genre.

update_file_metadataB

Update metadata for a file already in the LibreTime library (track title, artist, album, genre).

Inputs: file_id (required), genre, album_title, artist_name, +1 more.

upload_fileA

Upload an audio file to the LibreTime media library. Provide a URL to fetch the file from, or a local file path when running in stdio mode. When neither is given, opens a file picker. Optionally pre-fill metadata such as track title, artist, album, and genre.

Inputs: url, genre, library, file_path, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 19 tools

    Disambiguation4/5

    Most tools target a distinct resource+action (shows, files, playlists, users, playout). However, get_schedule and get_show_instances both concern scheduled slots and could be confused, and get_shows vs get_show is a subtle singular/plural distinction that requires reading descriptions to distinguish.

    Naming Consistency5/5

    Uniform snake_case verb_noun pattern throughout: get_*, create_*, update_*, delete_*, upload_*, search_*, schedule_*, add_to_*. The lone domain-specific verb (schedule_file) and add_to_playlist fit the natural language of the action and don't break the pattern.

    Tool Count4/5

    19 tools cover a broad radio-station domain (shows, scheduling, media library, playlists, hosts, live state), so the size is justified rather than padded. It sits near the upper end of comfortable scoping but each tool maps to a real operation.

    Completeness3/5

    Media files have near-full lifecycle (search/upload/update/delete) and playlists can be created and populated, but there are notable gaps: no update_show or delete_show, no cancel/delete of scheduled instances, no remove_from_playlist, and no delete_playlist. These dead ends could force agents to abandon common maintenance tasks.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A dual-transport MCP server that exposes your API as tools to LLM clients, supporting both stdio transport for local clients like Claude Desktop and HTTP/SSE transport for remote clients like OpenAI's Responses API.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Unofficial, read-only access to your Last.fm listening history, charts, loved tracks, and artist, album and track lookups. Connect to https://lastfm-mcp.com/mcp and sign in with Last.fm. Not affiliated with Last.fm.
      54
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Exposes Spotify search, playlist, library, discovery, and playback tools to AI assistants over MCP Streamable HTTP. Supports Spotify OAuth, multi-client MCP OAuth with PKCE and dynamic client registration, encrypted token storage, and self-hosted Docker deployment.
      1
      AGPL 3.0
    • A
      license
      A
      quality
      C
      maintenance
      Connects MCP clients to a self-hosted photo library through its REST API, exposing assets, albums, people, search, and optional administrative toolsets with read-only defaults and confirm-gated writes. It supports stdio and localhost Streamable HTTP transports.
      5
      MIT