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-apiandchannel-vault-nas-webimages incompose.release.ymlanddocker-compose.ymlstay 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, rebuildablemetadata/transcripts.dbfile. There is no SQLite write-lock contention with the API, no Alembic schema coupling, and no bloat inapp.dbstartup backups. - Disk-first and non-destructive.
downfolder/is scanned read-only by default (--write-sidecar none). Iftranscripts.dbis 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-quarantineand.incomplete, and blocks symlinks that resolve outside the archive root. - Optional read-only metadata enrichment. Pass
--app-db(orCVN_APP_DB_PATH) to enrich channel and video titles frommetadata/app.dbusing SQLite read-only mode (file:app.db?mode=roandPRAGMA 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_kindasmanual > unknown > generated_stt > auto(search_transcriptsalso accepts convenience filter aliasesall,sidecar[=manual/auto/unknown], andtranscribed[=generated_stt]), and incrementally skips unchanged files via(mtime_ns, size, sha256). - Safe sidecar write policy.
--write-sidecar noneis the default sodownfolder/stays read-only. If you explicitly pass--write-sidecar vttor--write-sidecar srt, generated transcripts are written atomically and never overwrite existingyt-dlpsubtitle files. To keepdownfolder/mounted read-only while saving generated sidecars, pass--generated-subtitles-dir <path>(or setCVN_GENERATED_SUBTITLES_DIR, whichcompose.transcript-mcp.ymlforwards so sidecars can be written under/app/metadata/...while/app/downfolderstays: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.
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):
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
:roSQLite reads (CVN_TRANSCRIPT_JOURNAL_MODE=delete,CVN_TRANSCRIPT_DB_IMMUTABLE=false). Compose defaultsCVN_TRANSCRIPT_JOURNAL_MODEtodeleteso the read-only:rotranscript-mcpcontainer reads freshly committed indexes safely without SQLite WAL/SHM sidecar conflicts, and defaultsCVN_TRANSCRIPT_DB_IMMUTABLEtofalseso updated indexes remain visible across runs. SetCVN_TRANSCRIPT_DB_IMMUTABLE=trueonly for static snapshots that will not be modified while open. - Linux/NAS file ownership (
CVN_TRANSCRIPT_USER&CVN_TRANSCRIPT_MCP_USER).transcript-indexerdefaults toCVN_TRANSCRIPT_USER=0:0to match the coreapicontainer's./metadataownership on Linux/NAS hosts. When./metadatais owned by a non-root NAS user, override it withCVN_TRANSCRIPT_USER="$(id -u):$(id -g)". The read-onlytranscript-mcpservice always stays non-root (10001:10001viaCVN_TRANSCRIPT_MCP_USER). - Offline-first indexer networking (
CVN_TRANSCRIPT_INDEXER_NETWORK_MODE). Defaults tononeso sidecar-only indexing runs with no network access. SetCVN_TRANSCRIPT_INDEXER_NETWORK_MODE=bridgeonly when downloadingfaster-whispermodels for the first time. - Writable sidecar output under
:romedia (CVN_GENERATED_SUBTITLES_DIR).compose.transcript-mcp.ymlforwardsCVN_GENERATED_SUBTITLES_DIRintotranscript-indexerso--write-sidecar vtt|srtwrites generated subtitles to a writable folder under/app/metadata/...while/app/downfolderstays mounted:ro. - CPU/GPU selection for
faster-whisper(CVN_TRANSCRIBE_DEVICE&CVN_TRANSCRIBE_COMPUTE_TYPE). Defaults toCVN_TRANSCRIBE_DEVICE=cpu(--device) andCVN_TRANSCRIBE_COMPUTE_TYPE=int8(--compute-type). Setcudaorautofor NVIDIA GPUs and e.g.float16on 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
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-mcpservice runs as non-root10001:10001(CVN_TRANSCRIPT_MCP_USER) withnetwork_mode: noneandread_only: true, andtranscript-indexeralso defaults tonetwork_mode: none(CVN_TRANSCRIPT_INDEXER_NETWORK_MODE=none) unlessbridgeis explicitly enabled for initial model download. - No
downfolder/orapp.dbaccess from MCP. The MCP server opens onlytranscripts.dbin SQLite read-only mode (?mode=ro,PRAGMA query_only=ON). In Docker,transcript-mcpmounts only the metadata directory read-only and cannot see media files, arbitrary host paths, or subprocesses. - No host path leaks.
get_index_statusand tool outputs omit absolute host filesystem paths. - Bounded outputs and citations. Search result limits, snippet lengths, and
get_video_transcriptpage 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.
stdoutcarries JSON-RPC frames exclusively; diagnostics and errors go tostderr.
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/downfolderin Compose)CVN_METADATA_DIR: metadata directory holdingtranscripts.db(default./metadata;/app/metadatain Compose)CVN_TRANSCRIPT_DB_PATH: explicit path override fortranscripts.dbCVN_APP_DB_PATH: optional path tometadata/app.dbfor read-only metadata enrichment (set to""to disable)CVN_GENERATED_SUBTITLES_DIR: optional separate output folder for generated.vtt/.srtsidecars (forwarded bycompose.transcript-mcp.ymlso--write-sidecar vtt|srtwrites to a writable folder under/app/metadata/...while/app/downfolderstays:ro)CVN_TRANSCRIBE_BACKEND: transcription backend (nonedefault,mlx-whisper,faster-whisper,whisper-cli)CVN_TRANSCRIBE_MODEL: model name or local model path for the selected transcriberCVN_TRANSCRIBE_DEVICE:faster-whisperdevice (--device, defaultcpu; setcudaorautofor NVIDIA GPU)CVN_TRANSCRIBE_COMPUTE_TYPE:faster-whispercompute type (--compute-type, defaultint8; e.g.,float16on CUDA)CVN_TRANSCRIPT_WRITE_SIDECAR: sidecar output policy (nonedefault,vtt,srt)CVN_TRANSCRIPT_JOURNAL_MODE: SQLite journal mode (waldefault in standalone CLI;deletedefault incompose.transcript-mcp.ymlso the read-only:rotranscript-mcpcontainer reads committed indexes safely without WAL/SHM conflicts)CVN_TRANSCRIPT_DB_IMMUTABLE: opentranscripts.dbwith SQLiteimmutable=1(falsedefault in CLI andcompose.transcript-mcp.yml; settrueonly for static snapshots)CVN_TRANSCRIPT_USER: UID:GID fortranscript-indexerincompose.transcript-mcp.yml(default0:0to match the coreapicontainer's./metadataownership on Linux/NAS; override withCVN_TRANSCRIPT_USER="$(id -u):$(id -g)"when./metadatais owned by a non-root NAS user)CVN_TRANSCRIPT_MCP_USER: UID:GID fortranscript-mcpincompose.transcript-mcp.yml(default non-root10001:10001)CVN_TRANSCRIPT_INDEXER_NETWORK_MODE: network mode fortranscript-indexerincompose.transcript-mcp.yml(defaultnonefor offline sidecar indexing; setbridgeonly when downloadingfaster-whispermodels for the first time)CVN_WHISPER_CLI_FLAVOR: external CLI flavor (openai-whisperdefault, orwhisper-cpp)CVN_TRANSCRIPT_IMAGE_TARGET: Docker build target incompose.transcript-mcp.yml(sidecardefault, orfaster-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?.