Skip to content

Subtitle search & MCP (opt-in)

The addons/transcript-mcp/ add-on turns archived .vtt and .srt subtitles (plus optional local Whisper or Apple Silicon MLX transcriptions) into a full-text searchable SQLite FTS5 index (metadata/transcripts.db) and exposes a read-only stdio MCP server (cvn-transcript mcp) with timestamped citations.

Design principle: 100% opt-in

  • Lean core NAS images. Core channel-vault-nas-api and channel-vault-nas-web images in compose.release.yml and docker-compose.yml stay untouched and carry zero ML or transcription dependencies.
  • Zero writes to metadata/app.db. All subtitle cues, merged segments, and FTS5 tables live in a dedicated, rebuildable metadata/transcripts.db file. There is no SQLite write-lock contention with the API, no Alembic schema coupling, and no bloat in app.db startup backups.
  • Disk-first and non-destructive. downfolder/ is scanned read-only by default (--write-sidecar none). If transcripts.db is ever deleted, rebuild it from disk.

Architecture

flowchart LR
  DF["downfolder/ (read-only by default)"] --> IDX["cvn-transcript index"]
  APP["metadata/app.db (optional, read-only)"] -. metadata enrichment .-> IDX
  IDX --> TDB["metadata/transcripts.db (SQLite FTS5)"]
  TDB -- "read-only (?mode=ro)" --> MCP["cvn-transcript mcp (stdio, no network)"]
  MCP --> CLIENTS["Claude Desktop / Copilot CLI / Cursor"]

How the pipeline handles your archive:

  • Disk-first scanner. Walks the standard filesystem layout (channels/<handle_or_title> [<cid>]/<year>/<date> - <title> [<vid>]/), skips .channel-vault-quarantine and .incomplete, and blocks symlinks that resolve outside the archive root.
  • Optional read-only metadata enrichment. Pass --app-db (or CVN_APP_DB_PATH) to enrich channel and video titles from metadata/app.db using SQLite read-only mode (file:app.db?mode=ro and PRAGMA query_only=ON).
  • Pure-stdlib WebVTT/SRT parser. Deduplicates YouTube rolling auto-captions, decodes HTML entities, merges cues into ~30-second / ~450-character searchable segments, prioritizes tracks by source_kind as manual > unknown > generated_stt > auto (search_transcripts also accepts convenience filter aliases all, sidecar [= manual/auto/unknown], and transcribed [= generated_stt]), and incrementally skips unchanged files via (mtime_ns, size, sha256).
  • Safe sidecar write policy. --write-sidecar none is the default so downfolder/ stays read-only. If you explicitly pass --write-sidecar vtt or --write-sidecar srt, generated transcripts are written atomically and never overwrite existing yt-dlp subtitle files. To keep downfolder/ mounted read-only while saving generated sidecars, pass --generated-subtitles-dir <path> (or set CVN_GENERATED_SUBTITLES_DIR, which compose.transcript-mcp.yml forwards so sidecars can be written under /app/metadata/... while /app/downfolder stays :ro).
  • Safe FTS5 & CJK search. User queries are safely tokenized and escaped before reaching FTS5 (preventing FTS5 syntax injection), Hangul/CJK tokens automatically enable prefix matching, and substring_fallback (INSTR) runs automatically only when a Hangul/CJK query returns zero FTS5 hits (not for arbitrary Latin zero-hit queries).

Quick Start 1: Sidecar-only indexing (zero third-party Python dependencies)

If your archive already contains .vtt or .srt files downloaded by yt-dlp, you need no ML packages and no GPU.

pip install ./addons/transcript-mcp
cvn-transcript index \
  --download-dir ./downfolder \
  --db ./metadata/transcripts.db

# Test a local query right away
cvn-transcript search "archive.txt" --db ./metadata/transcripts.db

Uses the opt-in compose.transcript-mcp.yml overlay alongside compose.release.yml (or docker-compose.yml). Core services do not change and only start the overlay service when you select its profile:

docker compose -f compose.release.yml -f compose.transcript-mcp.yml \
  --profile transcript-index run --rm transcript-indexer

The indexer mounts CVN_DOWNLOAD_HOST_DIR read-only, runs offline by default (CVN_TRANSCRIPT_INDEXER_NETWORK_MODE=none), uses CVN_TRANSCRIPT_JOURNAL_MODE=delete, and writes only to ${CVN_METADATA_HOST_DIR:-./metadata}/transcripts.db.

Quick Start 2: Apple Silicon macOS native MLX transcription

Docker containers on macOS cannot access Apple Metal GPU acceleration. For fast local transcription on Apple Silicon Macs, install the [mlx] extra natively on macOS and point --download-dir (or CVN_DOWNLOAD_DIR) at your mounted NAS archive:

pip install "./addons/transcript-mcp[mlx]"

cvn-transcript index \
  --download-dir /Volumes/nas/channel-vault/downfolder \
  --db ~/Library/Caches/channel-vault-nas/transcripts.db \
  --transcribe mlx-whisper \
  --model mlx-community/whisper-large-v3-turbo

To also save generated .vtt files outside the NAS share (keeping your SMB/NFS mount read-only):

cvn-transcript index \
  --download-dir /Volumes/nas/channel-vault/downfolder \
  --db ~/Library/Caches/channel-vault-nas/transcripts.db \
  --transcribe mlx-whisper \
  --model mlx-community/whisper-large-v3-turbo \
  --write-sidecar vtt \
  --generated-subtitles-dir ~/Library/Caches/channel-vault-nas/subtitles

Store transcripts.db on local SSD when scanning an SMB/NFS NAS mount

When downfolder/ is mounted on macOS over SMB or NFS, keep --db on your Mac's local SSD (for example ~/Library/Caches/channel-vault-nas/transcripts.db), not on the network share. SQLite WAL journaling and advisory file locks over SMB/NFS can stall or corrupt the database. If another machine needs a copy of the finished index, copy a quiescent transcripts.db snapshot back to the NAS only after the indexing run finishes cleanly (or build with CVN_TRANSCRIPT_JOURNAL_MODE=delete when producing a single-file copy).

Quick Start 3: Linux NAS CPU/CUDA (faster-whisper) or whisper-cli

On a Linux NAS or home server, build the optional faster-whisper target of addons/transcript-mcp/Dockerfile, install the [faster-whisper] Python extra, or invoke an already-installed whisper-cli binary.

CVN_TRANSCRIPT_IMAGE_TARGET=faster-whisper \
  docker compose -f compose.release.yml -f compose.transcript-mcp.yml \
  --profile transcript-index build transcript-indexer

# Enable bridge networking only for the first run that downloads the model
CVN_TRANSCRIPT_IMAGE_TARGET=faster-whisper \
  CVN_TRANSCRIPT_INDEXER_NETWORK_MODE=bridge \
  docker compose -f compose.release.yml -f compose.transcript-mcp.yml \
  --profile transcript-index run --rm transcript-indexer \
  --transcribe faster-whisper --model small

faster-whisper defaults to CPU int8 (CVN_TRANSCRIBE_DEVICE=cpu, CVN_TRANSCRIBE_COMPUTE_TYPE=int8, matching --device and --compute-type). Use smaller models (tiny, base, small) on CPU-only NAS hosts; when passing through an NVIDIA CUDA GPU, set CVN_TRANSCRIBE_DEVICE=cuda (or auto) and CVN_TRANSCRIBE_COMPUTE_TYPE=float16 (for example with medium or large-v3-turbo). To also emit generated .vtt/.srt files while keeping /app/downfolder mounted :ro, set CVN_GENERATED_SUBTITLES_DIR=/app/metadata/generated-subtitles alongside --write-sidecar vtt (or srt).

pip install "./addons/transcript-mcp[faster-whisper]"

cvn-transcript index \
  --download-dir ./downfolder \
  --db ./metadata/transcripts.db \
  --transcribe faster-whisper \
  --model small \
  --device cpu \
  --compute-type int8

For NVIDIA CUDA hosts, pass --device cuda (or auto) and --compute-type float16 (or set CVN_TRANSCRIBE_DEVICE and CVN_TRANSCRIBE_COMPUTE_TYPE).

If whisper, whisper-cli, or whisper-cpp is already installed on your host, run it without installing any Python ML libraries (invoked safely with shell=False and a bounded timeout; select flavor with CVN_WHISPER_CLI_FLAVOR=openai-whisper|whisper-cpp):

cvn-transcript index \
  --download-dir ./downfolder \
  --db ./metadata/transcripts.db \
  --transcribe whisper-cli \
  --model small

Docker Compose defaults & Linux/NAS operations

compose.transcript-mcp.yml ships with conservative defaults tuned for Linux/NAS deployments where transcript-indexer writes to ./metadata and the hardened transcript-mcp container mounts ./metadata read-only (:ro):

  • Safe :ro SQLite reads (CVN_TRANSCRIPT_JOURNAL_MODE=delete, CVN_TRANSCRIPT_DB_IMMUTABLE=false). Compose defaults CVN_TRANSCRIPT_JOURNAL_MODE to delete so the read-only :ro transcript-mcp container reads freshly committed indexes safely without SQLite WAL/SHM sidecar conflicts, and defaults CVN_TRANSCRIPT_DB_IMMUTABLE to false so updated indexes remain visible across runs. Set CVN_TRANSCRIPT_DB_IMMUTABLE=true only for static snapshots that will not be modified while open.
  • Linux/NAS file ownership (CVN_TRANSCRIPT_USER & CVN_TRANSCRIPT_MCP_USER). transcript-indexer defaults to CVN_TRANSCRIPT_USER=0:0 to match the core api container's ./metadata ownership on Linux/NAS hosts. When ./metadata is owned by a non-root NAS user, override it with CVN_TRANSCRIPT_USER="$(id -u):$(id -g)". The read-only transcript-mcp service always stays non-root (10001:10001 via CVN_TRANSCRIPT_MCP_USER).
  • Offline-first indexer networking (CVN_TRANSCRIPT_INDEXER_NETWORK_MODE). Defaults to none so sidecar-only indexing runs with no network access. Set CVN_TRANSCRIPT_INDEXER_NETWORK_MODE=bridge only when downloading faster-whisper models for the first time.
  • Writable sidecar output under :ro media (CVN_GENERATED_SUBTITLES_DIR). compose.transcript-mcp.yml forwards CVN_GENERATED_SUBTITLES_DIR into transcript-indexer so --write-sidecar vtt|srt writes generated subtitles to a writable folder under /app/metadata/... while /app/downfolder stays mounted :ro.
  • CPU/GPU selection for faster-whisper (CVN_TRANSCRIBE_DEVICE & CVN_TRANSCRIBE_COMPUTE_TYPE). Defaults to CVN_TRANSCRIBE_DEVICE=cpu (--device) and CVN_TRANSCRIBE_COMPUTE_TYPE=int8 (--compute-type). Set cuda or auto for NVIDIA GPUs and e.g. float16 on CUDA.

Connecting AI clients to the read-only stdio MCP server

cvn-transcript mcp implements JSON-RPC 2.0 over stdin/stdout with zero third-party runtime dependencies. You can launch it either directly via the local CLI or through the hardened Docker Compose overlay (-T disables TTY allocation so stdout carries clean JSON-RPC frames):

# Local CLI
cvn-transcript mcp --db /path/to/metadata/transcripts.db

# Docker Compose overlay (read-only container, no network, metadata-only mount)
docker compose -f compose.release.yml -f compose.transcript-mcp.yml \
  --profile transcript-mcp run --rm -T transcript-mcp

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "channel-vault-transcripts": {
      "command": "cvn-transcript",
      "args": ["mcp", "--db", "/absolute/path/to/metadata/transcripts.db"]
    }
  }
}

Or launch via Docker Compose from your Channel Vault directory:

{
  "mcpServers": {
    "channel-vault-transcripts": {
      "command": "docker",
      "args": [
        "compose",
        "-f", "/absolute/path/to/compose.release.yml",
        "-f", "/absolute/path/to/compose.transcript-mcp.yml",
        "--profile", "transcript-mcp",
        "run", "--rm", "-T", "transcript-mcp"
      ]
    }
  }
}

Add to ~/.copilot/mcp-config.json:

{
  "mcpServers": {
    "channel-vault-transcripts": {
      "type": "local",
      "command": "cvn-transcript",
      "args": ["mcp", "--db", "/absolute/path/to/metadata/transcripts.db"],
      "tools": ["*"]
    }
  }
}

Add to .cursor/mcp.json (workspace) or ~/.cursor/mcp.json (global):

{
  "mcpServers": {
    "channel-vault-transcripts": {
      "command": "cvn-transcript",
      "args": ["mcp", "--db", "/absolute/path/to/metadata/transcripts.db"]
    }
  }
}

Read-only MCP tools

Every tool is annotated read-only (readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false) and returns bounded payloads with timestamped YouTube citations (https://www.youtube.com/watch?v=<video_id>&t=<seconds>s).

Tool Purpose Key capabilities
search_transcripts Full-text search across indexed subtitle segments Filter by channel_id, video_id, language, source_kind (canonical manual, auto, generated_stt, unknown, plus convenience aliases all, sidecar [= manual/auto/unknown], and transcribed [= generated_stt]), date_from, date_to, limit, and offset; returns ranked snippets, timestamps, and citation URLs; runs substring_fallback (INSTR) automatically when a Hangul/CJK query returns zero FTS5 hits (not arbitrary Latin zero-hit queries)
get_video_transcript Read transcript segments for a specific video Paginated via cursor_seq with bounded max_chars output and per-segment timestamps
list_indexed_channels List archived channels present in transcripts.db Optional query, limit, and offset; returns channel identifiers, titles, and per-channel video_count, videos_with_transcript, and track_count
list_indexed_videos List indexed videos and available subtitle tracks Supports channel_id, title_query, language, has_transcript, date_from, date_to, limit, and offset filters; returns upload date, track languages, and per-track metadata including segment counts
get_index_status Report index health and coverage summary Shows schema version, last index run summary, totals, and track breakdown without exposing host absolute paths

Security guardrails

  • No network port. The MCP server speaks stdio JSON-RPC 2.0 only. In Docker, the transcript-mcp service runs as non-root 10001:10001 (CVN_TRANSCRIPT_MCP_USER) with network_mode: none and read_only: true, and transcript-indexer also defaults to network_mode: none (CVN_TRANSCRIPT_INDEXER_NETWORK_MODE=none) unless bridge is explicitly enabled for initial model download.
  • No downfolder/ or app.db access from MCP. The MCP server opens only transcripts.db in SQLite read-only mode (?mode=ro, PRAGMA query_only=ON). In Docker, transcript-mcp mounts only the metadata directory read-only and cannot see media files, arbitrary host paths, or subprocesses.
  • No host path leaks. get_index_status and tool outputs omit absolute host filesystem paths.
  • Bounded outputs and citations. Search result limits, snippet lengths, and get_video_transcript page sizes (max_chars + cursor_seq) are capped so a single query cannot flood an AI client's context window, and every hit includes a timestamped citation link.
  • Clean protocol stream. stdout carries JSON-RPC frames exclusively; diagnostics and errors go to stderr.

CLI commands

Command Purpose
cvn-transcript index Scan downfolder/, parse .vtt/.srt sidecars, optionally run local transcription, and update transcripts.db incrementally
cvn-transcript search <query> Run a local FTS5/substring search directly from the terminal with timestamped results
cvn-transcript mcp Start the read-only stdio JSON-RPC 2.0 MCP server against transcripts.db
cvn-transcript status Print indexed channel, video, track, and segment counts plus the latest run summary
cvn-transcript doctor Verify Python version, SQLite FTS5 support, optional transcriber availability (mlx-whisper, faster-whisper, whisper-cli, ffmpeg), and path access

Common environment variables:

  • CVN_DOWNLOAD_DIR: archive root to scan (default ./downfolder; /app/downfolder in Compose)
  • CVN_METADATA_DIR: metadata directory holding transcripts.db (default ./metadata; /app/metadata in Compose)
  • CVN_TRANSCRIPT_DB_PATH: explicit path override for transcripts.db
  • CVN_APP_DB_PATH: optional path to metadata/app.db for read-only metadata enrichment (set to "" to disable)
  • CVN_GENERATED_SUBTITLES_DIR: optional separate output folder for generated .vtt/.srt sidecars (forwarded by compose.transcript-mcp.yml so --write-sidecar vtt|srt writes to a writable folder under /app/metadata/... while /app/downfolder stays :ro)
  • CVN_TRANSCRIBE_BACKEND: transcription backend (none default, mlx-whisper, faster-whisper, whisper-cli)
  • CVN_TRANSCRIBE_MODEL: model name or local model path for the selected transcriber
  • CVN_TRANSCRIBE_DEVICE: faster-whisper device (--device, default cpu; set cuda or auto for NVIDIA GPU)
  • CVN_TRANSCRIBE_COMPUTE_TYPE: faster-whisper compute type (--compute-type, default int8; e.g., float16 on CUDA)
  • CVN_TRANSCRIPT_WRITE_SIDECAR: sidecar output policy (none default, vtt, srt)
  • CVN_TRANSCRIPT_JOURNAL_MODE: SQLite journal mode (wal default in standalone CLI; delete default in compose.transcript-mcp.yml so the read-only :ro transcript-mcp container reads committed indexes safely without WAL/SHM conflicts)
  • CVN_TRANSCRIPT_DB_IMMUTABLE: open transcripts.db with SQLite immutable=1 (false default in CLI and compose.transcript-mcp.yml; set true only for static snapshots)
  • CVN_TRANSCRIPT_USER: UID:GID for transcript-indexer in compose.transcript-mcp.yml (default 0:0 to match the core api container's ./metadata ownership on Linux/NAS; override with CVN_TRANSCRIPT_USER="$(id -u):$(id -g)" when ./metadata is owned by a non-root NAS user)
  • CVN_TRANSCRIPT_MCP_USER: UID:GID for transcript-mcp in compose.transcript-mcp.yml (default non-root 10001:10001)
  • CVN_TRANSCRIPT_INDEXER_NETWORK_MODE: network mode for transcript-indexer in compose.transcript-mcp.yml (default none for offline sidecar indexing; set bridge only when downloading faster-whisper models for the first time)
  • CVN_WHISPER_CLI_FLAVOR: external CLI flavor (openai-whisper default, or whisper-cpp)
  • CVN_TRANSCRIPT_IMAGE_TARGET: Docker build target in compose.transcript-mcp.yml (sidecar default, or faster-whisper)

Looking for built-in HTTP MCP collections and instant phrase search over ad-hoc single-URL downloads instead? See the sibling comparison in Is Channel Vault NAS for me?.