# How to integrate Youtube MCP with Claude Agent SDK

```json
{
  "title": "How to integrate Youtube MCP with Claude Agent SDK",
  "toolkit": "Youtube",
  "toolkit_slug": "youtube",
  "framework": "Claude Agent SDK",
  "framework_slug": "claude-agents-sdk",
  "url": "https://composio.dev/toolkits/youtube/framework/claude-agents-sdk",
  "markdown_url": "https://composio.dev/toolkits/youtube/framework/claude-agents-sdk.md",
  "updated_at": "2026-05-12T10:31:01.431Z"
}
```

## Introduction

This guide walks you through connecting Youtube to the Claude Agent SDK using the Composio tool router. By the end, you'll have a working Youtube agent that can list your most recent uploaded videos, get subscriber count for your channel, search youtube for trending tutorials through natural language commands.
This guide will help you understand how to give your Claude Agent SDK agent real control over a Youtube account through Composio's Youtube MCP server.
Before we dive in, let's take a quick look at the key ideas and tools involved.

## Also integrate Youtube with

- [ChatGPT](https://composio.dev/toolkits/youtube/framework/chatgpt)
- [OpenAI Agents SDK](https://composio.dev/toolkits/youtube/framework/open-ai-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/youtube/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/youtube/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/youtube/framework/codex)
- [Cursor](https://composio.dev/toolkits/youtube/framework/cursor)
- [VS Code](https://composio.dev/toolkits/youtube/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/youtube/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/youtube/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/youtube/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/youtube/framework/cli)
- [Google ADK](https://composio.dev/toolkits/youtube/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/youtube/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/youtube/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/youtube/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/youtube/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/youtube/framework/crew-ai)

## TL;DR

Here's what you'll learn:
- Get and set up your Claude/Anthropic and Composio API keys
- Install the necessary dependencies
- Initialize Composio and create a Tool Router session for Youtube
- Configure an AI agent that can use Youtube as a tool
- Run a live chat session where you can ask the agent to perform Youtube operations

## What is Claude Agent SDK?

The Claude Agent SDK is Anthropic's official framework for building AI agents powered by Claude. It provides a streamlined interface for creating agents with MCP tool support and conversation management.
Key features include:
- Native MCP Support: Built-in support for Model Context Protocol servers
- Permission Modes: Control tool execution permissions
- Streaming Responses: Real-time response streaming for interactive applications
- Context Manager: Clean async context management for sessions

## What is the Youtube MCP server, and what's possible with it?

The Youtube MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Youtube account. It provides structured and secure access to your channel data, so your agent can perform actions like searching videos, managing playlists, retrieving channel insights, and handling subscriptions on your behalf.
- Channel activity monitoring: Let your agent fetch and summarize recent channel activities, including uploads, likes, playlist additions, and more, to keep you up to date at a glance.
- Automated video and playlist management: Easily list videos from any channel, retrieve your own playlists, and organize your content—all through AI-driven commands.
- Channel analytics and statistics: Ask your agent to pull detailed channel metrics such as subscriber counts, total views, or video counts for quick reporting and insights.
- Subscription management: Have your agent list your current subscriptions or even subscribe you to new channels based on your interests or instructions.
- Search and caption handling: Empower your agent to search YouTube for videos, channels, or playlists, as well as retrieve and download caption tracks for accessible viewing and content repurposing.

## Supported Tools

| Tool slug | Name | Description |
|---|---|---|
| `YOUTUBE_ADD_VIDEO_TO_PLAYLIST` | Add Video to Playlist | Tool to add a video to a playlist by inserting a playlist item. Use when organizing videos into playlists or building curated collections. |
| `YOUTUBE_CREATE_CHANNEL_SECTION` | Insert Channel Section | Tool to create a new channel section for the authenticated user's YouTube channel. Use when organizing channel content into sections like featured playlists, recent uploads, or featured channels. |
| `YOUTUBE_CREATE_COMMENT_REPLY` | Insert Comment Reply | Tool to create a reply to an existing YouTube comment. Use when responding to user comments or engaging in conversations on videos. |
| `YOUTUBE_CREATE_PLAYLIST` | Create Playlist | Tool to create a new YouTube playlist on the authenticated user's channel. Use when organizing videos into collections or building curated playlists. |
| `YOUTUBE_DELETE_CHANNEL_SECTION` | Delete Channel Section | Tool to delete a YouTube channel section. Use when you need to remove a channel section from a channel. The channel section must exist and the authenticated user must have permission to delete it. |
| `YOUTUBE_DELETE_COMMENT` | Delete Comment | Tool to delete a YouTube comment owned by the authenticated user or channel. Use when you need to remove a comment from a video. The comment must exist and be owned by the authenticated channel. |
| `YOUTUBE_DELETE_PLAYLIST` | Delete Playlist | Tool to delete a YouTube playlist owned by the authenticated user/channel. Use when you need to permanently remove a playlist from YouTube. Requires explicit confirmation via `confirmDelete: true` to prevent accidental deletions. |
| `YOUTUBE_DELETE_PLAYLIST_ITEM` | Delete Playlist Item | Tool to delete a playlist item (remove a video from a playlist). Use when removing specific videos from playlists. |
| `YOUTUBE_DELETE_VIDEO` | Delete Video | Tool to delete a YouTube video owned by the authenticated user/channel. Use when you need to permanently remove a video from YouTube. Requires explicit confirmation via `confirmDelete: true` to prevent accidental deletions. The video must exist and be owned by the authenticated channel. |
| `YOUTUBE_GET_CHANNEL_ACTIVITIES` | Get Channel Activities | Gets recent activities from a YouTube channel including video uploads, playlist additions, likes, and other channel events. |
| `YOUTUBE_GET_CHANNEL_ID_BY_HANDLE` | Get channel ID by handle | Retrieves the YouTube Channel ID for a specific YouTube channel handle. |
| `YOUTUBE_GET_CHANNEL_STATISTICS` | Get Channel Statistics | Gets detailed statistics for YouTube channels including subscriber counts, view counts, and video counts. Channels can be identified using their ID, handle (e.g., @Google), or username. |
| `YOUTUBE_GET_VIDEO_DETAILS_BATCH` | Video Details Batch | Retrieves multiple YouTube video resource parts in a single batch call. Use when you need cohort-level metrics for many videos to reduce quota usage and latency. |
| `YOUTUBE_GET_VIDEO_RATING` | Get Video Rating | Retrieves the ratings that the authorized user gave to a list of specified videos. Use when you need to check if a user has liked or disliked specific videos. |
| `YOUTUBE_LIST_CAPTION_TRACK` | List captions | Retrieves a list of caption tracks for a YouTube video. Returns an empty items list if no captions are available. Raises ExecutionFailed if the video ID is invalid or not found. |
| `YOUTUBE_LIST_CHANNEL_SECTIONS` | List Channel Sections | Tool to retrieve channel sections from YouTube. Use when you need to get the layout sections of a channel's homepage. Channel sections organize content into categories like playlists, uploads, or featured channels. |
| `YOUTUBE_LIST_CHANNEL_VIDEOS` | List channel videos | Lists videos from a specified YouTube channel. This action primarily uses the playlistItems.list endpoint with the channel's uploads playlist, which is the recommended approach by YouTube. The uploads playlist ID is obtained by fetching the channel resource via the Channels API and extracting the playlist ID from contentDetails.relatedPlaylists.uploads field. If the uploads playlist returns a 404 error (which can happen due to a known YouTube API bug where the returned playlist ID doesn't actually exist), the action automatically falls back to the search.list endpoint to retrieve channel videos. Note that the search fallback has higher quota cost (100 units vs 1 unit) and is limited to 500 results. If a channel exists but has no uploads playlist (e.g., brand accounts, channels with all videos deleted, or channels that haven't uploaded any public content), an empty result set is returned instead of an error. |
| `YOUTUBE_LIST_COMMENTS` | List Comments | List individual comments from YouTube videos. Returns comment details including author, text, timestamps, and engagement metrics. Use 'id' parameter to retrieve specific comments or 'parentId' to retrieve all replies to a top-level comment. |
| `YOUTUBE_LIST_COMMENT_THREADS2` | List Comment Threads | Tool to retrieve comment threads from YouTube videos or channels matching API request parameters. Use when you need to fetch comments with filtering by video, channel, or specific thread IDs. |
| `YOUTUBE_LIST_I18N_LANGUAGES` | List I18n Languages | Returns a list of application languages that the YouTube website supports. Use this when you need to retrieve all available language options for YouTube's interface or to localize content. |
| `YOUTUBE_LIST_I18N_REGIONS` | List I18n Regions | Tool to retrieve a list of content regions that the YouTube website supports. Returns region codes (ISO 3166-1 alpha-2) and localized region names. Use when you need to identify available geographic regions for content filtering or display. |
| `YOUTUBE_LIST_LIVE_CHAT_MESSAGES` | List Live Chat Messages | Tool to list live chat messages for a specific chat. Use for monitoring live chat during broadcasts or retrieving chat history. Returns messages with author details, timestamps, and message types (text, Super Chat, moderation events). |
| `YOUTUBE_LIST_PLAYLIST_IMAGES` | List Playlist Images | Tool to retrieve playlist images associated with a specific playlist. Use when fetching custom thumbnail images for playlists. |
| `YOUTUBE_LIST_PLAYLIST_ITEMS` | List Playlist Items | Tool to list videos in a playlist, with pagination support. Use when walking through a channel's uploads playlist to enumerate all videos. |
| `YOUTUBE_LIST_SUPER_CHAT_EVENTS` | List Super Chat Events | Lists Super Chat events for a channel, showing supporter purchases during live streams. Returns Super Chat and Super Sticker events from the past 30 days. Use to track and acknowledge supporter contributions. |
| `YOUTUBE_LIST_USER_PLAYLISTS` | List user playlists | Retrieves playlists owned by the authenticated user, implicitly using mine=True. |
| `YOUTUBE_LIST_USER_SUBSCRIPTIONS` | List user subscriptions | Retrieves the authenticated user's YouTube channel subscriptions, allowing specification of response parts and pagination. |
| `YOUTUBE_LIST_VIDEO_ABUSE_REPORT_REASONS` | List Video Abuse Report Reasons | Tool to retrieve a list of abuse report reasons that can be used to report abusive videos on YouTube. Use when you need to display available reporting categories or before calling videos.reportAbuse. Returns localized reason labels and optional secondary categorizations. |
| `YOUTUBE_LIST_VIDEO_CATEGORIES` | List Video Categories | Tool to list YouTube video categories that can be associated with videos. Use when you need to retrieve available video categories for a specific region or get details about specific category IDs. |
| `YOUTUBE_LOAD_CAPTIONS` | Download YouTube caption track | Downloads a specific YouTube caption track, which must be owned by the authenticated user, and returns its content as text. Note: This action requires you to own the video (YouTube Data API v3 restriction). Non-owned videos will return 403 Forbidden errors, including many auto-generated caption tracks. |
| `YOUTUBE_MULTIPART_UPLOAD_VIDEO` | Multipart upload video | Uploads a video to YouTube using multipart upload in a single request. Use when you want to upload both metadata and video file together. This action uploads the video file and metadata in one request, unlike resumable upload which requires two steps. |
| `YOUTUBE_POST_COMMENT` | Post Comment on Video | Tool to post a new top-level comment on a YouTube video. Use when creating comments to engage with video content or respond to user requests. |
| `YOUTUBE_RATE_VIDEO` | Rate Video | Tool to add a like or dislike rating to a YouTube video, or remove an existing rating. Use when you need to rate videos on behalf of the authenticated user. |
| `YOUTUBE_REPORT_VIDEO_ABUSE` | Report Video for Abuse | Tool to report a YouTube video for containing abusive content. Use when you need to flag videos that violate YouTube's community guidelines or contain harmful content. |
| `YOUTUBE_SEARCH_YOU_TUBE` | Search YouTube | Searches YouTube for videos, channels, or playlists using a query term, returning the raw API response. |
| `YOUTUBE_SET_COMMENT_MODERATION_STATUS` | Set Comment Moderation Status | Tool to set the moderation status of one or more YouTube comments. Use when moderating comments to hold for review, publish, or reject them. Optionally ban the comment author when rejecting. |
| `YOUTUBE_SUBSCRIBE_CHANNEL` | Subscribe to channel | Subscribes the authenticated user to a specified YouTube channel, identified by its unique `channelId` which must be valid and existing. |
| `YOUTUBE_UNSUBSCRIBE_CHANNEL` | Unsubscribe from channel | Tool to unsubscribe the authenticated user from a YouTube channel by deleting a subscription. Use when you need to remove an existing subscription. The subscription ID can be obtained from the `YOUTUBE_LIST_USER_SUBSCRIPTIONS` tool. |
| `YOUTUBE_UPDATE_CAPTION` | Update caption track | Updates a YouTube caption track's metadata such as name, language, or draft status. Use this to modify existing caption track properties without uploading new caption content. Note: Only properties specified in the snippet will be updated; unspecified properties retain their current values. |
| `YOUTUBE_UPDATE_CHANNEL` | Update channel | Updates a channel's metadata including branding settings and localizations. Only brandingSettings, invideoPromotion, and localizations properties can be updated. Requires the channel to be owned by the authenticated user. |
| `YOUTUBE_UPDATE_CHANNEL_SECTION` | Update Channel Section | Tool to update an existing YouTube channel section by ID. Use when modifying section properties like title, position, or featured content. |
| `YOUTUBE_UPDATE_COMMENT` | Update Comment | Tool to modify the text of an existing YouTube comment. Use when updating or correcting a previously posted comment. |
| `YOUTUBE_UPDATE_PLAYLIST` | Update Playlist | Tool to modify an existing YouTube playlist's metadata (title, description, privacy status). Use when updating playlist information for the authenticated user's channel. |
| `YOUTUBE_UPDATE_PLAYLIST_ITEM` | Update Playlist Item | Tool to modify a playlist item's properties such as position or note. Use when reordering videos in a playlist or updating item metadata. |
| `YOUTUBE_UPDATE_THUMBNAIL` | Update thumbnail | Sets the custom thumbnail for a YouTube video using an image from a URL. Requirements: - The authenticated user must own the video or have permission to edit it - The YouTube channel must be verified (phone verification required) to upload custom thumbnails - Image must be JPG, PNG, or GIF; under 2MB; recommended 1280x720 resolution (16:9 aspect ratio) |
| `YOUTUBE_UPDATE_VIDEO` | Update video | Updates metadata for a YouTube video identified by videoId, which must exist; an empty list for tags removes all existing tags. |
| `YOUTUBE_UPLOAD_VIDEO` | Upload video | Uploads a video from a local file path to a YouTube channel; the video file must be in a YouTube-supported format. |

## Supported Triggers

| Trigger slug | Name | Description |
|---|---|---|
| `YOUTUBE_NEW_ACTIVITY_TRIGGER` | New YouTube Activity | Triggers when a new activity is detected on a YouTube channel. |
| `YOUTUBE_NEW_PLAYLIST_ITEM_TRIGGER` | New Item in YouTube Playlist | Triggers when a new item is added to a YouTube playlist. |
| `YOUTUBE_NEW_PLAYLIST_TRIGGER` | New Playlist in YouTube Channel | Triggers when a new playlist is added to a YouTube channel. |
| `YOUTUBE_NEW_SUBSCRIPTION_TRIGGER` | New YouTube Channel Subscription | Triggers when a new channel is subscribed. |

## Creating MCP Server - Stand-alone vs Composio SDK

The Youtube MCP server is an implementation of the Model Context Protocol that connects your AI agent to Youtube. It provides structured and secure access so your agent can perform Youtube operations on your behalf through a secure, permission-based interface.
With Composio's managed implementation, you don't have to create your own developer app. For production, if you're building an end product, we recommend using your own credentials. The managed server helps you prototype fast and go from 0-1 faster.

## Step-by-step Guide

### 1. Prerequisites

Before starting, make sure you have:
- Composio API Key and Claude/Anthropic API Key
- Primary know-how of Claude Agents SDK
- A Youtube account
- Some knowledge of Python

### 1. Getting API Keys for Claude/Anthropic and Composio

Claude/Anthropic API Key
- Go to the [Anthropic Console](https://console.anthropic.com/settings/organization/api-keys) and create an API key. You'll need credits to use the models.
- Keep the API key safe.
Composio API Key
- Log in to the [Composio dashboard](https://dashboard.composio.dev?utm_source=toolkits&utm_medium=framework_docs).
- Navigate to your API settings and generate a new API key.
- Store this key securely as you'll need it for authentication.

### 2. Install dependencies

No description provided.
```python
pip install composio-anthropic claude-agent-sdk python-dotenv
```

```typescript
npm install @anthropic-ai/claude-agent-sdk @composio/core dotenv
```

### 3. Set up environment variables

Create a .env file in your project root.
What's happening:
- COMPOSIO_API_KEY authenticates with Composio
- USER_ID identifies the user for session management
- ANTHROPIC_API_KEY authenticates with Anthropic/Claude
```bash
COMPOSIO_API_KEY=your_composio_api_key_here
USER_ID=your_user_id_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
```

### 4. Import dependencies

No description provided.
```python
import asyncio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
import os
from composio import Composio
from dotenv import load_dotenv

load_dotenv()
```

```typescript
import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

dotenv.config();
```

### 5. Create a Composio instance and Tool Router session

No description provided.
```python
async def chat_with_remote_mcp():
    api_key = os.getenv("COMPOSIO_API_KEY")
    if not api_key:
        raise RuntimeError("COMPOSIO_API_KEY is not set")

    composio = Composio(api_key=api_key)

    # Create Tool Router session for Youtube
    mcp_server = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["youtube"]
    )

    url = mcp_server.mcp.url

    if not url:
        raise ValueError("Session URL not found")
```

```typescript
async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });

  // Create Tool Router session for Youtube
  const session = await composio.create(USER_ID, {
    toolkits: ['youtube'],
  });
  const mcpUrl = session?.mcp.url;
```

### 6. Configure Claude Agent with MCP

No description provided.
```python
# Configure remote MCP server for Claude
options = ClaudeAgentOptions(
    permission_mode="bypassPermissions",
    mcp_servers={
        "composio": {
            "type": "http",
            "url": url,
            "headers": {
                "x-api-key": os.getenv("COMPOSIO_API_KEY")
            }
        }
    },
    system_prompt="You are a helpful assistant with access to Youtube tools via Composio.",
    max_turns=10
)
```

```typescript
const options: Options = {
  permissionMode: 'bypassPermissions',
  mcpServers: {
    composio: {
      type: 'http',
      url: mcpUrl,
      headers: { 'x-api-key': COMPOSIO_API_KEY }
    }
  },
  systemPrompt: 'You are a helpful assistant with access to Youtube tools via Composio.',
  maxTurns: 10,
};
```

### 7. Create client and start chat loop

No description provided.
```python
# Create client with context manager
async with ClaudeSDKClient(options=options) as client:
    print("\nChat started. Type 'exit' or 'quit' to end.\n")

    # Main chat loop
    while True:
        user_input = input("You: ").strip()
        if user_input.lower() in {"exit", "quit"}:
            print("Goodbye!")
            break

        # Send query
        await client.query(user_input)

        # Receive and print response
        print("Claude: ", end="", flush=True)
        async for message in client.receive_response():
            if hasattr(message, "content"):
                for block in message.content:
                    if hasattr(block, "text"):
                        print(block.text, end="", flush=True)
        print()
```

```typescript
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}
```

### 8. Run the application

No description provided.
```python
if __name__ == "__main__":
    asyncio.run(chat_with_remote_mcp())
```

```typescript
try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}
```

## Complete Code

```python
import asyncio
from claude_agent_sdk import ClaudeSDKClient, ClaudeAgentOptions
import os
from composio import Composio
from dotenv import load_dotenv

load_dotenv()

async def chat_with_remote_mcp():
    api_key = os.getenv("COMPOSIO_API_KEY")
    if not api_key:
        raise RuntimeError("COMPOSIO_API_KEY is not set")

    composio = Composio(api_key=api_key)

    # Create Tool Router session for Youtube
    mcp_server = composio.create(
        user_id=os.getenv("USER_ID"),
        toolkits=["youtube"]
    )

    url = mcp_server.mcp.url

    if not url:
        raise ValueError("Session URL not found")

    # Configure remote MCP server for Claude
    options = ClaudeAgentOptions(
        permission_mode="bypassPermissions",
        mcp_servers={
            "composio": {
                "type": "http",
                "url": url,
                "headers": {
                    "x-api-key": os.getenv("COMPOSIO_API_KEY")
                }
            }
        },
        system_prompt="You are a helpful assistant with access to Youtube tools via Composio.",
        max_turns=10
    )

    # Create client with context manager
    async with ClaudeSDKClient(options=options) as client:
        print("\nChat started. Type 'exit' or 'quit' to end.\n")

        # Main chat loop
        while True:
            user_input = input("You: ").strip()
            if user_input.lower() in {"exit", "quit"}:
                print("Goodbye!")
                break

            # Send query
            await client.query(user_input)

            # Receive and print response
            print("Claude: ", end="", flush=True)
            async for message in client.receive_response():
                if hasattr(message, "content"):
                    for block in message.content:
                        if hasattr(block, "text"):
                            print(block.text, end="", flush=True)
            print()

if __name__ == "__main__":
    asyncio.run(chat_with_remote_mcp())
```

```typescript
import 'dotenv/config';
import readline from 'node:readline';
import { Composio } from '@composio/core';
import { query, type Options } from "@anthropic-ai/claude-agent-sdk";

async function chat() {
  const { COMPOSIO_API_KEY, USER_ID } = process.env;
  if (!COMPOSIO_API_KEY || !USER_ID) {
    throw new Error('COMPOSIO_API_KEY and USER_ID required in .env');
  }

  const composio = new Composio({ apiKey: COMPOSIO_API_KEY });
  const session = await composio.create(USER_ID, {
    toolkits: ['youtube']
  });
  const mcp_url = session?.mcp.url;

  const options: Options = {
    permissionMode: 'bypassPermissions',
    mcpServers: {
      composio: {
        type: 'http',
        url: mcp_url,
        headers: { 'x-api-key': COMPOSIO_API_KEY }
      }
    },
    systemPrompt: 'You are a helpful assistant with access to Youtube tools via Composio.',
    maxTurns: 10,
  };

  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
    prompt: 'You: '
  });

  console.log('\nChat started. Type "exit" to quit.\n');

  let isProcessing = false;

  async function ask(prompt: string) {
    isProcessing = true;
    rl.pause();

    process.stdout.write('Claude is thinking...');
    const stream = query({ prompt, options });

    let firstChunk = true;
    for await (const msg of stream) {
      const content = (msg as any).message?.content || (msg as any).content;
      if (Array.isArray(content)) {
        for (const block of content) {
          if (block.type === 'text' && block.text) {
            if (firstChunk) {
              process.stdout.write('\r\x1b[K');
              process.stdout.write('Claude: ');
              firstChunk = false;
            }
            process.stdout.write(block.text);
          }
        }
      }
    }
    process.stdout.write('\n\n');

    isProcessing = false;
    rl.resume();
    rl.prompt();
  }

  rl.on('line', async (line) => {
    if (isProcessing) return;

    const input = line.trim();
    if (input === 'exit') {
      rl.close();
      process.exit(0);
    }
    if (input) await ask(input);
    else rl.prompt();
  });

  await ask('What can you help me with?');
}

try {
  await chat();
} catch (error) {
  console.error(error);
  process.exit(1);
}
```

## Conclusion

You've successfully built a Claude Agent SDK agent that can interact with Youtube through Composio's Tool Router.
Key features:
- Native MCP support through Claude's agent framework
- Streaming responses for real-time interaction
- Permission bypass for smooth automated workflows
You can extend this by adding more toolkits, implementing custom business logic, or building a web interface around the agent.

## How to build Youtube MCP Agent with another framework

- [ChatGPT](https://composio.dev/toolkits/youtube/framework/chatgpt)
- [OpenAI Agents SDK](https://composio.dev/toolkits/youtube/framework/open-ai-agents-sdk)
- [Claude Code](https://composio.dev/toolkits/youtube/framework/claude-code)
- [Claude Cowork](https://composio.dev/toolkits/youtube/framework/claude-cowork)
- [Codex](https://composio.dev/toolkits/youtube/framework/codex)
- [Cursor](https://composio.dev/toolkits/youtube/framework/cursor)
- [VS Code](https://composio.dev/toolkits/youtube/framework/vscode)
- [OpenCode](https://composio.dev/toolkits/youtube/framework/opencode)
- [OpenClaw](https://composio.dev/toolkits/youtube/framework/openclaw)
- [Hermes](https://composio.dev/toolkits/youtube/framework/hermes-agent)
- [CLI](https://composio.dev/toolkits/youtube/framework/cli)
- [Google ADK](https://composio.dev/toolkits/youtube/framework/google-adk)
- [LangChain](https://composio.dev/toolkits/youtube/framework/langchain)
- [Vercel AI SDK](https://composio.dev/toolkits/youtube/framework/ai-sdk)
- [Mastra AI](https://composio.dev/toolkits/youtube/framework/mastra-ai)
- [LlamaIndex](https://composio.dev/toolkits/youtube/framework/llama-index)
- [CrewAI](https://composio.dev/toolkits/youtube/framework/crew-ai)

## Related Toolkits

- [Amara](https://composio.dev/toolkits/amara) - Amara is a collaborative platform for creating and managing subtitles and captions for videos. It helps make content accessible and multilingual for global audiences.
- [Cats](https://composio.dev/toolkits/cats) - Cats is an API with a huge library of cat images, breed data, and cat facts. It makes finding adorable cat photos and trivia effortless for your apps and users.
- [Chatfai](https://composio.dev/toolkits/chatfai) - Chatfai is an AI platform that lets users talk to AI versions of fictional characters from books, movies, and games. It offers an engaging, interactive experience for fans to chat, roleplay, and explore creative dialogues.
- [Cincopa](https://composio.dev/toolkits/cincopa) - Cincopa is a multimedia platform for uploading, managing, and customizing videos, images, and audio. It helps you deliver engaging media experiences with robust APIs and flexible integrations.
- [Dungeon fighter online](https://composio.dev/toolkits/dungeon_fighter_online) - Dungeon Fighter Online (DFO) is an arcade-style, side-scrolling action RPG packed with dynamic combat and progression. Play solo or with friends to battle monsters, complete quests, and upgrade your characters.
- [Elevenlabs](https://composio.dev/toolkits/elevenlabs) - Elevenlabs is an advanced AI voice generation platform for lifelike, multilingual speech synthesis. Perfect for creating natural voices for videos, apps, and business content in seconds.
- [Elevenreader](https://composio.dev/toolkits/elevenreader) - Elevenreader is an AI-powered text-to-speech service by ElevenLabs that converts written content into lifelike audio. It enables fast, natural audio generation from any text.
- [Epic games](https://composio.dev/toolkits/epic_games) - Epic Games is a leading video game publisher and digital storefront, known for Fortnite and Unreal Engine. It lets gamers access, manage, and purchase games all in one place.
- [Fal.ai](https://composio.dev/toolkits/fal_ai) - Fal.ai is a generative media platform offering 600+ AI models for images, video, voice, and audio. Developers use Fal.ai for fast, scalable access to cutting-edge generative AI tools.
- [Giphy](https://composio.dev/toolkits/giphy) - Giphy is the largest online library for searching and sharing GIFs and stickers. Instantly add vibrant animated content to your apps, chats, and workflows.
- [Headout](https://composio.dev/toolkits/headout) - Headout is a global platform for booking travel experiences, tours, and entertainment. It helps users discover and secure activities at top destinations, all in one place.
- [Imagekit io](https://composio.dev/toolkits/imagekit_io) - ImageKit.io is a cloud-based media management platform for image and video delivery. Instantly optimize, transform, and deliver visuals globally via a lightning-fast CDN.
- [Listennotes](https://composio.dev/toolkits/listennotes) - Listennotes is a powerful podcast search engine with a massive global database. Discover, search, and curate podcasts from around the world in seconds.
- [News api](https://composio.dev/toolkits/news_api) - News api is a REST API for searching and retrieving live news articles from across the web. Instantly access headlines, coverage, and breaking stories from thousands of sources.
- [RAWG Video Games Database](https://composio.dev/toolkits/rawg_video_games_database) - RAWG Video Games Database is the largest video game discovery and info service. Instantly access comprehensive details, ratings, and release dates for thousands of games.
- [Seat geek](https://composio.dev/toolkits/seat_geek) - SeatGeek is a live event platform offering APIs for concerts, sports, and theater data. Instantly access events, venues, and performers info for smarter ticketing and discovery.
- [Shotstack](https://composio.dev/toolkits/shotstack) - Shotstack is a cloud platform for programmatically generating videos, images, and audio. Automate creative content production at scale with flexible RESTful APIs.
- [Spotify](https://composio.dev/toolkits/spotify) - Spotify is a streaming service for music and podcasts with millions of tracks from artists worldwide. Enjoy personalized playlists, recommendations, and seamless listening across all your devices.
- [Ticketmaster](https://composio.dev/toolkits/ticketmaster) - Ticketmaster is a global platform for event discovery, ticket sales, and live entertainment management. Get real-time access to events and streamline ticketing for fans and organizers.
- [Gmail](https://composio.dev/toolkits/gmail) - Gmail is Google's email service with powerful spam protection, search, and G Suite integration. It keeps your inbox organized and makes communication fast and reliable.

## Frequently Asked Questions

### What are the differences in Tool Router MCP and Youtube MCP?

With a standalone Youtube MCP server, the agents and LLMs can only access a fixed set of Youtube tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Youtube and many other apps based on the task at hand, all through a single MCP endpoint.

### Can I use Tool Router MCP with Claude Agent SDK?

Yes, you can. Claude Agent SDK fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Youtube tools.

### Can I manage the permissions and scopes for Youtube while using Tool Router?

Yes, absolutely. You can configure which Youtube scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

### How safe is my data with Composio Tool Router?

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Youtube data and credentials are handled as safely as possible.

---
[See all toolkits](https://composio.dev/toolkits) · [Composio docs](https://docs.composio.dev/llms.txt)
