MCP SERVER

YouTube MCP

A local-first MCP server that lets AI assistants search YouTube, manage my channel and read my analytics, and asks me to approve every change first.

  • 79 MCP tools in 13 areas
  • 5 min Approval expiry: a change must be executed within 5 minutes of its preview
  • 0 Live changes made by the automated tests, which run fully offline
  • ~7,500 Lines of TypeScript source, with about 6,900 lines of tests

youtube-mcp README tools table, 2026-11-26; youtube-mcp src/operations/service.ts, 2026-11-26; youtube-mcp README, safety model, 2026-11-26; youtube-mcp repo, line count of tracked .ts files in src and tests, 2026-11-26

ROLE
Author
TIMELINE
Released 2026-10-27
STACK
TypeScript, Node.js, MCP, YouTube APIs
STATUS
Public

Approve a change

Watch for: what the preview shows, and what happens when the approval runs out.

Pick a sample change, such as renaming a playlist, making a video public or deleting a comment. Step through preflight, approve and execute. Elevated changes need an extra switch. A clock counts down the 5-minute approval at 20 times speed, and you can skip time to watch an expired approval get the write refused. Fake data only.

Problem

I wanted an AI assistant to work with my YouTube channel: search videos, read my analytics, and help with uploads, playlists and comments. Reading is safe. Writing is not. A wrong rename, a video made public by mistake or a deleted comment is hard to take back, and an assistant can get a request subtly wrong.

So the problem was not how to call the YouTube API. It was how to give an assistant write access and still know exactly what it is about to change before it changes it.

Constraints

  • It runs on my own machine. It uses stdio by default, and the optional HTTP mode binds to 127.0.0.1 only (README, 2026-10-27).
  • My Google sign-in token and working data stay on my disk, under ~/.youtube-mcp, in a file only my user can read. Nothing goes to a server of mine.
  • Every change to my account needs my approval first, even if the AI client has its own approval screen.
  • The automated tests must never make a live change to a real account.
  • TypeScript on Node 22 or newer, MIT licensed, and usable from several clients, not only one.
  • My viewing history stays private. The Google Takeout import goes into a local SQLite file and is never sent to YouTube.

Approach

The server exposes 74 tools. Reading tools run when the assistant calls them. Every tool that changes something goes through three separate steps:

youtube_preflight_*   reads fresh state from YouTube and returns an exact preview
        |
        v
youtube_approve_*     confirm: true; binds approval to profile, channel,
        |             target, requested change and the fresh state
        v
the write tool        runs only with the same approved inputs and confirm: true

The preview is the point. It is the exact change, built from state read just now, so I approve a specific thing and not a description of it. The approval is tied to that change. A different change, a different channel or different state does not match it.

Approvals expire after 5 minutes (src/operations/service.ts). They are stored locally, so an approved change survives a server restart until it expires. An expired or already-used approval is refused, and the assistant has to run a new preflight.

More rules, all from the code and README:

  • Mutations are never retried automatically. If an outcome is unclear, the server reconciles it with a read instead of trying again.
  • Public visibility, scheduling, synthetic-media changes and banning an author need an extra, elevated flag.
  • Uploads are private unless I explicitly ask to publish. New playlists default to private.
  • Comment deletion only works on comments that belong to my selected channel.
  • The server checks that the signed-in Google account matches the channel ID I configured.
  • Caption downloads never overwrite an existing path or follow symbolic links.

Private viewing analysis stays local. I can import my Google Takeout history and compare two date ranges. The server can also build a finite, proposed queue from saved allowlists, but it never applies that queue to my account.

What shipped

  • A local MCP server with 74 tools in 11 areas: public reads 5, account 7, creator analytics 3, creator reads 10, uploads 8, video metadata and thumbnails 5, captions 8, playlists 13, comments and moderation 7, local viewing analysis 7 and status 1 (README tools table).
  • The preflight, approve, execute flow for every change to my channel, with the 5-minute expiry.
  • Config examples for Claude Code, Claude Desktop, Codex, Cursor, OpenCode and any generic stdio client.
  • 202 tests (vitest, 26 files), all offline, and none makes a live change. CI runs lint, typecheck, build, test, a pack dry-run and a read-only smoke check. The source is about 6,000 lines of TypeScript and the tests about 4,400.
  • v0.1.0, released publicly on 27 Oct 2026. It was built earlier and released then.
  • Since then: 6 releases, from v0.1.0 (2026-10-27) to v0.3.3 (2026-11-08) (gh release list). It is listed in the official MCP Registry as io.github.pratikgh0se/youtube-mcp, current version 0.3.3 (registry API, checked 2026-11-26). As of 2026-11-26 the README lists 79 tools in 13 areas, and a test run collects 423 offline tests in 38 files (vitest list).
  • This Lab page, and a small toy so you can try the approval flow with fake data.

Outcome

It is released, public and MIT licensed: pratikgh0se/youtube-mcp. I have no usage numbers, such as downloads or users, and I would rather leave them out than invent them.

The evidence I would point to is the design. A change cannot run without a preview and a separate approval of that exact preview, and the approval runs out after 5 minutes.

What I learned

An approval is only worth something if it is tied to the exact change. A plain "yes" to a description can be applied to something slightly different, so the approval is bound to the profile, channel, target, change and the state read at preflight.

An assistant that fails halfway should not simply try again. A repeated write can do the same change twice, so I made the server never retry a change and check what actually happened with a read.

Owning the channel is not the same as owning every comment on it. Deleting a comment needs the comment to belong to my selected channel, and a viewer's comment on my video is not mine to delete.

How AI built this

I built this with AI assistance and I led the work. I decided what the server should do, the safety rules and what shipped, and I reviewed the result.