
jellyctrl
io.github.lidless-labs/jellyctrl
Jellyfin CLI and MCP server for libraries, playback sessions, scans, and users with gated writes.
Documentation
jellyctrl
What it does
jellyctrl provides a CLI and an MCP server for Jellyfin. Use the CLI to check server health, see what is playing, search a library, or perform other Jellyfin operations. The MCP server also exposes playback controls, user management, and other operations that change Jellyfin state.
Install
This guide covers the published npm release jellyfin-mcp@0.5.1. Its package manifest declares Node.js 20.18.1 or later. The release's CI matrix covers Node.js 20 and 22. Package manifest · CI workflow
npm install --global jellyfin-mcp@0.5.1
The package installs four executables.
| Executable | Purpose |
|---|---|
jellyctrl, jellyctl | Two names for the same CLI. Run jellyctrl --help for the command list. The mcp subcommand starts the stdio server. |
jellyfin-mcp | Starts the stdio server directly. |
jellyfin-mcp-http | Starts the loopback Streamable HTTP server. |
Configure
Set JELLYFIN_URL to the Jellyfin base URL and JELLYFIN_API_KEY to a key created in Jellyfin under Dashboard > API Keys. Both variables are required by the CLI's Jellyfin commands and by either MCP transport. The API key authenticates requests from this process to Jellyfin. TLS certificate verification is on by default. JELLYFIN_VERIFY_SSL=false disables it for that connection. JELLYFIN_TIMEOUT sets the upstream request timeout in seconds and defaults to 30. Configuration · API client
export JELLYFIN_URL='https://jellyfin.example'
export JELLYFIN_API_KEY='your-api-key-here'
jellyctrl sessions --active-only
stdio
Configure your MCP client to launch jellyfin-mcp or jellyctrl mcp with the two environment variables above. To launch this version without a global install, use npx as the command with arguments -y and jellyfin-mcp@0.5.1. The stdio server identifies itself as jellyfin-mcp version 0.5.1 during initialization. Stdio entry point · Server registration
Streamable HTTP
Run jellyfin-mcp-http with the Jellyfin settings and at least one HTTP bearer token. Point your MCP client at the loopback listener's /mcp endpoint and send Authorization: Bearer <token> on MCP requests. The endpoint accepts POST. The listener also serves GET /healthz without a bearer token. Both endpoints check that Host names a loopback address or alias. Origin, when present, must be an HTTP or HTTPS loopback origin. HTTP listener
| Variable | Value |
|---|---|
JELLYFIN_MCP_HTTP_HOST | IPv4 or IPv6 loopback only. Accepted values are 127.0.0.1 (default) and ::1. |
JELLYFIN_MCP_HTTP_PORT | Integer from 1 to 65535. Defaults to 3000. |
JELLYFIN_MCP_HTTP_TOKEN | Token whose mode is set by JELLYFIN_MCP_REMOTE_MODE, which defaults to observe. |
JELLYFIN_MCP_REMOTE_MODE | Mode for the unscoped token. Accepts observe, managed, or full. Defaults to observe. |
JELLYFIN_MCP_HTTP_TOKEN_READ | observe token for read-only access. |
JELLYFIN_MCP_HTTP_TOKEN_ROUTINE | managed token for reads and routine writes, such as pausing playback. |
JELLYFIN_MCP_HTTP_TOKEN_HIGH_IMPACT | full token for reads, routine writes, and high-impact operations. |
Tokens must be at least 32 characters after trimming. Use a different value for each token and for the Jellyfin API key. The bearer mode determines both the tools listed to the client and the calls it can make. The listener rejects request bodies above 1 MiB. HTTP configuration · Token and tool policy
Tools
The stdio server lists 66 tools. These are examples of the queries available in both stdio and HTTP observe mode. Tool registration
| Tool | What it returns |
|---|---|
jellyfin_get_status | Server version and restart or update status. |
jellyfin_health_brief | Server, playback, task, storage, plugin, activity, and library scan summaries. |
jellyfin_list_sessions | Connected sessions and what they are playing. |
jellyfin_search_items | Library items matching a name query. |
jellyfin_find_missing_metadata | Counts and examples of missing overviews, primary images, and provider IDs. |
Search defaults to 20 items and accepts up to 200. Library item pages accept up to 200 rows and playlist item pages accept up to 100. The missing-metadata and duplicate reports each scan up to 2,000 items per call. Pass their nextCursor as cursor with the same query to continue. Search · Library reports · Playlists
The health brief returns up to three exceptions per section. Continue Watching tools that scan the resume queue read up to four pages or 125 items, whichever comes first. Health brief · Resume queue
The MCP adapter caps tool result text at 90,000 UTF-8 bytes and marks truncated results. The Jellyfin client rejects JSON responses above 2 MiB. Tool adapter · Result cap test · API client
Safety
The CLI's inspection commands perform reads. Use an HTTP observe token for a read-only MCP connection. Stdio exposes the full tool set. HTTP requires a mode that permits the operation, then the tool applies its own confirmation check.
| Operation | HTTP mode | Tool confirmation |
|---|---|---|
| Create, delete, enable, or disable a user, or set a password | full | confirm: true |
| Restart or shut down the server | full | confirm: true |
| Stop one session or all matching sessions | full | confirm: true |
| Pause, resume, seek, cast, or message sessions | managed or full | confirm: true |
| Run a scheduled task, refresh an item, clear Continue Watching entries, authorize Quick Connect, or remove playlist or collection entries | full | confirm: true |
| Change watched, favorite, or resume state, or create or add to a playlist or collection | managed or full | confirm: true |
| Scan all libraries | managed or full | confirm: true |
Refresh one library with jellyfin_scan_library and a libraryId | managed or full | Confirmation is optional |
For an HTTP call to jellyfin_restart_server with valid Host and Origin headers, the bearer policy runs before the tool handler checks confirmation. Bearer policy · Restart tool · API client
flowchart TD
Request["POST /mcp with a restart tool call"] --> Token{"Bearer token valid?"}
Token -->|No| Unauthorized["401 Unauthorized"]
Token -->|Yes| Mode{"Token mode is full?"}
Mode -->|No| Forbidden["403 Tool is not permitted"]
Mode -->|Yes| Confirm{"confirm is true?"}
Confirm -->|No| Refused["MCP tool error"]
Confirm -->|Yes| Restart["POST /System/Restart to Jellyfin"]
Why not the Jellyfin Web UI or raw API scripts?
| Approach | Library, session, and user ops | Write safety for AI agents | CLI + MCP in one package |
|---|---|---|---|
| jellyctrl | Typed queries for libraries, playback sessions, scans, tasks, and users | Writes gated by default, destructive calls confirm-gated | Yes (jellyctrl + jellyfin-mcp) |
| Jellyfin Web UI | Full visual admin console | Human click-driven | No |
curl / Python API scripts | Flexible one-offs | Manual auth and error handling | Scripts only |
Keep the Jellyfin web dashboard for initial server setup and playback. Use jellyctrl when you want cron jobs, shell scripts, or an AI client (Claude Code, Claude Desktop, Cursor, Codex) to check active streams, trigger library scans, or audit users with explicit write gates.
FAQ
Can an AI agent delete media files or user accounts through jellyctrl?
No. Mutating and destructive actions stay gated behind explicit opt-in and confirmation flags.
Does jellyctrl work over both CLI and MCP?
Yes. Installing jellyfin-mcp provides jellyctrl (and jellyctl) for shell/cron usage plus jellyfin-mcp for stdio MCP clients.
Does jellyctrl require any Jellyfin server plugin?
No. It speaks directly to the standard Jellyfin HTTP API using an API key (JELLYFIN_URL and JELLYFIN_API_KEY).
Part of Lidless Labs
jellyctrl is maintained by Lidless Labs (GitHub). Related homelab tools:
- immichctrl - Immich photo library CLI and MCP server, writes off by default
- adguardctrl - AdGuard Home DNS CLI and MCP server with confirm-gated writes
- proxmox-mcp - Proxmox VE MCP server and CLI with gated writes
- n8nctrl - n8n workflow inspection, validation, and ops over CLI and MCP
- watchtower - self-hosted NOC dashboard for LibreNMS and Proxmox VE
Development
Run these commands from a source checkout. The verifier runs TypeScript checks, Vitest with mocked Jellyfin requests, and the build.
npm ci
./scripts/verify
jellyfin-mcpnpm install jellyfin-mcpRelated Servers
io.github.lidless-labs/adguardctrl
AdGuard Home CLI and MCP server for DNS filtering, rewrites, and clients with confirm-gated writes.
io.github.lidless-labs/cortex-mcp
Cortex MCP server for running observable analyzers and confirm-gated responders from AI clients.
io.github.lidless-labs/librenmsctrl
LibreNMS CLI and MCP server for devices, ports, sensors, and alerts over stdio with gated writes.