npm package: @konanx/youtube-mcp
Description: MCP server for exploring YouTube channels with API key access.
Latest version: 0.1.0

# @konanx/youtube-mcp

MCP server for working with YouTube channels through `YOUTUBE_API_KEY`.

## Features

- Get all videos published on a channel.
- Return views, likes, and comment counts for videos.
- Return the public transcript for a video when captions are available.
- Build an overview summary for a channel.
- Show top videos by views, likes, or comments.
- Search videos inside a channel by title, description, or tags.

## Limitations

- Channel and video data are fetched through YouTube Data API v3.
- Transcripts are not available from YouTube Data API when using only an API key. This server uses a public captions flow, so transcripts are available only for videos with accessible public subtitles.
- Free-text channel lookup uses `search.list`, which is significantly more expensive in quota than passing a direct `channelId` or `@handle`.

## Environment Variables

```bash
YOUTUBE_API_KEY=your_youtube_data_api_key
```

## Installation

```bash
npm install
npm run build
```

## Publishing To npm

The package is already prepared for scoped public publishing.

```bash
npm login
npm run pack:check
npm publish --access public
```

Already configured:

- `bin` points to `dist/index.js`
- `files` publishes only `dist` and `README.md`
- `prepublishOnly` rebuilds the project before publishing
- `publishConfig.access` is fixed to `public`

Before publishing, make sure the `@konanx` scope belongs to your npm account.

## Running Locally

```bash
YOUTUBE_API_KEY=your_key npm start
```

## MCP Client Setup

A ready-to-use example config is available in [mcp.json](/Users/pavelkonon/Documents/Projects/KonanX/mcp/youtube/mcp.json).

```json
{
  "mcpServers": {
    "youtube": {
      "command": "npx",
      "args": ["-y", "@konanx/youtube-mcp"],
      "env": {
        "YOUTUBE_API_KEY": "YOUR_YOUTUBE_API_KEY"
      }
    }
  }
}
```

If you prefer installing the package globally first:

```bash
npm install -g @konanx/youtube-mcp
```

Then configure your MCP client like this:

```json
{
  "mcpServers": {
    "youtube": {
      "command": "youtube-mcp",
      "args": [],
      "env": {
        "YOUTUBE_API_KEY": "YOUR_YOUTUBE_API_KEY"
      }
    }
  }
}
```

For local development before publishing, you can still run the built entrypoint directly:

```json
{
  "mcpServers": {
    "youtube": {
      "command": "node",
      "args": [
        "/Projects/KonanX/mcp/youtube/dist/index.js"
      ],
      "env": {
        "YOUTUBE_API_KEY": "YOUR_YOUTUBE_API_KEY"
      }
    }
  }
}
```

## MCP Tools

### `youtube_list_channel_videos`

Input:

```json
{
  "channel": "@GoogleDevelopers",
  "limit": 100
}
```

### `youtube_get_video_stats`

Input:

```json
{
  "videoIds": ["dQw4w9WgXcQ"]
}
```

### `youtube_get_video_transcript`

Input:

```json
{
  "videoId": "dQw4w9WgXcQ"
}
```

### `youtube_get_channel_overview`

Input:

```json
{
  "channel": "https://www.youtube.com/@GoogleDevelopers"
}
```

### `youtube_find_top_videos`

Input:

```json
{
  "channel": "@GoogleDevelopers",
  "sortBy": "views",
  "limit": 10
}
```

### `youtube_search_channel_videos`

Input:

```json
{
  "channel": "@GoogleDevelopers",
  "query": "gemini",
  "limit": 20
}
```