tube-bridge
Self-hosted YouTube MCP server for AI agents.
Search YouTube, inspect videos and channels, fetch transcripts and comments, extract timestamped frames, and build local semantic-search corpora.
Quick start
PyPI
pip install tube-bridge
tube-bridge # stdio transport
tube-bridge --http # HTTP transport on port 8080
Docker
docker run --rm -p 8080:8080 ghcr.io/thewhitewater/tube-bridge:latest
The HTTP MCP endpoint is http://localhost:8080/mcp.
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.
MCP client configuration
Local stdio
{
"mcpServers": {
"tube-bridge": {
"command": "tube-bridge"
}
}
}
If the executable is not on your client's PATH, use the full path returned by which tube-bridge.
Streamable HTTP
{
"mcpServers": {
"tube-bridge": {
"type": "http",
"url": "http://localhost:8080/mcp"
}
}
}
Protected HTTP
Set a server-side Bearer key:
export TUBE_BRIDGE_AUTH_KEY="choose-a-long-random-value"
tube-bridge --http
Then configure the client header:
{
"mcpServers": {
"tube-bridge": {
"type": "http",
"url": "https://your-host.example/mcp",
"headers": {
"Authorization": "Bearer choose-a-long-random-value"
}
}
}
}
/health remains public. /mcp, /sse, and /messages require the Bearer key when TUBE_BRIDGE_AUTH_KEY is set.
Tools
| Tool | YouTube API key | Description |
|---|---|---|
youtube_search |
Optional | Search videos; Data API v3 with yt-dlp fallback |
youtube_get_video_info |
Optional | Video metadata, description, tags, views, and channel |
youtube_get_trending |
Optional | Trending videos |
youtube_get_channel_videos |
No | Recent channel uploads |
youtube_get_playlist |
No | Playlist videos |
youtube_get_transcript |
No | Transcript with optional timestamps |
youtube_get_frame |
No | One ephemeral JPEG near a timestamp |
youtube_get_available_languages |
No | Available manual and generated subtitle tracks |
youtube_get_comments |
Required | Top-level comments |
youtube_search_channels |
Required | Search channels with subscriber filters |
youtube_get_channel_info |
Required | Channel statistics and metadata |
corpus_create |
No | Create a local semantic-search corpus |
corpus_add |
No | Fetch, chunk, and embed a transcript |
corpus_search |
No | Search a corpus semantically |
corpus_list |
No | List local corpora |
corpus_delete |
No | Delete a corpus and its vectors |
tube_bridge_help |
No | Runtime tool and setup documentation |
Fourteen tools can run without a YouTube Data API key. Comments, channel search, and channel details require one.
Optional YouTube Data API key
Create a YouTube Data API v3 key in Google Cloud Console, then set:
export YOUTUBE_API_KEY="your-key"
With a key, search, video information, and trending use Data API v3 first. Supported operations fall back to yt-dlp when the key is absent or quota is exhausted.
Local semantic corpus
Corpus data and embeddings stay on the machine running tube-bridge.
corpus_create("ai-agents", "AI Agents Research")
corpus_add("ai-agents", "https://www.youtube.com/watch?v=VIDEO_ID")
corpus_search("ai-agents", "memory systems")
corpus_list()
corpus_delete("ai-agents")
- storage: SQLite with sqlite-vec;
- embeddings: BGE-small-en-v1.5 through fastembed;
- chunking: 80-second windows with 20-second overlap;
- results: similarity score, source time span, video title, and timestamp URL;
- default data directory:
~/.tube_bridge.
Set TUBE_BRIDGE_CACHE to use another directory:
export TUBE_BRIDGE_CACHE="/path/to/tube-bridge-data"
The embedding model may be downloaded on first use.
Frame extraction
youtube_get_frame needs ffmpeg on PATH. The Docker image includes it; source and PyPI users install it with their OS package manager.
Each call downloads only a short temporary section, returns one bounded JPEG, and removes the temporary media before returning.
Proxy support
If YouTube blocks requests from your network, configure an HTTP(S) proxy:
export TUBE_BRIDGE_PROXY="http://proxy.example:8080"
The value is used by yt-dlp and transcript requests. Keep proxy credentials in environment variables, never in MCP configuration committed to source control.
Transports
- stdio — recommended for local MCP clients;
/mcp— Streamable HTTP;/sseand/messages— legacy SSE compatibility;/health— process health and tool count.
Agent Plugin preview
GitHub Releases also include tube-bridge-agent-plugin-<version>.zip. It bundles:
- the local stdio MCP configuration;
- the
tube-bridge-researchskill; - research templates and source-evaluation guidance.
The plugin format does not install system or Python dependencies. Install Python 3.12+, ffmpeg, and tube-bridge dependencies in the environment used by your plugin host.
Development
git clone https://github.com/TheWhiteWater/tube-bridge.git
cd tube-bridge
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements-release.txt
pip install --no-deps -e .
pip install pytest pytest-asyncio pytest-mock build twine
python -m pytest tests -q
Optional live smoke test:
python test_tools.py
The deterministic test suite does not call YouTube. The live smoke test does.
Known limitations
- YouTube can restrict anonymous yt-dlp and transcript requests, especially from cloud-hosting IP ranges.
- A Data API key improves search and metadata reliability but does not replace transcript access.
- Initial local embedding-model setup may require network access and additional disk space.
- This project is self-hosted software; it does not provide accounts, hosted storage, or a managed endpoint.
Contributing
See CONTRIBUTING.md. Security reports should follow SECURITY.md.
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tube_bridge-1.1.2.tar.gz.
File metadata
- Download URL: tube_bridge-1.1.2.tar.gz
- Upload date:
- Size: 84.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4053edc5a52a7f6022ba951cf172bebb380ac949d2ca966141ab778a874b053b
|
|
| MD5 |
93a1ddcd60933beaf05fb8eceb2db739
|
|
| BLAKE2b-256 |
5e984b2f5e311b35c5d99d61da7a02ee369a0d05f86e6738f8a72c7cb99db0bc
|
File details
Details for the file tube_bridge-1.1.2-py3-none-any.whl.
File metadata
- Download URL: tube_bridge-1.1.2-py3-none-any.whl
- Upload date:
- Size: 30.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5701cb7310f40e9ebd79819bce8ffb5bf32b932212cdc0f137417a1ae39a45db
|
|
| MD5 |
01c52580aee43003ad633903b5600090
|
|
| BLAKE2b-256 |
afc7538148660a78aa845b57483f7ce0233ed29a020b5b1dd2508a52e4e86a74
|