feat(api): migrate YouTube connector to Composio

Merged
AR
5mo ago
+210-1411

Summary

Adds YouTube to the Composio toolkit allowlist (artist + supported + enabled lists, plus COMPOSIO_YOUTUBE_AUTH_CONFIG_ID env). Removes four custom YouTube MCP tools whose capabilities Composio's YouTube toolkit already covers (`YOUTUBE_GET_CHANNEL_STATISTICS`, `YOUTUBE_LIST_PLAYLIST_ITEMS`, `YOUTUBE_UPDATE_THUMBNAIL`). Keeps `get_youtube_revenue` as the only retained custom YouTube tool — Composio doesn't expose YouTube Analytics — and rewrites it to read the OAuth access token from Composio's connected-account state instead of the `youtube_tokens` Supabase table.

Test plan

  • On preview, `GET /api/connectors?account_id=` returns `youtube` with `isConnected` and a `connectedAccountId`
  • `GET /api/connectors/actions?account_id=` lists the three YouTube actions above
  • After connecting via the chat UI, calling `get_youtube_revenue` for a monetized channel returns daily/total revenue without touching `youtube_tokens`
  • `pnpm test` (2305+ green)
  • `pnpm lint:check` clean

Summary by cubic

Migrate YouTube to Composio: enable the youtube connector, replace custom MCP tools with Composio actions, and keep get_youtube_revenue as a custom tool that queries YouTube Analytics via Composio.

  • Refactors

    • Enabled Composio YouTube: added youtube to ALLOWED_ARTIST_CONNECTORS, ENABLED_TOOLKITS, and SUPPORTED_TOOLKITS, and wired COMPOSIO_YOUTUBE_AUTH_CONFIG_ID in buildAuthConfigs; swapped login/channels/playlist-videos/thumbnail tools for Composio actions (YOUTUBE_GET_CHANNEL_STATISTICS, YOUTUBE_LIST_PLAYLIST_ITEMS, YOUTUBE_UPDATE_THUMBNAIL).
    • Rewrote get_youtube_revenue to authorize with checkAccountArtistAccess, read the artist’s Composio connected account, and call YouTube Analytics via composio.tools.proxyExecute with connectedAccountId (tokens never leave Composio).
    • Updated the Composio Tool Router: renamed to getComposioTools, removed resolveSessionToolkits, and merged owner tool sets by priority (shared → customer → artist); customer meta-only filter applies only when an artist is in scope.
    • Removed the youtube_tokens table, YouTube OAuth helpers, and the googleapis dependency.
  • Migration

    • Set COMPOSIO_YOUTUBE_AUTH_CONFIG_ID and deploy; artists must connect YouTube in the connectors UI.
    • No DB tokens are used; get_youtube_revenue works with Composio’s connected account tokens.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added YouTube as a supported connector through Composio integration.
  • Removed

    • Removed standalone YouTube login tool; authentication now handled through Composio's YouTube connector.
    • Removed direct YouTube channel and video listing tools; now available via Composio's YouTube toolkit.
    • Removed thumbnail upload tool; manage through Composio's YouTube integration.
  • Improved

    • YouTube revenue analytics now use streamlined authentication via Composio connectors.