# anaisbetts/mcp-youtube architecture

> Architecture diagram of the GitHub repository anaisbetts/mcp-youtube, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anaisbetts/mcp-youtube
- Repository: https://github.com/anaisbetts/mcp-youtube

## Overview

##### Main Components
a. External Clients/Users: Represent the front door where requests are initiated (e.g., a command entered by a user or a request coming from a client service).
b. API/Entry Point: The server’s entry file (index.js and potentially src/index.ts contain the main logic). This module receives incoming requests.
c. YouTube Subtitle Downloader: A component (or module) that leverages the installed external tool, yt-dlp, to download subtitles from YouTube. This is an external dependency and should be clearly marked as such.
d. MCP Connector: A dedicated module or service that uses the Model Context Protocol to connect with claude.ai. This module takes the downloaded subtitle data and communicates with the external service.
e. Testing Infrastructure: Represent the test suite (under the test directory) which validates functionalities such as subtitle extraction and data handling.

##### Relationships and Data Flow
- Finally, the data (e.g., a summary or other response from claude.ai) is sent back through the chain to the client.

##### Architectural Patterns and Principles
- The design reflects a simple service architecture with clear external integrations rather than, say, a full-blown microservices ecosystem.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Nodes
    client("External Client/Request"):::external
    claude("Claude.ai (External Service)"):::external
    tests("Testing Infrastructure"):::test

    %% Server Middleware Subgraph
    subgraph "Server Middleware"
        direction TB
        api("API/Entry Point"):::internal
        downloader("YouTube Subtitle Downloader (yt-dlp)"):::internal
        mcp("MCP Connector"):::internal
    end

    %% Flow Connections
    client -->|"sends_video_URL"| api
    api -->|"calls_yt-dlp"| downloader
    downloader -->|"retrieves_subtitles"| mcp
    mcp -->|"uses_MCP"| claude
    claude -->|"returns_summary"| api
    api -->|"responds_to_client"| client

    %% Testing connection (for validation flows)
    tests -->|"validates_subtitle_extraction"| downloader

    %% Click Events for Component Mapping
    click api "https://github.com/anaisbetts/mcp-youtube/blob/main/index.js"
    click api "https://github.com/anaisbetts/mcp-youtube/blob/main/src/index.ts"
    click downloader "https://github.com/anaisbetts/mcp-youtube/blob/main/src/index.ts"
    click mcp "https://github.com/anaisbetts/mcp-youtube/blob/main/src/index.ts"
    click tests "https://github.com/anaisbetts/mcp-youtube/tree/main/test"

    %% Styles
    classDef internal fill:#d5f5e3,stroke:#28b463,stroke-width:2px,color:#000;
    classDef external fill:#f9e79f,stroke:#d4ac0d,stroke-width:2px,color:#000;
    classDef test fill:#d6eaf8,stroke:#3498db,stroke-width:2px,color:#000;
```
