Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jellyfin-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
jellyfin-cli
An agent-optimized CLI tool for interacting with the Jellyfin API.
Package Manager: Development uses Bun. Published package execution supports both
bunxandnpx.
Installation
# Install Bun if you haven't already
curl -fsSL https://bun.sh/install | bash
# Install the CLI globally
bun install -g jellyfin-cli
# Run directly with bunx (no install)
bunx jellyfin-cli --help
# Run directly with npx (no install)
npx jellyfin-cli --help
# Or clone and build from source
git clone https://github.com/unbraind/jellyfin-cli.git
cd jellyfin-cli
bun install
bun run buildInstalled executable names: jf, jellyfin-cli, and jf-cli.
Quick Start
# Quick setup with server URL and API key
jf setup --server http://your-server:8096 --api-key YOUR_API_KEY
# Or use username/password authentication
jf setup --server http://your-server:8096 --username your-user --password your-password
# Test connection
jf config test
# Run diagnostics (connectivity/auth/OpenAPI checks)
jf config doctor
# Enforce non-destructive mode for all following commands
JELLYFIN_READ_ONLY=1
# List libraries
jf library list
# Search for content
jf items search "matrix"
# Control playback
jf sessions list
jf sessions play SESSION_ID ITEM_IDFeatures
- Full Jellyfin API Coverage: All major API endpoints supported
- Agent-Optimized: Designed for LLM/AI agent integration with structured output
- Toon Format: Default YAML output format for easy parsing
- Multiple Output Formats: Toon, JSON, table, raw, YAML, and Markdown
- Secure: Credentials stored in user config directory, never committed
- Type-Safe: Full TypeScript implementation
- Bun-Powered: Fast package management and builds with Bun
- Setup Wizard: Interactive configuration wizard
- Startup Diagnostics:
jf setup startupreports startup wizard state in structured output - Startup Wizard Configuration:
jf setup update-configurationupdates/Startup/Configuration - Diagnostics:
jf config doctorfor agent-safe health checks - Read-Only Guard: global
--read-onlyorJELLYFIN_READ_ONLY=1to block mutating commands - Explain Mode: global
--explainorJELLYFIN_EXPLAIN=1prints redacted request metadata tostderr - Release Guardrails: built-in file length + secret scanning checks for safe releases
- Plugin Management: List, configure, and manage plugins
- Device Management: View and manage connected devices
- Statistics: View library statistics and item counts
- Collections: Manage box sets and collections
- Favorites: Quick access to favorite items
- Streaming URLs: Get direct URLs for video, audio, and subtitles
Configuration
Environment Variables
| Variable | Description |
|---|---|
JELLYFIN_SERVER_URL |
Server URL |
JELLYFIN_API_KEY |
API key |
JELLYFIN_USERNAME |
Username for authentication |
JELLYFIN_PASSWORD |
Password for authentication |
JELLYFIN_USER_ID |
User ID |
JELLYFIN_TIMEOUT |
Request timeout (ms) |
JELLYFIN_OUTPUT_FORMAT |
Output format (toon, json, table, raw, yaml, markdown) |
JELLYFIN_READ_ONLY |
1/true/on/yes blocks mutating commands globally |
JELLYFIN_EXPLAIN |
1/true/on/yes emits redacted request metadata to stderr |
Short aliases are also supported:
JF_SERVER_URLJF_API_KEYJF_USERJF_PASSWORDJF_USER_IDJF_TIMEOUTJF_FORMAT
Configuration File
Settings are stored in ~/.jellyfin-cli/settings.json.
# View current configuration
jf config get
# Show config file path
jf config path
# List all configured servers
jf config list
# Set configuration
jf config set --server URL --api-key KEYOutput Formats
The CLI supports multiple output formats optimized for different use cases:
Toon (Default)
The default format is optimized for LLM/agent consumption using YAML:
type: items
data:
- id: abc123
name: The Matrix
type: Movie
year: 1999
rating: 8.7
meta:
timestamp: "2024-01-01T00:00:00.000Z"
format: toon
version: "1.0.0"JSON
Standard JSON output for programmatic processing:
jf items list --format jsonTable
Human-readable table format:
jf users list --format tableRaw
Raw output without formatting:
jf system info --format rawCommands
Setup & Configuration
jf setup- Interactive setup wizardjf setup wizard- Explicit alias for setup wizard workflowsjf setup status- Check setup statusjf setup validate- Validate setup readiness (config/connectivity/auth/OpenAPI/output-format checks)jf setup env- Show/export environment variables (--shell, structured--format json, or--write-file <path>)jf setup startup- Inspect Jellyfin startup wizard state (read-only)jf setup configuration- Alias ofsetup startupfor endpoint-aligned diagnosticsjf setup update-configuration- Update startup wizard configuration valuesjf config set- Set configuration valuesjf config get- Display current configurationjf config path- Show configuration file pathjf config list- List all configured serversjf config use <name>- Switch to a named server configurationjf config delete <name> --force- Delete a server configurationjf config reset --force- Reset all configurationjf config test- Test connection to serverjf config doctor- Check config/auth/connectivity/OpenAPI diagnosticsjf setup validate --require-all --validate-formats --format json- Setup wizard readiness gate for CI/agentsjf config doctor --require-connected --require-auth --require-openapi --require-valid-formats --validate-formats- Enforce machine-checkable release gatesjf schema openapi- Summarize live server OpenAPI capabilities for agent discoveryjf schema research- Emit consolidated OpenAPI + full/read-only coverage snapshot for API researchjf schema tools- Export command tool schemas for LLM function-calling, with optional live OpenAPI endpoint matchesjf schema coverage- Estimate API coverage, list unmatched OpenAPI operations, and suggest command namesjf schema suggest- Generate candidate CLI command patterns from OpenAPI intent matches or coverage gaps
Release Validation
bun run version:sync
bun run validate:releaseThis syncs/enforces the version policy and runs typecheck, lint, tests, build, dist smoke checks, TypeScript code-length enforcement (<=300 lines excluding comments), tracked-file secret scan, and git-history secret scan.
It also validates npm packaging (npm pack --dry-run) plus local npx and bunx smoke runs from the packed tarball.
CI/CD and Release Operations
GitHub Actions workflows are configured for professional release management:
CI(.github/workflows/ci.yml): PR/push quality gatesCodeQL(.github/workflows/codeql.yml): static security analysisSecret Scan(.github/workflows/secret-scan.yml): tracked-file + git-history + Gitleaks checksCommit Quality(.github/workflows/commit-quality.yml): PR title + commit subject professionalism checksRelease Prepare(.github/workflows/release-prepare.yml): manual release candidate validation + artifact packagingRelease Publish (Manual)(.github/workflows/release-publish.yml): guarded npm publish workflow (manual only, optional dry-run)- Uses npm Trusted Publishing when configured; falls back to
NPM_TOKENsecret
- Uses npm Trusted Publishing when configured; falls back to
GitHub Release (Manual)(.github/workflows/release-github.yml): creates annotated tag + GitHub release frompackage.jsonversion
Contributor and governance standards:
Version Policy
- Version format is mandatory:
YYYY.M.DorYYYY.M.D-<N> - Example (first release of day):
2026.3.4 - Example (third release on same day):
2026.3.4-3 - Date uses UTC day
Nis the release index for that UTC day-1is not allowed (useYYYY.M.Dwithout suffix)- Use
bun run version:syncbefore preparing a release
Read-Only Mode
Use read-only mode for safe agent workflows against production libraries:
# one command
jf --read-only items list --limit 5
# entire shell session
export JELLYFIN_READ_ONLY=1
jf library list
# inspect API request mapping for a command
jf --explain system infoMutating operations are blocked with a structured Toon error while read operations continue to work.
System
jf system info- Get system informationjf system health- Check server healthjf system restart- Restart the serverjf system shutdown- Shutdown the serverjf system activity- Get activity log
Users
jf users list- List all usersjf users get <userId>- Get user by IDjf users me- Get current user infojf users by-name <username>- Get user by usernamejf users create <username>- Create a new userjf users update-password <userId>- Update user passwordjf users delete <userId> --force- Delete a userjf users policy <userId>- Get user policyjf users update-policy <userId>- Update user policy (admin rights, permissions)jf users config <userId>- Get user configurationjf users update-config <userId>- Update user configuration (preferences)
Items
jf items list- List itemsjf items get <itemId>- Get item by IDjf items latest- Get latest itemsjf items resume- Get resume itemsjf items search <term>- Search for itemsjf items similar <itemId>- Get similar itemsjf items intros <itemId>- Get intro videosjf items chapters <itemId>- Get chaptersjf items special-features <itemId>- Get special featuresjf items trailers <itemId>- Get local trailersjf items ancestors <itemId>- Get parent itemsjf items parts <itemId>- Get additional partsjf items playback-info <itemId>- Get playback infojf items stream-url <itemId>- Get video stream URLjf items audio-url <itemId>- Get audio stream URLjf items image-url <itemId>- Get image URLjf items subtitle-url <itemId> <mediaSourceId> <streamIndex>- Get subtitle URLjf items refresh <itemId>- Refresh item metadatajf items update <itemId>- Update item metadata (name, overview, genres, etc.)jf items delete <itemId>- Delete an item
Sessions
jf sessions list- List all active sessionsjf sessions get <sessionId>- Get session by IDjf sessions play <sessionId> <itemIds...>- Play itemsjf sessions pause <sessionId>- Pause playbackjf sessions unpause <sessionId>- Resume playbackjf sessions stop <sessionId>- Stop playbackjf sessions next <sessionId>- Next trackjf sessions previous <sessionId>- Previous trackjf sessions seek <sessionId> <ticks>- Seek to positionjf sessions mute <sessionId>- Mute audiojf sessions unmute <sessionId>- Unmute audiojf sessions volume <sessionId> <level>- Set volume leveljf sessions message <sessionId>- Send message
Library
jf library list- List all librariesjf library refresh- Refresh all librariesjf library genres- List all genresjf library studios- List all studiosjf library persons- List all personsjf library artists- List all artistsjf library album-artists- List all album artistsjf library get-genre <name>- Get a genre by namejf library get-person <name>- Get a person by namejf library get-studio <name>- Get a studio by name
User Data
jf userdata favorite <itemId>- Mark as favoritejf userdata unfavorite <itemId>- Remove from favoritesjf userdata played <itemId>- Mark as playedjf userdata unplayed <itemId>- Mark as unplayedjf userdata like <itemId>- Like an itemjf userdata dislike <itemId>- Dislike an itemjf userdata unrate <itemId>- Remove rating
Favorites
jf favorites list- List favorite itemsjf favorites add <itemId>- Add to favoritesjf favorites remove <itemId>- Remove from favorites
Collections
jf collections list- List all collectionsjf collections get <collectionId>- Get collection detailsjf collections items <collectionId>- List items in collectionjf collections create <name>- Create a new collectionjf collections add <collectionId> <itemIds...>- Add items to collectionjf collections remove <collectionId> <itemIds...>- Remove items from collection
Tasks
jf tasks list- List all scheduled tasksjf tasks get <taskId>- Get task by IDjf tasks run <taskId>- Start a taskjf tasks running <taskId>- Alias oftasks runjf tasks stop <taskId>- Stop a running taskjf tasks triggers <taskId>- List task triggersjf tasks add-trigger <taskId>- Add a task triggerjf tasks delete-trigger <taskId> <triggerId>- Delete a task trigger
Playlists
jf playlists create <name>- Create a playlistjf playlists add <playlistId> <itemIds...>- Add itemsjf playlists remove <playlistId> <entryIds...>- Remove itemsjf playlists items <playlistId>- List playlist itemsjf playlists delete <playlistId>- Delete a playlist
Live TV
jf livetv info- Get Live TV infojf livetv channels- List channelsjf livetv channel <channelId>- Get channel by IDjf livetv programs- List programsjf livetv program <programId>- Get program by IDjf livetv recordings- List recordingsjf livetv timers- List timersjf livetv timer <timerId>- Get timer by IDjf livetv create-timer- Create a timerjf livetv delete-timer <timerId>- Delete a timerjf livetv series-timers- List series timersjf livetv series-timer <id>- Get series timer by IDjf livetv delete-series-timer <id>- Delete a series timerjf livetv schedules-direct-countries- List Schedules Direct countries
Discover
jf discover recommendations- Get recommendationsjf discover mix <itemId>- Get instant mix
Plugins
jf plugins list- List all pluginsjf plugins get <pluginId>- Get plugin detailsjf plugins config <pluginId>- Get plugin configurationjf plugins uninstall <pluginId>- Uninstall a plugin
Devices
jf devices list- List all devicesjf devices info- Get current device infojf devices get <deviceId>- Get device detailsjf devices rename <deviceId> <name>- Rename devicejf devices delete <deviceId>- Delete device
Branding
jf branding get- Get branding configuration
Statistics
jf stats counts- Get library item counts
API Keys
jf apikeys list- List all API keysjf apikeys create <app>- Create new API keyjf apikeys delete <key>- Delete API key
Notifications
jf notifications types- List notification typesjf notifications list- List user notificationsjf notifications send- Send admin notification
SyncPlay
jf syncplay list- List SyncPlay groupsjf syncplay groups- Alias ofsyncplay listjf syncplay create [--name <name>]- Create a groupjf syncplay new [--name <name>]- Alias ofsyncplay createjf syncplay join <groupId>- Join a groupjf syncplay leave- Leave groupjf syncplay pause- Pause group playbackjf syncplay unpause- Resume group playbackjf syncplay stop- Stop group playback
Quick Connect
jf quickconnect status- Check if Quick Connect is enabledjf quickconnect init- Initialize Quick Connectjf quickconnect check <secret>- Check connection statusjf quickconnect authorize <code>- Authorize request
Auth
jf auth providers- List authentication providersjf auth password-reset-providers- List password reset providersjf auth keys- List API keys (read-only alias)
Backup
jf backup list- List backupsjf backup create- Create a backupjf backup restore <path>- Restore from backupjf backup delete <path>- Delete backup
Subtitles
jf subtitles search <itemId> <language>- Search remote subtitlesjf subtitles download <itemId> <subtitleId>- Download subtitlejf subtitles delete <itemId> <index>- Delete subtitle trackjf subtitles providers- List subtitle providers
Media
jf media segments <itemId>- Get media segmentsjf media lyrics <itemId>- Get lyricsjf media theme-songs <itemId>- Get theme songsjf media theme-videos <itemId>- Get theme videosjf media external-ids <itemId>- Get external IDsjf media external-id-infos <itemId>- Alias for external IDsjf media remote-images <itemId>- Get remote imagesjf media download-image <itemId>- Download remote imagejf media hls-url <itemId>- Get HLS playlist URLjf media video-stream-url <itemId>- Get direct video stream URLjf media audio-stream-url <itemId>- Get direct audio stream/universal URLjf media hls-legacy-url <itemId> <playlistId>- Get legacy HLS playlist URLjf media hls-audio-segment-url <itemId> <segmentId>- Get legacy HLS audio segment URLjf media item-file-url <itemId>- Get direct item file URLjf media kodi-strm-url <type> <id>- Get Kodi.strmURLjf media branding-css-url- Get static branding CSS URL
Dashboard
jf dashboard pages [--main-menu true|false]- List dashboard configuration pagesjf dashboard page <name>- Get dashboard configuration page source
Localization
jf localization options- Get localization optionsjf localization countries- Get countriesjf localization cultures- Get cultures/languagesjf localization ratings- Get rating systems
Environment
jf environment drives- Get available drivesjf environment logs- Get log filesjf environment log <name>- Get log file contentjf environment storage- Get storage info
TV Shows
jf tvshows episodes <seriesId>- Get episodes for a seriesjf tvshows seasons <seriesId>- Get seasons for a seriesjf tvshows next-up- Get next up episodesjf tvshows upcoming- Get upcoming episodesjf tvshows similar <itemId>- Get similar shows for a series/episode
Packages
jf packages list- List available packagesjf packages get <packageId>- Get package detailsjf packages install <packageId>- Install a packagejf packages cancel <installationId>- Cancel installationjf packages installing- List installing packagesjf packages repositories- List plugin repositories
Images
jf images list <itemId>- List item imagesjf images url <itemId> <type>- Get image URLjf images artist-url <artistName> <type>- Get artist image URL by namejf images genre-url <genreName> <type>- Get genre image URL by namejf images music-genre-url <genreName> <type>- Get music genre image URL by namejf images person-url <personName> <type>- Get person image URL by namejf images studio-url <studioName> <type>- Get studio image URL by namejf images delete <itemId> <type>- Delete imagejf images user <userId>- Get user profile image URL
Suggestions
jf suggestions get- Get content suggestions
Years
jf years list- List all yearsjf years get <year>- Get items for a year
Music Genres
jf music-genres list- List all music genresjf music-genres get <name>- Get music genre by name
Trickplay
jf trickplay hls-url <itemId> <width>- Get trickplay HLS playlist URLjf trickplay tile-url <itemId> <width> <index>- Get trickplay tile image URL
Channels
jf channels list- List all channelsjf channels features [channelId]- Get channel featuresjf channels items <channelId>- Get channel itemsjf channels latest <channelId>- Get latest channel items
Schema (Agent/LLM Optimization)
jf schema- Output JSON schema for all Toon format typesjf schema <type>- Output JSON schema for a specific typejf schema list- List all available output typesjf schema validate [type] [--from auto|json|yaml|toon] [--input <payload>]- Validate output payloads against CLI schemas (stdin or inline)jf schema openapi [--include-paths --limit 50] [--method GET] [--tag Users] [--path-prefix /Users] [--search text] [--read-only-ops] [--endpoint /api-docs/openapi.json] [--for-command "items list"]- Fetch/summarize/filter OpenAPI and infer likely endpoints for a CLI intentjf schema research [--method GET] [--tag Users] [--path-prefix /Users] [--endpoint /api-docs/openapi.json] [--command-prefix items] [--min-score 3] [--require-coverage 100] [--include-unmatched] [--limit 20]- Generate one consolidated OpenAPI + full/read-only coverage snapshotjf schema tools [--command <prefix> --limit <n> --openapi-match --name <server>]- Export tool schemas with input schema, read-only metadata, and optional live OpenAPI endpoint matches per commandjf schema coverage [--method GET] [--tag Users] [--path-prefix /Users] [--read-only-ops] [--endpoint /api-docs/openapi.json] [--command-prefix items] [--min-score 3] [--require-coverage 100] [--suggest-commands] [--limit 50]- Estimate intent-based OpenAPI coverage for current CLI command set and optionally generate candidate CLI names for unmapped endpointsjf schema suggest [--for-command "users list"] [--method GET] [--tag Users] [--path-prefix /Users] [--search text] [--read-only-ops] [--endpoint /api-docs/openapi.json] [--min-score 3] [--limit 20]- Generate structured CLI command suggestions from live OpenAPI (intent mode with--for-command, or uncovered operation mode without it)
Agent/LLM Optimization
This CLI is designed to be easily used by AI agents and LLMs:
- Structured Output: The default
toonformat provides consistent, parseable YAML output - Type Information: Every output includes a
typefield indicating the data structure - Stable Envelope: Output always includes a top-level
typeand structureddata - Error Handling: Errors are returned in a consistent format
- No Interactive Prompts: All inputs are via command-line arguments
Example Agent Integration
// Execute command and parse output
const result = await exec('jf items search "matrix" --format toon');
const data = yaml.parse(result);
if (data.type === 'search_result') {
for (const hint of data.data.hints) {
console.log(`${hint.name} (${hint.type})`);
}
}Python Example
import yaml
import subprocess
def get_items(search_term):
result = subprocess.run(
['jf', 'items', 'search', search_term, '--format', 'toon'],
capture_output=True,
text=True
)
data = yaml.safe_load(result.stdout)
if data['type'] == 'error':
raise Exception(data['data']['error'])
if data['type'] == 'search_result':
return data['data']['hints']
return []Development
This project uses Bun for package management, testing, and building.
# Install dependencies
bun install
# Build
bun run build
# Run in development mode
bun run dev
# Run tests
bun test
# Run tests with coverage
bun run test:coverage
# Type check
bun run typecheck
# Lint
bun run lintDocumentation
- API Reference - Full command documentation
- Toon Output Format - Output format specification
License
MIT