youtube-for-ai-agents
AGENTS.md75 starsChanged 4 days agoApache-2.0View on GitHub
An MCP server that gives AI agents YouTube: search, transcripts, video details, frames, comments, channels, playlists, downloads, clips and reels. No API key. It ships as a Claude Code plugin, a Cursor plugin, a Gemini CLI extension, an OpenCode plugin and the npm package @jcodesmore/youtube-for-ai-agents, all from this one repository. Versions live in package.json, both plugin manifests, gemini-extension.json and server.json; a unit test keeps them in step. The changelog follows Keep a Changelog: add entries under ## [Unreleased] as you…
The file
Files
YouTube for AI Agents
An MCP server that gives AI agents YouTube: search, transcripts, video details, frames, comments, channels, playlists, downloads, clips and reels. No API key. It ships as a Claude Code plugin, a Cursor plugin, a Gemini CLI extension, an OpenCode plugin and the npm package @jcodesmore/youtube-for-ai-agents, all from this one repository.
Commands
npm install: dev dependencies (everything is a dev dependency; see below)npm run build: bundlesrc/intodist/index.jsnpm test: unit tests (vitest), offlinenpm run smoke: the built server over real MCP against live YouTube;--mediaadds clips, frames and audio,--offlineonly starts itnpm run check: typecheck, tests, build, and a check that committeddist/matches the source. Run it before every commit.node dist/index.js doctor | login | logout | status | config: the same CLI users get
How it's put together
src/server.tsregisters the tools and the server instructions;src/tools/*.tseach export a zod input schema and a handler;src/lib/holds the YouTube client (innertube.ts), transcripts, media (download.ts, via yt-dlp and ffmpeg), sign-in, settings and the CLI pieces.src/index.tsis the CLI entry: no command runs the MCP server on stdio.skills/youtubeis the agent-facing guide,skills/setupthe/youtube:setupcommand,agents/video-watcher.mdthe subagent.GEMINI.mdand.opencode/plugins/youtube.jsreuse the same skill.
Constraints that aren't obvious
dist/is committed and self-contained. Plugin installs are agit clonewith no build step, so esbuild bundles every dependency intodist/index.js. Commitdist/with anysrc/change; CI fails if they drift.- No lockfile in the root. Claude Code runs
npm installin any plugin whose root haspackage.jsonplus a lockfile, which would pull 130 MB of dev tools onto every user's machine..npmrcsetspackage-lock=false. The lockfile CI builds from lives in.github/lock/, so the bundle is reproducible; after changing dependencies runnpm run lock, rebuild and commit all three. - stdout belongs to MCP. Log with
src/lib/log.ts(stderr, only withYOUTUBE_AI_AGENTS_DEBUG=1). A strayconsole.login server code corrupts the protocol. - Errors go through
toolError(src/lib/errors.ts), which returns JSON withkind,retryableand ahintthe agent can relay. Give new failure modes a kind and a hint. - User data lives in
~/.youtube-for-ai-agents(YOUTUBE_AI_AGENTS_HOMEoverrides): settings, sign-in, transcript cache, downloaded yt-dlp and ffmpeg. Never in the plugin folder, which updates replace. - Transcripts come from YouTube's transcript panel first (
/youtubei/v1/get_panel, the "Show transcript" button), then the caption files (/api/timedtext). The caption files rate-limit an IP with HTTP 429 for hours after a few dozen requests, even for a real browser; the panel kept working through that in Nov 2026. Only caption files can machine-translate. Keep live tests to a handful of videos. - Node 22+ is the documented floor (
enginessays 20 so older installs still start).loginneeds the globalWebSocketfrom Node 22. - All tools are read-only toward YouTube; media tools only write files locally.
Releasing
Versions live in package.json, both plugin manifests, gemini-extension.json and server.json; a unit test keeps them in step. The changelog follows Keep a Changelog: add entries under ## [Unreleased] as you go.
node scripts/set-version.mjs X.Y.Zsets every version and dates the Unreleased section.npm run check, then commitchore: release vX.Y.Zonmain.- Tag
vX.Y.Z(annotated) and push the commit and tag. - Publish a GitHub Release for the tag, titled
vX.Y.Z - <theme>, with a short intro, Highlights, What's Changed (the changelog section, with PR numbers) and a Full Changelog compare link. - Publishing the release runs
.github/workflows/release.yml, which checks the tag against the manifests and publishes to npm (trusted publishing, with provenance) and the MCP Registry. - Bump
youtube'sversioninJCodesMore/jcodesmore-plugins.claude-plugin/marketplace.jsonso Claude Code offers the update.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

