Skip to main content
Glama
README.md
# TubeKiroku

**A self-hosted MCP server for YouTube transcripts.** Connect it to Claude, ChatGPT or any other
[Model Context Protocol](https://modelcontextprotocol.io) client, then ask for a video's transcript,
read it page by page, and cite the exact moment behind an answer.

> *Kiroku* (記録) is Japanese for "record".

```
You:       What command does this tutorial use to deploy? https://youtu.be/...
Assistant: (calls get_transcript) At 12:34 the presenter runs `docker stack deploy ...`
           ▶ https://www.youtube.com/watch?v=...&t=754s
```

## Why

Pasting a YouTube link into an assistant identifies the video, but the assistant still needs the
spoken words to answer questions about what was actually said. TubeKiroku fetches the captions,
keeps them in a local library, and returns them with timestamps so every claim can be checked.

- **Full text, not a summary.** Transcripts are returned verbatim, in pages, with an explicit
  continuation cursor. Summarizing is the assistant's job, and it can tell when it has not read everything.
- **Citations that hold.** Every segment has a jump link. Transcript versions are immutable, so a
  citation still points to the same words after the captions change.
- **Honest failures.** No captions, wrong language, blocked network: each is a distinct error code.
  An empty or failed fetch is never presented as a complete transcript.
- **Runs on your machine.** Transcripts are fetched from your own connection and stored in a local
  SQLite file. No account, no hosted service, no telemetry.

## Status

Early development. Working today: single videos and channel imports. In progress:

- [x] Single videos: metadata, caption languages, paginated transcripts, timed passages
- [x] Channel imports as resumable background jobs
- [ ] Full-text search across your library with timestamped results
- [ ] Export (TXT / Markdown / ZIP), file import (SRT / VTT / TXT), deletion
- [ ] Docker image with HTTP transport, local setup page, and a tunnel profile for ChatGPT
- [ ] PyPI release and MCP Registry listing

## Install

Requires [uv](https://docs.astral.sh/uv/). TubeKiroku is not on PyPI yet, so run it from GitHub.

**Claude Code**

```bash
claude mcp add tubekiroku -- uvx --from git+https://github.com/chethankailash/tubekiroku tubekiroku
```

**Claude Desktop, Cursor, VS Code and other stdio clients**: add to the client's MCP config
(for Claude Desktop, `claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "tubekiroku": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/chethankailash/tubekiroku", "tubekiroku"]
    }
  }
}
```

**Streamable HTTP** (for clients that connect by URL):

```bash
uvx --from git+https://github.com/chethankailash/tubekiroku tubekiroku --transport http --port 8000
# MCP endpoint: http://127.0.0.1:8000/mcp
```

ChatGPT and claude.ai on the web reach MCP servers from their own cloud, so they cannot see
`localhost`. A Docker setup with a protected tunnel is planned for them.

## Tools

| Tool | What it does |
| --- | --- |
| `get_video_info` | Resolve any YouTube link to its ID, title, channel and saved transcript versions. |
| `list_languages` | List caption tracks: language, origin (creator or automatic), saved or not. |
| `get_transcript` | The full transcript, one page at a time, as timestamped paragraphs or timed segments with jump links. |
| `get_transcript_segment` | The passage around a moment, with surrounding context, to verify a quote before citing it. |
| `get_channel_info` | Resolve a channel URL, `@handle` or ID: title, estimated uploads, how much is saved. |
| `list_channel_videos` | A channel's uploads, newest first (Shorts and past streams included), paged. |
| `import_channel` | Save transcripts for the latest N or all uploads as a background job. Previews first; starts only with `confirm=true`. |
| `refresh_channel` | Re-run a channel's last import to pick up new uploads; saved transcripts are reused. |
| `get_job_status` | Phase, totals per outcome (ready, absent, unavailable, retry, failed), per-video results and next steps. |
| `list_jobs` / `cancel_job` / `retry_job` | Follow, stop and resume imports. |
| `list_saved_channels` | Channels in your library with their saved transcript counts. |
| `server_info` | Version, health and library location. |

Errors are returned as JSON with a stable `code` (`invalid_input`, `no_captions`,
`language_unavailable`, `video_unavailable`, `empty_track`, `blocked`, `network_error`,
`upstream_error`, `cursor_invalid`) and a `retryable` flag.

### Channel imports

An import is saved in the library before any work starts, so it survives a closed chat or a restart:
with stdio clients the server stops when the client closes, and the job picks up where it left off the
next time the server starts. Each video ends in one of these states:

- **ready**: transcript saved (or an existing saved transcript reused)
- **absent**: YouTube confirmed there are no usable captions
- **unavailable**: private, removed or otherwise unplayable
- **failed**: a temporary error persisted after 3 attempts with backoff (`retry_job` tries again)

If YouTube starts rate-limiting your network, the whole job pauses with growing backoff instead of
burning through attempts, and stops after repeated blocks so you can resume it later. Fetches are spaced
out (`TUBEKIROKU_FETCH_DELAY`) to keep the load on YouTube light.

## Configuration

| Variable | Default | Purpose |
| --- | --- | --- |
| `TUBEKIROKU_DATA_DIR` | `~/.local/share/tubekiroku` | Where the SQLite library lives. |
| `TUBEKIROKU_PROXY_URL` | unset | HTTP(S) proxy for YouTube requests, if your network is blocked. |
| `TUBEKIROKU_FETCH_DELAY` | `1.5` | Seconds to wait between transcript fetches during imports. |
| `TUBEKIROKU_MAX_IMPORT` | `1000` | Upper limit on videos per channel import. |
| `TUBEKIROKU_TRANSPORT` | `stdio` | `stdio` or `http`. |
| `TUBEKIROKU_HOST` / `TUBEKIROKU_PORT` | `127.0.0.1` / `8000` | HTTP bind address. |

## How it works

```
MCP client ──tools──▶ server.py ──┬──▶ library.py ───▶ SQLite: videos, transcript versions, cues
                                  ├──▶ channels.py         channels, channel membership
                                  └──▶ jobs.py ◀── worker   import jobs and per-video items
                                          │
              sources/youtube.py ◀────────┴──▶ sources/channels.py
              (captions + oEmbed)                (channel page + yt-dlp upload listing)
```

`library.py`, `channels.py` and `jobs.py` hold the logic and know nothing about MCP, so other interfaces
can reuse them. Jobs advance one unit of work at a time (list the uploads, or fetch one video), commit
after each, and hold a short lease so two server processes sharing a library never work on the same job.
Sources sit behind small adapter interfaces; file imports and the official YouTube Data API are planned
as additional adapters.

## Personal use and YouTube's terms

TubeKiroku is a tool you run yourself, for your own use. It retrieves captions that YouTube shows
publicly, from your own network, and stores them only on your machine. You are responsible for how you
use it and for complying with [YouTube's Terms of Service](https://www.youtube.com/t/terms) and the
rights of video creators. The project does not operate a public instance and does not redistribute
transcripts. Do not deploy it as a public service that fetches transcripts on behalf of others.

TubeKiroku is not affiliated with or endorsed by YouTube or Google.

## Development

```bash
git clone https://github.com/chethankailash/tubekiroku && cd tubekiroku
uv sync
uv run pytest            # tests use a fake source and never touch the network
uv run ruff check . && uv run ruff format --check .
npx @modelcontextprotocol/inspector uv run tubekiroku   # try the tools interactively
```

## License

[MIT](LICENSE)

TDQS

A3.7/5.0

Scored across 14 tools

Disambiguation4/5

Most tools target clearly distinct resources: videos, channels, jobs, and per-video metadata. The only real overlap is the trio import_channel / refresh_channel / retry_job, which all (re)start transcript imports and could be misselected, though the descriptions do differentiate preview, increment, and resume semantics. get_transcript vs get_transcript_segment are well separated by scope.

Naming Consistency4/5

Nearly all tools follow a clean verb_noun snake_case pattern (list_jobs, get_video_info, import_channel, cancel_job). The single outlier is server_info, which breaks the verb-first convention but is still perfectly readable. Overall very predictable.

Tool Count5/5

14 tools is well within the sweet spot for a server covering video metadata, transcripts, channel imports, and job lifecycle. Each tool maps to a distinct operation with no filler.

Completeness4/5

The lifecycle is well covered: resolve, list, import (with preview/confirm), monitor, cancel, retry, and refresh. Gaps are minor but real: there is no way to delete or prune saved transcripts/channels, and no cross-library search beyond listing, which are likely asks given the server explicitly maintains a persistent local library.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues