How to connect YouTube to Claude Code
YouTube Data is an MCP server published by kirbah that runs on your machine, and this guide connects it to Claude Code through npx. The listing marks both YOUTUBE_API_KEY and MDB_MCP_CONNECTION_STRING as optional, so you can start without either. The command and config come from the listing's install data and Claude Code's documentation, last read on 2026-10-26.
Updated Oct 26, 2026 · Built from catalog data; how we rank and grade
Checked against Claude Code's documentation on Oct 26, 2026. Commands and config blocks are generated from the same install data as each listing page.
Before you start
- Claude Code installed and able to start.
- Node.js with npx (the server starts with npx).
- YOUTUBE_API_KEY (optional): YouTube Data API v3 key.
- MDB_MCP_CONNECTION_STRING (optional): MongoDB connection string for caching.
1. Check what you need
Node.js provides
npx, so check it first. Neither optional value is needed to pass this check.Check that it is installed node --version- It can take YOUTUBE_API_KEY and MDB_MCP_CONNECTION_STRING (next step).
2. Get YOUTUBE_API_KEY and MDB_MCP_CONNECTION_STRING
Decide whether you want either value before you continue, and gather only what you plan to use.
- YOUTUBE_API_KEY (optional): YouTube Data API v3 key.
- MDB_MCP_CONNECTION_STRING (optional): MongoDB connection string for caching.
3. Add YouTube Data to Claude Code
The
claude mcp addcommand takes both values as flags, and the.mcp.jsonalternative refers to them as environment variables that the final block exports.Add it for you in every project claude mcp add --transport stdio --env YOUTUBE_API_KEY=YOUR_YOUTUBE_API_KEY --env MDB_MCP_CONNECTION_STRING=YOUR_MDB_MCP_CONNECTION_STRING --scope user mcp-youtube -- npx -y @kirbah/mcp-youtube@1.1.15Or share it with the project: put this in .mcp.json at the project root .mcp.json{ "mcpServers": { "mcp-youtube": { "command": "npx", "args": [ "-y", "@kirbah/mcp-youtube@1.1.15" ], "env": { "YOUTUBE_API_KEY": "${YOUTUBE_API_KEY}", "MDB_MCP_CONNECTION_STRING": "${MDB_MCP_CONNECTION_STRING}" } } } }Set the variable in the shell you start the host from export YOUTUBE_API_KEY="paste-your-value-here" export MDB_MCP_CONNECTION_STRING="paste-your-value-here"- The command keeps the value in ~/.claude.json; the .mcp.json version refers to an environment variable, so nothing secret is committed.
4. Restart or reload if it does not appear
If YouTube Data does not appear, this step lists what the docs say about connecting at startup and reconnecting from
/mcp.- The docs do not say a restart is needed after claude mcp add. Servers connect at startup and can be reconnected from the /mcp menu.
- In an interactive session Claude Code asks you to approve servers from a project .mcp.json before it uses them; claude mcp reset-project-choices resets those answers.
Check that it works
Check the state with claude mcp list or /mcp. Once connected, the catalog records 9 tools for YouTube Data, such as getChannelStatistics.
claude mcp list- Run claude mcp list from the shell, or /mcp inside a session. The list shows each server as Connected, Needs authentication, Failed to connect, or Pending approval.
- Once it is connected, Claude Code should list its tools; the catalog records 9 for YouTube Data, including findConsistentOutlierChannels, getChannelStatistics and getChannelTopVideos.
Troubleshooting
- Error: MCP server has a "url" but no "type"
- Add "type": "http" (or sse) to the entry in the JSON file. Source
- MCP server already exists in local config
- Remove it from the other scope first with claude mcp remove <name> --scope <scope>, then add it again. Source
- A ${VAR} in the config stays literal
- The variable is unset. Export it before starting Claude Code or give it a default with ${VAR:-default}; claude mcp list shows a warning. Source
- Server shows disconnected in a session
- Open /mcp and reconnect it. Source
Security notes
- Publisher: kirbah, not listed as the vendor's own server; license MIT.
- It runs on your machine with your user account's permissions, so it can reach any file or network resource you can. Read its source before you give it access: https://github.com/kirbah/mcp-youtube.
- Keep YOUTUBE_API_KEY and MDB_MCP_CONNECTION_STRING in an environment variable; the config above refers to it by name, so the value is not written to the file.
- This listing has no security grade: Agent Market has not published security grades yet, so the choice is yours to make from the source and the permissions.
Servers and skills in this guide
Next up: other YouTube servers, a comparison, or the general Claude Code guide.
- 1YouTube Data
kirbah
YouTube MCP server for token-optimized, structured data using the YouTube Data API v3.
★ 32↓ 296/wkLast active Oct 20, 2026Local (stdio)Claude Code, Codex, VS Code, Cursor +2
AFreshness: A–Security: not graded yet
Related
Sources
- Connect Claude Code to tools via MCP · fetched Oct 26, 2026
Cite this page
How to connect YouTube to Claude Code. Agent Mart. https://agentmart.dev/guides/connect-youtube-to-claude-code (last updated 2026-10-26)