YouTube MCP

by tsubouchi

Integrations

  • Extracts screenshots from YouTube videos at specified intervals or timestamps, with special handling for regular videos and Shorts format.

  • Takes screenshots at 1-10 second intervals from YouTube Shorts, capturing up to 60 screenshots per video with precise cropping of the video area.

YouTube MCP

YouTube 동영상에서 자동으로 스크린샷을 가져오는 도구입니다. YouTube Shorts와 YouTube 동영상을 지원합니다.

기능

YouTube Shorts

  • 지정된 n초마다 스크린샷 촬영
  • 최대 60장까지 촬영(동영상이 60초 이상인 경우)
  • 동영상 영역만 정확하게 잘라내고 tmp/ 에 저장
  • 실시간으로 스크린샷 보기
  • 모두 또는 선택한 이미지를 ZIP로 로컬로 DL (Mac, Windows 모두에서 열 수 있음)

YouTube 동영상

  • 지정된 n초마다 스크린샷 촬영
  • 최대 60장까지 촬영(동영상이 60초 이상인 경우)
  • 동영상 영역만 정확하게 잘라내고 tmp/ 에 저장
  • 실시간으로 스크린샷 보기
  • 모두 또는 선택한 이미지를 ZIP로 로컬로 DL (Mac, Windows 모두에서 열 수 있음)

TikTok

  • 현재 대응 준비 중입니다.
  • YouTube 또는 YouTube Shorts URL을 사용하세요.

기술 스택

  • Node.js 18
  • Express
  • Playwright
  • Firebase Functions (Gen 2)
  • Firebase Hosting
  • Firebase Storage
  • TypeScript
  • Bootstrap CSS

프로젝트 구성

Playwrigh-MCP-Server/ ├── functions/ # Cloud Functions │ ├── src/ # ソースコード │ │ ├── index.ts # メインエントリーポイント │ │ ├── screenshot.ts # スクリーンショット機能 │ │ ├── screenshots.ts # スクリーンショット一覧取得 │ │ ├── download-zip.ts # ZIPダウンロード機能 │ │ └── types.ts # 型定義 │ ├── package.json # 依存関係 │ └── tsconfig.json # TypeScript設定 ├── public/ # 静的ファイル │ └── index.html # メインページ ├── firebase.json # Firebase設定 └── storage.rules # Storageセキュリティルール

API 목록

스크린샷 획득

  • 엔드포인트 : /screenshot
  • 방법 : POST
  • 매개변수 :
    { "url": "YouTube URL", "interval": 1 // 間隔(秒) }
  • 응답 :
    { "success": true, "screenshots": [ { "imageUrl": "署名付きURL", "time": "タイムスタンプ", "filename": "ファイル名" } ], "interval": 1 }

스크린샷 목록 획득

  • 엔드포인트 : /screenshots
  • 방법 : GET
  • 응답 :
    [ { "filename": "ファイル名", "imageUrl": "署名付きURL", "time": "タイムスタンプ" } ]

ZIP 다운로드

  • 엔드포인트 : /download-zip
  • 방법 : POST
  • 매개변수 :
    { "filenames": ["ファイル名1", "ファイル名2"] }
  • 응답 : ZIP 파일

GCP 아키텍처

사용 서비스

  1. Firebase Functions (Gen 2)
    • 런타임: Node.js 18
    • 지역: us-central1
    • 메모리: 1GiB
    • CPU: 1
    • 타임아웃: 540초
    • 최대 인스턴스 수: 100
    • 동시 실행 수: 80
    • 엔드포인트: https://api-ub7zp5pjra-uc.a.run.app
  2. Firebase Storage
    • 버킷: mcp-5e4b5.firebasestorage.app
    • 보안 규칙: 인증된 사용자만 액세스 가능
  3. Firebase Hosting

IAM 권한 설정

사용자 권한
  • t@bonginkan.ai
    • roles/owner )
    • roles/run.admin (Cloud Run 관리자)
서비스 계정 권한
  1. Cloud Functions
    • 33501462786-compute@developer.gserviceaccount.com
      • roles/run.admin
      • roles/run.developer
      • roles/run.invoker
      • roles/cloudfunctions.developer
      • roles/storage.admin
  2. Firebase Admin
    • firebase-adminsdk-fbsvc@mcp-5e4b5.iam.gserviceaccount.com
      • roles/firebase.sdkAdminServiceAgent
      • roles/firebaseauth.admin
      • roles/iam.serviceAccountTokenCreator
      • roles/storage.admin
  3. Cloud Build
    • 33501462786@cloudbuild.gserviceaccount.com
      • roles/run.admin
      • roles/cloudfunctions.developer
      • roles/storage.admin
      • roles/artifactregistry.admin
      • roles/eventarc.admin

구현 세부사항

스크린샷 기능

  • Playwright를 사용하여 헤드리스 브라우저 제어
  • 뷰포트 크기: 1280x720
  • 임시 디렉토리를 사용하여 스크린샷을 임시 저장
  • Firebase Storage에 업로드한 후 임시 파일 삭제
  • 서명된 URL은 15분 동안 유효합니다.

오류 처리

  • 각 API 엔드포인트에서 오류 catch
  • 오류 메시지를 JSON 형식으로 반환
  • 404 엔드포인트 처리
  • 500 오류 시 적절한 오류 응답

CORS 설정

보안

  • Firebase Storage 보안 규칙
  • 서명된 URL 만료 설정(15분)
  • 임시 파일의 적절한 삭제

최신 수정 내용 (2024-03-28)

버그 수정

  1. CORS 설정 개선
    • 허가 오리진의 명시적 지정
    • 자격 증명 사용
  2. 오류 처리 강화
    • 404 오류 JSON 형식 응답
    • 500 오류시 자세한 오류 메시지
  3. Firebase Storage 지원
    • 버킷 이름의 명시적 지정
    • 서명된 URL의 만료일을 15분으로 설정
  4. Cloud Functions Gen 2 최적화
    • 메모리 설정 최적화(1GiB)
    • 타임아웃 설정 조정(540초)
    • 동시 실행 횟수 설정(80)

기능 개선

  1. 스크린샷 기능
    • Playwright 설정 최적화
    • 헤드리스 브라우저 뷰포트 설정
    • 임시 파일 관리 개선
    • YouTube Shorts 대응 개선
    • 실시간 디스플레이 기능 구현
  2. API 응답 개선
    • 오류 메시지 일본어
    • 응답 형식의 통일
    • 타임스탬프 형식의 표준화
    • 스트리밍 응답 구현
  3. 보안 강화
    • Firebase Storage 보안 규칙 업데이트
    • 임시 파일의 안전한 삭제
    • 오류 정보의 적절한 제한
  4. 프런트 엔드 개선
    • 실시간 디스플레이 최적화
    • 이미지 URL 수정
    • 오류 처리 강화
    • 사용자 인터페이스 개선

설정

  1. 리포지토리 복제
git clone https://github.com/tsubouchi/youtube_mcp.git cd youtube_mcp
  1. 종속 패키지 설치
# プロジェクトルート npm install # Cloud Functions cd functions npm install
  1. Firebase CLI 설치
npm install -g firebase-tools
  1. Firebase에 로그인
firebase login
  1. 프로젝트 초기화
firebase init
  1. 배포
# Cloud Functions cd functions npm run deploy # Firebase Hosting cd .. firebase deploy --only hosting

로컬 개발 환경 설정

  1. 종속 패키지 설치
# プロジェクトルート npm install # Cloud Functions cd functions npm install
  1. 서비스 계정 키 설정
  • Firebase Console에서 서비스 계정 키 다운로드
  • functions/service-account.json 으로 저장
  1. 환경 변수 설정
# functions/.env GOOGLE_APPLICATION_CREDENTIALS=./service-account.json
  1. 에뮬레이터 시작
cd functions npm run serve

에뮬레이터 포트 설정

에뮬레이터는 다음 포트를 사용합니다.

API 테스트

  1. 헬스 체크
curl http://localhost:5001/mcp-5e4b5/us-central1/api
  1. 스크린샷 획득
curl -X POST http://localhost:5001/mcp-5e4b5/us-central1/api/screenshot \ -H "Content-Type: application/json" \ -H "Accept: application/json" \ -d '{"url": "YouTube URL", "interval": 5}'
  1. 스크린샷 목록 획득
curl http://localhost:5001/mcp-5e4b5/us-central1/api/screenshots
  1. ZIP 다운로드
curl -X POST http://localhost:5001/mcp-5e4b5/us-central1/api/download-zip \ -H "Content-Type: application/json" \ -d '{"filenames": ["ファイル名1", "ファイル名2"]}'

주의사항

  • 에뮬레이터를 사용할 때는 실제 Firebase Storage에 액세스합니다.
  • 서비스 계정 키는 .gitignore 에 포함되며 리포지토리에 커밋되지 않습니다.
  • 에뮬레이터 UI에서 함수의 실행 상태와 로그를 확인할 수 있습니다.

주의사항

  • Node.js 18은 2025년 4월 30일에 사용되지 않습니다.
  • 스크린샷은 임시 디렉토리에 저장되며 처리 후 삭제됩니다.
  • 동영상 길이가 60초를 초과하면 처음 60장만 저장됩니다.
  • Firebase Storage 보안 규칙은 인증된 사용자만 액세스 가능하도록 설정되어 있습니다.
  • 서명된 URL은 15분 동안만 유효합니다.

IMPORTANT

스크린샷 저장 및 ZIP화 사양

  1. 스크린샷 저장
    • 모든 스크린샷은 /tmp/screenshots/ 디렉토리에 임시 저장됩니다.
    • 파일 이름은 screenshot_[タイムスタンプ]_[連番].png 형식입니다.
    • 임시 파일은 처리가 완료된 후에도 유지되며 새 스크린샷을 촬영할 때 덮어씁니다.
  2. ZIP 파일 만들기
    • 선택한 스크린샷은 /tmp/screenshots/ 에서 직접 로드됩니다.
    • ZIP 파일은 임시로 /tmp/screenshots/ 에 만들어지고 다운로드 후 삭제됩니다.
    • ZIP 파일 이름은 screenshots_[タイムスタンプ].zip 형식입니다.
  3. 임시 파일 관리
    • 임시 파일은 정기적으로 정리해야 합니다.
    • 새 스크린샷을 촬영하기 전에 이전 파일을 삭제하는 것이 좋습니다.

라이센스

MIT License

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Automatically captures and processes screenshots from YouTube videos and Shorts at specified intervals, supporting customizable screenshot timing and providing API endpoints for image management.

  1. 기능
    1. YouTube Shorts
    2. YouTube 동영상
    3. TikTok
  2. 기술 스택
    1. 프로젝트 구성
      1. API 목록
        1. 스크린샷 획득
        2. 스크린샷 목록 획득
        3. ZIP 다운로드
      2. GCP 아키텍처
        1. 사용 서비스
        2. IAM 권한 설정
      3. 구현 세부사항
        1. 스크린샷 기능
        2. 오류 처리
        3. CORS 설정
        4. 보안
      4. 최신 수정 내용 (2024-03-28)
        1. 버그 수정
        2. 기능 개선
      5. 설정
        1. 로컬 개발 환경 설정
          1. 에뮬레이터 포트 설정
          2. API 테스트
          3. 주의사항
        2. 주의사항
          1. IMPORTANT
            1. 스크린샷 저장 및 ZIP화 사양
          2. 라이센스

            Related MCP Servers

            • -
              security
              A
              license
              -
              quality
              Provides functionality to search YouTube videos and automatically save the results to Google Sheets.
              Last updated -
              1
              9
              JavaScript
              MIT License
            • A
              security
              A
              license
              A
              quality
              Enables capturing high-quality native macOS screenshots using Safari through a Node.js server, supporting various sizes, zoom levels, and load wait times.
              Last updated -
              1
              7
              TypeScript
              MIT License
            • -
              security
              F
              license
              -
              quality
              Enables extraction of transcript text from YouTube videos by providing the video URL, supporting standard, shortened, and embed URL formats.
              Last updated -
              1
              JavaScript
            • A
              security
              A
              license
              A
              quality
              An official MCP server implementation that allows AI assistants to capture website screenshots through the ScreenshotOne API, enabling visual context from web pages during conversations.
              Last updated -
              1
              6
              TypeScript
              MIT License
              • Apple

            View all related MCP servers

            ID: u2f5xij3z5