Skip to main content
Glama
StreamPilot
by nulldk
README.md
<p align="center">
  <img src="assets/logo.svg" alt="StreamPilot" width="56" height="56" />
</p>

<h1 align="center">StreamPilot</h1>

<p align="center">
  Local MCP server to manage Stremio, Nuvio, and Trakt accounts, addons, credentials, and watch history.
</p>

<p align="center">
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-gray.svg" alt="MIT License" /></a>
  <img src="https://img.shields.io/badge/python-3.11%2B-gray.svg" alt="Python 3.11+" />
  <img src="https://img.shields.io/badge/MCP-stdio-gray.svg" alt="MCP stdio" />
</p>

## What it does

- Manages multiple Stremio accounts, Nuvio profiles, and Trakt accounts from any MCP client or the CLI.
- Keeps passwords, API keys, logins, and private addon URLs in a local AES-GCM encrypted vault (`0600`) without exposing them to the model.
- Previews every remote change before applying it (`plan_*` → `apply_plan`), verifies the write, and stores pre-write snapshots for rollback (`plan_restore_change`).
- Tracks watch history, stats, libraries, and upcoming episodes across Stremio, Nuvio, and Trakt, and edits Nuvio profiles, home catalogs, settings, collections, and full account backups.
- Includes AIOManager v2.0.1 backup import/export and a read-only community advisor skill (`streampilot-advisor`) for Reddit discussions, curated Stremio/Nuvio guides, and TMDB recommendations.

## Quick start

Requires Python 3.11+ and a POSIX system with file locking. From the project directory:

```sh
uv sync --locked
.venv/bin/streampilot --help
```

*(On Nix: `nix shell nixpkgs#uv --command uv sync --locked`.)*

Register StreamPilot in your MCP client as a local `stdio` server:

```json
{
  "mcpServers": {
    "streampilot": {
      "command": "/absolute/path/to/streampilot/.venv/bin/streampilot",
      "args": ["serve"]
    }
  }
}
```

State is stored in `${XDG_STATE_HOME:-$HOME/.local/state}/streampilot` (`0700`). Override it with `STREAMPILOT_STATE_DIR` or `--state-dir /private/path` before `serve`. The SQLite state database is encrypted and its key lives in `vault.key` (`0600`). For manual backups, preserve both files and protect the key separately.

## Link accounts and store credentials

To sign in from the MCP, use any of these flows:

- **Official device linking.** Call `authorize_account` with `provider` and `alias`. Open the returned URL and approve in Stremio or Nuvio. On Stremio, enter the displayed code if prompted. Call `finish_account_authorization` with the authorization ID in the same MCP session. If still pending, respect the returned polling interval.
- **Stremio social OAuth.** Call `authorize_account` with `method: "facebook"` or `method: "apple"`. Complete authorization on Stremio and call `finish_account_authorization` in the same MCP session.
- **Direct login.** The host starting the server writes a single password or token to a private `0600` temporary file and passes its path in `STREAMPILOT_LOGIN_FILE`. Call `login_account` with `provider`, `alias`, and `email` to log in with a password. Omit `email` to supply a Stremio `authKey` or a Nuvio refresh token. The server consumes the file once, the client removes it, and the vault stores the resulting session encrypted.
- **AIOManager.** Use `preview_aiomanager_import` and `import_aiomanager` with a backup containing the sessions you want to reuse.

After linking an account, call `list_profiles` to inspect its profiles and `link_targets` to pair Stremio and Nuvio targets.

The CLI also supports linking accounts and storing credentials:

```sh
.venv/bin/streampilot account link stremio home --email user@example.org
.venv/bin/streampilot account link nuvio family --email user@example.org
.venv/bin/streampilot account profiles nuvio/family
.venv/bin/streampilot secret put debrid-home
.venv/bin/streampilot trakt link alice --client-id YOUR_APP_CLIENT_ID
```

The CLI prompts privately for passwords, API keys, and Trakt client secrets. For Stremio you can pass `--auth-key` instead of email and password. For Nuvio you can import a session with `--refresh-token`. A self-hosted Nuvio instance can be configured with `--base-url` and Supabase's `--publishable-key` (always use the client publishable key, never a service role key).

For Trakt, register [your application](https://trakt.tv/oauth/applications) first and authorize StreamPilot with the displayed device code. You can assign `trakt/alice` to one profile or reuse it across several. StreamPilot reads history and watchlist from that account. `trakt_native_status` reports Stremio's native Trakt link or returns instructions to complete authorization inside the app. On Nuvio TV, native tokens are stored inside the app per profile.

### Shared keys and private URLs

`plan_assign_credential` assigns a native key to a Nuvio profile. Call `list_credential_providers` to list supported services. For a Stremio or Nuvio addon whose URL is already configured, store it with `secret put name --kind manifest` and pass the alias to `plan_install_addon`.

If an addon documents a URL format with an API key, store a template with `secret put name --kind manifest-template` using `{api_key}` in the HTTPS path or query, then call `plan_install_addon` with `manifest_alias` and `credential_alias`. The server injects the encoded value and tracks the assignment, allowing the same key to be reused across Stremio addons and Nuvio native providers. Addons that produce signed or encrypted URLs need their configured manifest URL stored first.

To rotate a key, save the new value under the same alias and call `plan_refresh_assignments`. The preview lists all native targets and templated addons using that alias. Private URLs and vault values stay on the server; only the remote target receives the value or manifest it needs.

## Import and export with AIOManager

Compatibility targets [AIOManager v2.0.1](https://github.com/Sonicx161/AIOManager/releases/tag/v2.0.1) (backup format `2.0.0`). In AIOManager, export from **Settings** with **Accounts & Connections**, **Saved Addons**, and **Vault Keys**.

From the MCP client, use these three tools:

| Tool | Parameters |
| --- | --- |
| `preview_aiomanager_import` | `backup_path` and optional `nuvio_links`, `nuvio_sessions`, `stremio_accounts`. Returns a summary and `preview_id`. |
| `import_aiomanager` | Same path and mappings plus `preview_id`. If the file or any mapping changes, generate a new preview. |
| `export_aiomanager` | `backup_path` with a new `.json` path. `include_credentials: true` includes Stremio keys and vault entries. |

Paths are resolved on the server machine. The [AIOManager migration reference](src/streampilot/skills/streampilot/references/aiomanager.md) is also served via Skills over MCP.

Backup files may contain passwords, API keys, or private addon URLs—keep them outside your repository. Exports create a private `0600` file and only return the path and summary.

CLI equivalents:

```sh
.venv/bin/streampilot import-aiomanager /private/path/AIOManager-Backup.json
.venv/bin/streampilot import-aiomanager /private/path/AIOManager-Backup.json --apply --preview-id PREVIEW_ID
.venv/bin/streampilot export-aiomanager /private/path/StreamPilot-Backup.json
```

Previews run offline and show aliases and pending items. Applying checks available Stremio session keys, saves compatible vault keys, and registers installed or saved URLs as manifest aliases. Matches are skipped and conflicts are reported without overwriting existing credentials. Importing does not modify remote collections.

All addon URLs in the backup are scanned locally to discover Debrid, TMDB, and other provider keys, storing each unique value once per provider. Shared keys appear under `default_choices`; the skill asks whether to make each key the default for those accounts, a group, or leave it unset. `set_credential_default` persists that local preference and `list_credential_defaults` shows effective defaults (profile overrides account, which overrides group).

For Nuvio you can reuse a profile from an already linked account via `nuvio_links`, or import an official session flagged `session_importable` with e.g. `nuvio_sessions: {"aio-home:1": "family"}` (one source link per new account; the provider may rotate the refresh token). If a Stremio `authKey` is expired, link the account via login or device flow and map the source alias with `stremio_accounts`. Trakt requires its own authorization. AIOManager Autopilot rules, notes, themes, and logs are not imported.

Exports include readable collections, saved URLs, and Nuvio references, and can be imported back into AIOManager from **Settings → Import**. Nuvio sessions and Trakt authorizations are managed separately.

## MCP tools

| Area | Tools |
| --- | --- |
| Account linking | `authorize_account`, `finish_account_authorization`, `login_account` |
| Accounts, profiles & links | `list_accounts`, `list_profiles`, `list_links`, `link_targets`, `unlink_targets` |
| Reusable groups | `list_groups`, `set_group`. Pass `group/<name>` anywhere a target list is accepted, or list targets directly. |
| Addons & Nuvio plugins | `list_addons`, `compare_addons`, `inspect_addon`, `check_addons`, `plan_install_addon`, `plan_edit_addons`, `plan_copy_addons`, `plan_fix_addons`, `save_addon_manifest` |
| Shared group addons | `set_group_addons`, `list_group_addons`, `set_group_options`, `plan_sync_group` |
| Friendly labels | `set_label` assigns a human-readable name to an account or profile, shown in profiles, plans, and reports. |
| Combined plans | `plan_batch` (addons, credentials, watch state, library, and Nuvio configuration in one atomic, restorable plan) |
| Addon templates | `save_manifest_template`; install with `plan_install_addon` (`manifest_alias` + `credential_alias`) |
| Nuvio config & backups | `plan_nuvio_profile`, `get_nuvio_home_catalogs`, `plan_nuvio_home_catalogs`, `get_nuvio_settings`, `plan_nuvio_settings`, `list_nuvio_collections`, `plan_nuvio_collections`, `export_nuvio_backup`, `plan_restore_nuvio_backup` |
| Credentials & Trakt | `list_credentials`, `list_bindings`, `list_credential_providers`, `plan_assign_credential`, `plan_refresh_assignments`, `trakt_activity`, `trakt_native_status` |
| Watch history, search & library | `watch_people`, `watch_sync`, `watch_history`, `watch_stats`, `watch_replay`, `compare_watchers`, `continue_watching`, `show_progress`, `upcoming_episodes`, `watch_sources_status`, `search_title`, `list_library`, `plan_library`, `plan_sync_library`, `plan_mark_watched`, `plan_clear_progress`, `plan_sync_watched`, `watch_exclude`, `watch_include`, `watch_exclusions`, `watch_rebuild` |
| Community advisor & recommendations | `search_community`, `read_community_thread`, `search_guides`, `read_guide`, `similar_titles` |
| Notes & logins | `list_notes`, `read_note`, `save_note`, `delete_note`, `save_login`, `verify_login`. Notes are encrypted Markdown in the vault by subject (`general`, `group/home`, `stremio/account`, `nuvio/account/profile`, `login/alias`) and reject stored passwords/tokens. CLI: `streampilot secret login ALIAS --service S --user U [--host H --port P]`. |
| Apply & rollback | `apply_plan`, `list_changes`, `plan_restore_change`, `list_snapshots`, `plan_restore_snapshot` |

Example: link `stremio/home` with the Nuvio target returned by `list_profiles`, then ask "copy missing addons from Stremio Home to Nuvio and assign `trakt/alice` to both". `merge` adds missing entries, `mirror` matches the source collection, and `order` aligns the order of shared entries. A URL with or without `/manifest.json` counts as the same installation (`match` and `same_order` in `compare_addons`). If a Nuvio profile inherits addons or plugins, target the primary profile to modify that collection.

### Groups with shared addons

`set_group_addons` defines the ordered shared addons kept at the top of every group member. Each addon uses a common source or `per_member` overrides (a linked Nuvio profile uses its Stremio's source). Supported sources: public `url`, `manifest_alias`, `template` + `credential_alias`, or `from_target` + `addon_id` (copies an installed addon's URL without exposing it). `plan_sync_group` orders shared addons, installs missing ones, and keeps personal addons below while preserving Stremio protected addons. It reports possible duplicates and removes them with `remove_duplicates`. With `set_group_options(mirror_links: true)`, each Nuvio profile linked to a group Stremio mirrors that Stremio completely, personal addons included.

### Diagnostics and configuration

- `check_addons` detects `unreachable`, `unconfigured`, `localhost` (`127.0.0.1`), `private_network`, `legacy`, `outdated` (Stremio manifest mismatch), `disabled`, and `duplicate` addons.
- `plan_fix_addons` repairs issues detected by `check_addons`: by default it reinstalls `outdated` manifests; passing `fix` removes chosen codes (`unreachable`, `unconfigured`, `localhost`, `private_network`, `legacy`; `duplicate` requires `addon_ids`), also on the linked profile when `include_linked` is true.
- `inspect_addon` decodes URL options (JSON, base64, or `key=value`) while redacting keys, passwords, and opaque blobs. `compare_addons` uses the same decoder to report `config_differences`.
- `save_manifest_template` stores secret-free templates using `{api_key}`, `{username}`, `{password}`, `{host}`, and `{port}` (append `|url` to URL-encode). With `config`, the URL uses `{config}` encoded as `base64url-json`, `json`, or `pairs`. Rotating a login or key updates installed URLs via `plan_refresh_assignments`.
- `save_login` tests NNTP (Usenet) and Easynews logins before saving (`verify: false` skips verification; `verify_login` rechecks).
- Plans affecting Nuvio's primary profile report inheriting profiles in `also_affects`.
- `plan_edit_addons` accepts IDs, `match`, or exact names, and `include_linked` applies the same change to the linked profile. `plan_install_addon` can copy directly from an installed addon via `from_target` + `addon_id`.
- `plan_install_addon` and `plan_copy_addons` (`merge`) accept `after` (ID or exact name). `plan_copy_addons` accepts `addon_ids` to copy a subset.
- `plan_batch` combines steps (`plan_install_addon`, `plan_edit_addons`, `plan_copy_addons`, `plan_sync_group`, `plan_assign_credential`, `plan_fix_addons`, `plan_mark_watched`, `plan_clear_progress`, `plan_sync_watched`, `plan_library`, `plan_sync_library`, `plan_nuvio_profile`, `plan_nuvio_home_catalogs`, `plan_nuvio_settings`, `plan_nuvio_collections`) into one plan. Each step sees previous steps' results and each target is written once with a single restore point.

Plans expire after one hour. Every execution re-reads the target, commits an encrypted pre-write snapshot, writes, and verifies the result. Partial failures can be retried while the plan is active. If a target changed since preview, generate a new plan.

### Watch history and statistics

A **person** groups linked Stremio and Nuvio targets (`link_targets`) plus any assigned Trakt account. The name comes from `set_label`, stripping a trailing parenthetical (`"Alice (Nuvio · Living Room)"` → `"Alice"`). Inspect groupings with `watch_people`.

Neither Stremio nor Nuvio keeps a full watch log, so StreamPilot maintains a local `watch.sqlite3` database alongside the vault with `0600` permissions (no secrets, only watch events). Queries auto-sync if 15 minutes have elapsed, or you can run `watch_sync` manually. To capture exact Stremio playback sessions continuously, schedule `streampilot watch sync --if-older 10` (systemd or cron).

- **Stremio**: reads `libraryItem` via `datastoreGet` and decodes the watched bitfield using Cinemeta (or installed metadata addons for non-IMDb IDs). The initial dump is recorded as undated backfill; subsequent syncs diff against previous snapshots to record actual minutes watched.
- **Nuvio**: reads watched items and progress per profile. `tmdb:` IDs are mapped to IMDb using progress entries or a vault TMDB key. Bulk marks (3+ items within 2 minutes or a whole show marked at once) count toward progress without inflating watch hours.
- **Trakt**: full incremental history with runtimes and genres when a Trakt account is assigned via `plan_assign_credential`. `trakt_activity` also reads `stats`, `watched_*`, `playback`, `ratings`, and `collection_*`.

The same episode watched on the same day across multiple sources counts once. Missing durations are estimated from runtime or playback position, and `estimated_share` reports what fraction is estimated.

| Tool | Description |
| --- | --- |
| `watch_history` | Filterable timeline (`period`: `7d`, `30d`, `month`, `year`, `2026`, `2026-11`, `all`; `since`/`until`; kind; title). `include_undated` includes undated backfill marks. |
| `watch_stats` | Hours, sessions, titles, episodes, top lists, genres, peak hours/days, streaks, binges, completion funnel (started ≥0%, hooked ≥50%, finished ≥90%), returns after 14+ days, paused series, and previous-period comparison. Without a person, adds `by_person`. |
| `watch_replay` | Year-in-review summary: tops, genres, busiest months, discoveries, streaks, viewer persona, milestones, and year-over-year comparison. |
| `compare_watchers` | Per-person totals, shared titles, and who is ahead in each show. |
| `continue_watching` | Live in-progress items from Stremio and Nuvio plus `next_up` episodes for shows watched in the last 60 days. |
| `show_progress` | Per-show breakdown: watched per season, next episode, upcoming air date, and cross-platform differences. |
| `upcoming_episodes` | Recently aired unwatched episodes and upcoming releases (`days`, `recent_days`) for recently watched or library series, plus returning shows. |
| `search_title` | Searches movies, series, and anime across Cinemeta, TMDB (using a vault TMDB key; language configurable via `STREAMPILOT_LANGUAGE`, default `en-US`, or `language` parameter), Kitsu, Trakt, and Stremio catalog addons (`target`), showing `seen_by`. Also used automatically when marking or managing unwatched titles by name. |
| `list_library` | Unified library / watchlist across Stremio, Nuvio, and Trakt (when linked). |
| `watch_sources_status` | Last sync and event counts per source, native Trakt status, and Stremio vs Nuvio watched differences. |
| `watch_exclusions` | Lists active local exclusions (titles or episodes omitted from history, stats, comparisons, continue watching, and upcoming episodes). |

Remote writes use reviewable plans with pre-write snapshots and verification:

- `plan_mark_watched` marks or unmarks (`watched: false`) a movie, episodes (`2:5`, `2x5`, `S02E05`, `2:1-4`), seasons (`2`), or all aired episodes. Trakt is only modified if included in `sources`.
- `plan_clear_progress` removes an item from Continue Watching (resets Stremio `timeOffset`, deletes Nuvio progress, and optionally removes Trakt playback).
- `plan_sync_watched` copies completed episodes/movies to the person's platforms where they are missing (only copies explicit marks, never unmarks).
- `plan_library` adds or removes a title from Stremio and Nuvio libraries, and Trakt watchlist when `trakt` is in `sources`.
- `plan_sync_library` syncs missing library / watchlist items across a person's platforms without deleting anything.

### Nuvio profiles, settings, collections, and native backups

All Nuvio writes go through the same plan/backup/verification/rollback flow (`list_changes` / `plan_restore_change`):

- `plan_nuvio_profile` edits a profile's name, `#RRGGBB` color, avatar, or inheritance (`uses_primary_addons`, `uses_primary_plugins`).
- `get_nuvio_home_catalogs` and `plan_nuvio_home_catalogs` inspect, edit, or copy (`copy_from`) home screen catalog rows (`tv` or `mobile`).
- `get_nuvio_settings` and `plan_nuvio_settings` inspect (redacting URLs and keys) and edit or copy (`copy_from`, `sections`, `changes`, `mode: "merge" | "mirror"`) profile settings (`player_settings`, `theme_settings`, `layout_settings`, etc.).
- `list_nuvio_collections` and `plan_nuvio_collections` inspect, copy (`replace` or `merge`), or set custom collections.
- `export_nuvio_backup` (or `streampilot export-nuvio nuvio/account file.json`) writes Nuvio's official full account backup to a `0600` file, returning only counts; `plan_restore_nuvio_backup` previews and restores it after capturing a full live pre-restore snapshot for rollback.

Local maintenance and corrections (do not touch Stremio, Nuvio, or Trakt):

- `watch_exclude` and `watch_include` exclude or restore a title (or specific episodes) for one person or `*` across history, stats, comparisons, continue watching, and upcoming episodes.
- `watch_rebuild` clears and rebuilds `watch.sqlite3` by re-syncing sources. By default (`keep_real_plays: true`) it preserves accumulated real Stremio play minutes without duplicating them; `keep_real_plays: false` deletes them permanently. `refresh_metadata: true` also clears the metadata cache.

CLI commands: `streampilot watch sync [--person P] [--if-older MIN]`, `streampilot watch status`, `streampilot watch stats --person P --period 90d`, `streampilot watch upcoming`, `streampilot watch library`, `streampilot watch search "title"`, `streampilot watch rebuild [--drop-real-plays] [--refresh-metadata]`, and `streampilot watch timer [--interval 10] [--install]` (prints or writes `systemd --user` units to `~/.config/systemd/user/` without activating them until you run `systemctl --user enable --now streampilot-watch-sync.timer`).

### Change history and rollback

StreamPilot stores an encrypted pre-write snapshot before every local or remote configuration change and retains **the last five changes** by default (configure `STREAMPILOT_HISTORY_LIMIT` with a positive integer to adjust retention). A multi-target plan counts as one change with one snapshot per affected target. Reads, previews, and token refreshes never create history entries.

Use `list_changes` and `plan_restore_change` to preview rolling back to before a change. `apply_plan` restores affected remote targets and local state while recording its own pre-restore snapshot. Partial failures can be retried. Earlier snapshots within retention are also accessible via `list_snapshots` and `plan_restore_snapshot`.

### Community advisor & recommendations

StreamPilot includes read-only tools and a dedicated Agent Skill (`streampilot-advisor`) for both Stremio/Nuvio setup advice and personalized viewing recommendations:

- `search_community` and `read_community_thread` search archived Reddit communities and fetch top-voted comments (`topic: "setup"` covers `r/StremioAddons`, `r/Stremio`, `r/Nuvio`, `r/RealDebrid`, `r/TorBoxApp`, `r/Easynews`; `topic: "media"` covers `r/MovieSuggestions`, `r/televisionsuggestions`, `r/Animesuggest`, `r/ifyoulikeblank`; custom `subreddits` are also supported).
- `search_guides` and `read_guide` index and read curated Stremio/Nuvio guides (`guides.viren070.me` plus official `AIOStreams`, `NuvioTV`, `NuvioTVSmart`, and `AIOManager` documentation) strictly from an allowlisted set of trusted hosts.
- `similar_titles` queries TMDB recommendations and similar titles for a seed movie or show, filtering out titles a person has already watched or saved in their library.

## Skills and compatibility

StreamPilot ships two Agent Skills served via [Skills over MCP](https://modelcontextprotocol.io/extensions/skills/overview) (revision `2026-07-28`), and you can also install either folder locally:

- [`streampilot`](src/streampilot/skills/streampilot/SKILL.md) — core account, addon, credential, watch history, library, Nuvio config, and AIOManager migration workflows.
- [`streampilot-advisor`](src/streampilot/skills/streampilot-advisor/SKILL.md) — community Reddit & curated guide advisor for Stremio/Nuvio setup recommendations and personalized movie/TV/anime picks.

All standard tools work with any MCP client. Stremio subprofile support and available Nuvio RPCs depend on the account and instance.

## License

[MIT](LICENSE)

TDQS

C2.9/5.0

Scored across 84 tools

Disambiguation3/5

Most tools have distinct resource/action pairs, but the large family of plan_* previews versus apply_plan, plus overlapping sync/copy/install/restore workflows, creates fuzzy boundaries. Descriptions help, but an agent still has to carefully choose among many similarly named operations.

Naming Consistency4/5

Snake_case is used consistently and most names follow a verb_noun pattern. A few noun-phrase tools such as watch_sources_status, continue_watching, and upcoming_episodes are minor deviations rather than a break in convention.

Tool Count1/5

84 tools is far beyond a well-scoped set; even for a broad Stremio/Nuvio/Trakt management domain, the plan/apply split and many specialized views make the surface sprawling. This is an extreme count mismatch.

Completeness5/5

Coverage is extensive across accounts, addons, credentials, groups, libraries, watch analytics, Nuvio settings, backups, change history, and guides/community resources. No obvious lifecycle gap exists for the stated domain, though some writes require the plan-then-apply workflow.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues