tube-bridge

io.github.TheWhiteWater由 GitHub 帳號 TheWhiteWater 發布v1.1.7更新於 Nov 4, 2026

YouTube MCP server for search, transcripts, frames, comments, channels, and local semantic corpora.

概覽

AI 產生的概覽

自架式的 YouTube 研究 MCP 伺服器:搜尋影片與頻道、讀取字幕和留言、擷取帶時間戳的畫面,並建立本機語意語料庫。

可以做什麼
  • 搜尋影片、熱門列表、播放清單與頻道上傳內容,並讀取影片中繼資料
  • 取得字幕(可選時間戳)並列出可用的字幕語言
  • 依毫秒時間戳回傳單張暫存 JPEG 畫面
  • 讀取頂層留言與頻道統計資料(需要 API 金鑰)
  • 建立、加入、列出、語意搜尋與刪除本機字幕語料庫,結果附時間戳
  • 查看執行階段文件與已知限制
適用情境
適合需要研究 YouTube 內容的情境:尋找某主題的影片、引用或摘要字幕、提供附時間戳與畫面佐證的引用,或在私有本機索引中跨多份字幕檢索。
執行需求
本機 Python 3.12 以上程序,通常以 uvx 從 PyPI 套件啟動;僅畫面擷取需要 PATH 中的 ffmpeg;留言、頻道工具與較佳搜尋可選用 YOUTUBE_API_KEY;可選 TUBE_BRIDGE_PROXY 與 TUBE_BRIDGE_CACHE;需能連線 YouTube;首次嵌入可能下載本機模型。
安裝前請注意
YOUTUBE_API_KEY 與代理憑證應放在環境變數中,不要寫進提交的設定檔。corpus_delete 會永久刪除語料庫及其向量。畫面擷取會從 YouTube 下載暫存媒體。YouTube 可能阻擋匿名請求,雲端主機 IP 區段尤其如此。自架 HTTP 模式應以 TUBE_BRIDGE_AUTH_KEY 保護。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 tube-bridge,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

tube-bridge

Self-hosted YouTube research for AI agents.

Search videos and channels, read transcripts and comments, extract timestamped frames, and build private semantic-search corpora — through 17 MCP tools.

[CI] [PyPI] [PyPI downloads] [Python] [License] [Glama]

  • 14 of 17 tools need no YouTube API key.
  • Local-first corpus: transcripts, vectors, and indexes stay on your machine.
  • Useful research output: titles, similarity scores, canonical video URLs, and timestamp links.
  • One tool for one frame: return visual evidence near a transcript finding without keeping media files.
  • Self-hosted and MIT: no account, hosted intermediary, managed storage, or vendor lock-in.

Thanks to everyone already using tube-bridge. If it saves you time, consider starring the repository — it helps others discover the project and signals that publishing more work like this is worthwhile.

Connect in a minute

The simplest setup uses uvx, which runs the published PyPI package in an isolated environment:

bash
uvx tube-bridge

Normally your MCP client launches that command for you. Choose your client below.

[!NOTE] tube-bridge requires Python 3.12 or newer. An API key is optional. ffmpeg is needed only for youtube_get_frame, and the first embedding operation may download the local model.

Claude Desktop

Open Settings → Developer → Edit Config and add:

json
{  "mcpServers": {    "tube-bridge": {      "command": "uvx",      "args": ["tube-bridge"]    }  }}

Restart Claude Desktop after saving the configuration.

Claude Code

bash
claude mcp add --scope user tube-bridge -- uvx tube-bridge

Cursor

Create .cursor/mcp.json in your project, or add the server to your user-level MCP configuration:

json
{  "mcpServers": {    "tube-bridge": {      "command": "uvx",      "args": ["tube-bridge"]    }  }}

VS Code

Create .vscode/mcp.json:

json
{  "servers": {    "tube-bridge": {      "type": "stdio",      "command": "uvx",      "args": ["tube-bridge"]    }  }}

Codex CLI

bash
codex mcp add tube-bridge -- uvx tube-bridge

Pi package

Pi can load the package-relative adapter and the canonical tube-bridge-research skill from the same Git source:

bash
python3 -m pip install tube-bridge==1.1.7pi install git:github.com/TheWhiteWater/[email protected]pi list

This registers one status tool plus all 17 MCP tools with the tube_bridge_ prefix. The adapter reads the existing plugin.json and mcp.json, launches only the local stdio runtime, preserves bounded text and image content, and forwards only an allowlisted child-process environment.

The Pi package manager installs the Node adapter dependency but does not install Python or ffmpeg. Ensure the python3 visible to Pi is Python 3.12+ with the tube-bridge dependencies installed; install ffmpeg separately to use youtube_get_frame. By default, Pi-managed state lives under the platform data directory; set TUBE_BRIDGE_PI_DATA to move that root. An explicit TUBE_BRIDGE_CACHE still takes precedence for the runtime databases. The optional live frame gate is /tube-bridge-selftest frame.

Remove the package with:

bash
pi remove git:github.com/TheWhiteWater/[email protected]

If a desktop client cannot find uvx, replace "uvx" with the absolute path returned by which uvx on macOS/Linux or where.exe uvx on Windows.

Try the complete research workflow

Ask your agent:

Search YouTube for recent videos about local-first AI agents. Read the transcript of the strongest result, add it to a corpus named local-agents, find the section discussing memory, return the timestamped source link, and extract a frame from that moment.

The agent can complete that request with this tool sequence:

text
youtube_search(query="local-first AI agents", order="date")youtube_get_transcript(url="https://www.youtube.com/watch?v=VIDEO_ID", with_timestamps=true)corpus_create(corpus_id="local-agents", label="Local-first AI Agents")corpus_add(corpus_id="local-agents", url="https://www.youtube.com/watch?v=VIDEO_ID")corpus_search(corpus_id="local-agents", query="memory architecture")youtube_get_frame(url="https://www.youtube.com/watch?v=VIDEO_ID", timestamp_ms=FOUND_TIME_MS)

Add more videos with corpus_add, then use corpus_search to search across all of their transcripts at once.

Tools

ToolYouTube API keyWhat it does
youtube_searchOptionalSearch videos with date, channel, duration, and ordering filters
youtube_get_video_infoOptionalGet title, duration, views, channel, description, and tags
youtube_get_trendingOptionalGet currently trending videos
youtube_get_channel_videosNoGet recent uploads from a channel URL or @handle
youtube_get_playlistNoGet videos from a playlist
youtube_get_transcriptNoGet a transcript, optionally with [MM:SS] timestamps
youtube_get_frameNoReturn one ephemeral JPEG near an integer-millisecond timestamp
youtube_get_available_languagesNoList manual and auto-generated subtitle tracks
youtube_get_commentsRequiredGet top-level comments with likes and reply counts
youtube_search_channelsRequiredSearch channels and filter by subscriber count
youtube_get_channel_infoRequiredGet channel statistics, country, and keywords
corpus_createNoCreate a named local corpus
corpus_addNoFetch, chunk, and locally embed a video transcript
corpus_searchNoSemantically search a corpus with timestamped results
corpus_listNoList corpora with video and chunk counts
corpus_deleteNoPermanently delete a corpus and its vectors
tube_bridge_helpNoRead runtime documentation and known limitations

No means no YouTube Data API key is needed; network access to YouTube may still be required. Search, video information, and trending work without a key through yt-dlp and upgrade to Data API v3 when a key is configured.

Optional YouTube Data API key

A YouTube Data API v3 key unlocks comments, channel search, and channel details. It also improves search, video information, and trending reliability.

Create a key in Google Cloud Console, enable YouTube Data API v3, and expose it to the process launching tube-bridge:

bash
export YOUTUBE_API_KEY="your-key"

Keep keys out of committed MCP configuration files. Use your client's secret/environment support where available.

Local semantic corpus

Corpus storage and embedding inference are local to the machine running tube-bridge.

  • Storage: SQLite plus sqlite-vec in ~/.tube_bridge/corpus.db
  • Embeddings: BGE-small-en-v1.5 through fastembed
  • Chunking: 80-second windows with 20-second overlap
  • Ranking: overlap deduplication and source-aware per-video limits
  • Results: similarity score, time span, video title, canonical URL, and timestamp URL

Set TUBE_BRIDGE_CACHE to move both corpus and cache databases:

bash
export TUBE_BRIDGE_CACHE="/path/to/tube-bridge-data"

The embedding model may be downloaded on first use. After the assets are available, embedding inference does not require an external model API.

Frame extraction

youtube_get_frame requires ffmpeg on PATH; the Docker image already includes it.

Each call downloads a short temporary section around timestamp_ms, returns one bounded JPEG as MCP ImageContent, and removes the temporary media before returning. It does not create a frame or clip library.

Other ways to run

Persistent PyPI installation

bash
pip install tube-bridge
tube-bridge          # stdiotube-bridge --http   # Streamable HTTP on port 8080

Docker

bash
docker run --rm -p 8080:8080 ghcr.io/thewhitewater/tube-bridge:latest

The health endpoint is http://localhost:8080/health; the Streamable HTTP endpoint is http://localhost:8080/mcp.

The image is published for linux/amd64 and linux/arm64; Docker pulls the right one automatically. On a Raspberry Pi, use a 64-bit OS: 32-bit Raspberry Pi OS is not supported. Every release runs the image on native arm64 CI runners, but it has not been tested on physical Raspberry Pi hardware yet.

Official MCP Registry

Registry name: io.github.TheWhiteWater/tube-bridge

Registry-aware clients can install the PyPI distribution with uvx and launch the stdio server without a hosted intermediary.

Remote HTTP configuration

For an HTTP instance you operate:

json
{  "mcpServers": {    "tube-bridge": {      "type": "http",      "url": "https://your-host.example/mcp"    }  }}

Protect remote MCP routes by setting a server-side Bearer key:

bash
export TUBE_BRIDGE_AUTH_KEY="choose-a-long-random-value"tube-bridge --http

Then configure a header-capable client:

json
{  "mcpServers": {    "tube-bridge": {      "type": "http",      "url": "https://your-host.example/mcp",      "headers": {        "Authorization": "Bearer <your-key>"      }    }  }}

/health remains public. /mcp, /sse, and /messages require the Bearer key when TUBE_BRIDGE_AUTH_KEY is set. Legacy SSE is available at /sse for clients that still need it.

Environment variables

VariableRequiredPurpose
YOUTUBE_API_KEYNoEnables the 3 API-only tools and upgrades supported discovery calls
TUBE_BRIDGE_PROXYNoRoutes yt-dlp and transcript requests through an HTTP(S) or SOCKS proxy
TUBE_BRIDGE_CACHENoChanges the directory containing cache.db and corpus.db
TUBE_BRIDGE_AUTH_KEYNoProtects self-hosted HTTP MCP routes with a static Bearer token

How it works

text
MCP client   │   ├── discovery and metadata ── Data API v3 (when configured)   │                          └─ yt-dlp fallback   ├── transcripts ───────────── youtube-transcript-api   ├── timestamped frames ────── yt-dlp + ffmpeg → ephemeral JPEG   └── semantic corpus ───────── SQLite + sqlite-vec + local fastembed
  • stdio is recommended for local clients;
  • Streamable HTTP is available at /mcp for self-hosted remote use;
  • successful fallback responses keep their normal schemas;
  • controlled failures use typed MCP errors with stable code, source, and retryable fields;
  • cache and corpus databases are separate and remain operator-owned.

Agent Plugin preview

GitHub Releases include tube-bridge-agent-plugin-<version>.zip, containing:

  • the local stdio MCP configuration;
  • the tube-bridge-research skill;
  • research templates and source-evaluation guidance.

Agent Plugins v1 does not standardize dependency installation. Install Python 3.12+, ffmpeg, and the package dependencies in the environment used by the plugin host. The bundle contains no credentials.

Known limitations

  • YouTube can restrict anonymous yt-dlp and transcript requests, especially from cloud-hosting IP ranges.
  • A Data API key improves discovery and metadata reliability but does not replace transcript access.
  • Initial local embedding-model setup may require network access and additional disk space.
  • tube-bridge is self-hosted software; it does not provide accounts, public hosted access, managed storage, or an SLA.

If YouTube blocks requests from your network, set TUBE_BRIDGE_PROXY. Keep proxy credentials in environment variables rather than committed configuration.

Development

bash
git clone https://github.com/TheWhiteWater/tube-bridge.gitcd tube-bridgepython3 -m venv .venvsource .venv/bin/activatepip install -r requirements-release.txtpip install --no-deps -e .pip install pytest pytest-asyncio pytest-mock build twinepython -m pytest tests -q

python test_tools.py is an optional live YouTube smoke test. The deterministic test suite does not call YouTube.

See CONTRIBUTING.md to contribute. Security reports should follow SECURITY.md.

License

MIT — see LICENSE.

來源:README.md,提交 83ffec0

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:軟體包安裝失敗。

版本歷史

2
  1. v1.1.7最新Nov 4, 2026
  2. v1.1.6Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分