videolens-mcp 0.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- videolens_mcp-0.3.1/.github/ISSUE_TEMPLATE/bug_report.md +16 -0
- videolens_mcp-0.3.1/.github/workflows/ci.yml +27 -0
- videolens_mcp-0.3.1/.github/workflows/release.yml +40 -0
- videolens_mcp-0.3.1/.gitignore +16 -0
- videolens_mcp-0.3.1/CHANGELOG.md +53 -0
- videolens_mcp-0.3.1/CONTRIBUTING.md +24 -0
- videolens_mcp-0.3.1/LICENSE +21 -0
- videolens_mcp-0.3.1/PKG-INFO +220 -0
- videolens_mcp-0.3.1/README.md +186 -0
- videolens_mcp-0.3.1/SECURITY.md +15 -0
- videolens_mcp-0.3.1/assets/banner.svg +46 -0
- videolens_mcp-0.3.1/pyproject.toml +52 -0
- videolens_mcp-0.3.1/src/videolens/__init__.py +2 -0
- videolens_mcp-0.3.1/src/videolens/__main__.py +3 -0
- videolens_mcp-0.3.1/src/videolens/server.py +928 -0
- videolens_mcp-0.3.1/tests/test_offline.py +120 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: A tool fails or returns something wrong
|
|
4
|
+
labels: bug
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**Tool and call**
|
|
8
|
+
Which tool, with which arguments (use a public video URL).
|
|
9
|
+
|
|
10
|
+
**What happened**
|
|
11
|
+
Error message or wrong output.
|
|
12
|
+
|
|
13
|
+
**`doctor` output**
|
|
14
|
+
Paste the result of the `doctor` tool (versions, optional features, connectivity).
|
|
15
|
+
|
|
16
|
+
**Do not paste** cookies, tokens, personal paths or private video links.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: ${{ matrix.python-version }}
|
|
20
|
+
- name: Install
|
|
21
|
+
run: pip install -e ".[dev]"
|
|
22
|
+
- name: Lint
|
|
23
|
+
run: ruff check src tests
|
|
24
|
+
- name: Offline tests
|
|
25
|
+
run: pytest -q
|
|
26
|
+
- name: Server imports and registers its tools
|
|
27
|
+
run: python -c "import videolens.server as s; print('ok', s.mcp.name)"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Runs when a GitHub release is published. Uses PyPI "Trusted Publishing" (OIDC),
|
|
4
|
+
# so no API token is stored anywhere. Setup: PyPI > Publishing > add a pending publisher
|
|
5
|
+
# for project videolens-mcp, owner TheRookies, repo videolens, workflow release.yml, environment pypi.
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
release:
|
|
9
|
+
types: [published]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
- name: Build sdist and wheel
|
|
20
|
+
run: |
|
|
21
|
+
python -m pip install build twine
|
|
22
|
+
python -m build
|
|
23
|
+
twine check dist/*
|
|
24
|
+
- uses: actions/upload-artifact@v4
|
|
25
|
+
with:
|
|
26
|
+
name: dist
|
|
27
|
+
path: dist/
|
|
28
|
+
|
|
29
|
+
publish:
|
|
30
|
+
needs: build
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
environment: pypi
|
|
33
|
+
permissions:
|
|
34
|
+
id-token: write
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/download-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: dist
|
|
39
|
+
path: dist/
|
|
40
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
- The PyPI distribution is named `videolens-mcp` (PyPI rejects `videolens`: `video-lens` already exists). The import package and the `videolens` command are unchanged; `videolens-mcp` is added as a command alias so `uvx videolens-mcp` works.
|
|
6
|
+
|
|
7
|
+
## 0.3.0
|
|
8
|
+
|
|
9
|
+
Renamed from TubeLens to **VideoLens**: video research beyond YouTube.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- Verified support for **TED** and the **Internet Archive** (info, frames, OCR, Whisper; TED subtitles in many languages).
|
|
13
|
+
- WebVTT, SRT and HLS-playlist subtitle parsing, not only YouTube's format.
|
|
14
|
+
- `VIDEOLENS_EXTRA_HOSTS` to opt in other yt-dlp sites (the old `TUBELENS_EXTRA_HOSTS` still works).
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- `lang="auto"` picked an arbitrary language on videos with dozens of manual subtitles; now prefers English, then the first available.
|
|
18
|
+
- Vimeo and other login-only sites now fail with a clear message instead of a raw error.
|
|
19
|
+
|
|
20
|
+
### Notes
|
|
21
|
+
- Vimeo does not work (it requires a login, which VideoLens never uses).
|
|
22
|
+
|
|
23
|
+
## 0.2.0
|
|
24
|
+
|
|
25
|
+
Renamed to **VideoLens**, packaged for `pip`, and hardened after a full audit.
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- `youtube_research`: multi-search topic research with ranking and per-video briefs.
|
|
29
|
+
- `find_in_video`: find where a term is said, optionally with the frame.
|
|
30
|
+
- `ocr_frames`: read on-screen text locally.
|
|
31
|
+
- `transcribe_video`: local Whisper for videos without captions.
|
|
32
|
+
- `batch_transcripts`, `channel_stats`, `doctor`.
|
|
33
|
+
- `video_comments(query=...)` keyword filter; `youtube_search` filters (`sort=date`, views, length).
|
|
34
|
+
- `watch_video(mode="scenes")`: keeps the most distinct moments.
|
|
35
|
+
- `lang="auto"`: uses the video's spoken language. `@handle` and bare video IDs accepted.
|
|
36
|
+
- 10-minute cache; friendly error messages; offline test suite and CI.
|
|
37
|
+
|
|
38
|
+
### Fixed (found by auditing the 0.1 tools against real videos)
|
|
39
|
+
- `sort="date"` search crashed (yt-dlp has no date search key). Now uses YouTube's own sort filter.
|
|
40
|
+
- Scene detection read the whole stream and timed out after 180 s. Replaced by sampling plus image difference; frame grabs now run 4 in parallel.
|
|
41
|
+
- "Video total" in comments showed the number fetched, not the real total.
|
|
42
|
+
- Default language `en` returned nothing for non-English videos. Now auto-detected.
|
|
43
|
+
- Whisper crashed on current PyAV (`metadata_errors`). Audio is now decoded directly.
|
|
44
|
+
- Raw yt-dlp tracebacks replaced by short, actionable messages (private, age-restricted, rate-limited, unavailable).
|
|
45
|
+
- Channel cadence was always missing. Now estimated from the newest uploads.
|
|
46
|
+
|
|
47
|
+
### Security
|
|
48
|
+
- All tools accept only YouTube URLs by default; ffmpeg runs with a protocol whitelist.
|
|
49
|
+
- Removed the Reddit tool: Reddit blocks anonymous API access and the only workaround is spoofing a browser.
|
|
50
|
+
|
|
51
|
+
## 0.1.0
|
|
52
|
+
|
|
53
|
+
First release: video info, comments, transcript, search, channel listing and frame-based watching.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for helping. VideoLens is small on purpose.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
python -m venv .venv
|
|
9
|
+
.venv/bin/pip install -e ".[all,dev]" # Windows: .venv\Scripts\pip
|
|
10
|
+
pytest
|
|
11
|
+
ruff check src tests
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Guidelines
|
|
15
|
+
|
|
16
|
+
- Keep outputs **token-lean**. Every new tool needs sensible default limits and a way to ask for more.
|
|
17
|
+
- Never loosen the URL allow-list or ffmpeg protocol whitelist without a clear, documented opt-in.
|
|
18
|
+
- No secrets, tokens, cookies or personal paths in code, tests, fixtures or issues.
|
|
19
|
+
- Add an offline test for pure logic (`tests/test_offline.py`). Network behaviour is checked by hand against real videos; say which in the PR.
|
|
20
|
+
- No tool that logs in, posts, likes or otherwise acts on an account.
|
|
21
|
+
|
|
22
|
+
## Bug reports
|
|
23
|
+
|
|
24
|
+
Run the `doctor` tool and paste its output, plus the exact call and the error message.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TheRookies
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: videolens-mcp
|
|
3
|
+
Version: 0.3.1
|
|
4
|
+
Summary: Give your AI eyes on video: YouTube-first MCP server for research, comments, transcripts, frames, OCR and local Whisper. No API key.
|
|
5
|
+
Project-URL: Homepage, https://github.com/TheRookies/videolens
|
|
6
|
+
Project-URL: Issues, https://github.com/TheRookies/videolens/issues
|
|
7
|
+
Author: TheRookies
|
|
8
|
+
License: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: ai-agents,claude,mcp,model-context-protocol,transcript,video-understanding,youtube,yt-dlp
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Multimedia :: Video
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Requires-Dist: imageio-ffmpeg
|
|
18
|
+
Requires-Dist: mcp<2,>=1.0
|
|
19
|
+
Requires-Dist: pillow
|
|
20
|
+
Requires-Dist: yt-dlp
|
|
21
|
+
Provides-Extra: all
|
|
22
|
+
Requires-Dist: faster-whisper; extra == 'all'
|
|
23
|
+
Requires-Dist: numpy; extra == 'all'
|
|
24
|
+
Requires-Dist: rapidocr-onnxruntime; extra == 'all'
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
27
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
28
|
+
Provides-Extra: ocr
|
|
29
|
+
Requires-Dist: rapidocr-onnxruntime; extra == 'ocr'
|
|
30
|
+
Provides-Extra: whisper
|
|
31
|
+
Requires-Dist: faster-whisper; extra == 'whisper'
|
|
32
|
+
Requires-Dist: numpy; extra == 'whisper'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img src="https://raw.githubusercontent.com/TheRookies/videolens/main/assets/banner.svg" alt="VideoLens: give your AI eyes on video" width="100%">
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<a href="https://github.com/TheRookies/videolens/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/TheRookies/videolens/actions/workflows/ci.yml/badge.svg"></a>
|
|
41
|
+
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue.svg">
|
|
42
|
+
<img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-blue.svg">
|
|
43
|
+
<img alt="MCP server" src="https://img.shields.io/badge/MCP-server-8A2BE2.svg">
|
|
44
|
+
<img alt="No API key" src="https://img.shields.io/badge/API%20key-not%20needed-brightgreen.svg">
|
|
45
|
+
</p>
|
|
46
|
+
|
|
47
|
+
**Your AI can read your docs. Now it can watch the video.**
|
|
48
|
+
|
|
49
|
+
VideoLens is an [MCP](https://modelcontextprotocol.io) server that lets Claude Code, Claude Desktop, Cursor or any MCP client *research* video: search and rank videos, read comments, pull transcripts, look at frames, read the text on screen, and even transcribe videos that have no captions. **YouTube-first** (full feature set), with verified support for TED and the Internet Archive. No Google API key, no quota, no account.
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
You: Research "local-first note apps". Find the 3 best recent videos, tell me what
|
|
53
|
+
people complain about in the comments, and show me what the demo at the end
|
|
54
|
+
of the top video actually looks like.
|
|
55
|
+
|
|
56
|
+
Claude: [youtube_research] -> ranks 24 candidates from 3 searches, briefs the top 3
|
|
57
|
+
[video_comments query="slow,sync,bug,refund"] -> 11 matching complaints
|
|
58
|
+
[watch_video start="11:40" mode="scenes"] -> 6 frames + transcript
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Why VideoLens
|
|
62
|
+
|
|
63
|
+
Most YouTube MCP servers fetch a transcript and stop. That misses what makes a video a video.
|
|
64
|
+
|
|
65
|
+
| | Typical transcript-only server | **VideoLens** |
|
|
66
|
+
|---|:---:|:---:|
|
|
67
|
+
| Transcript | yes | yes (auto language, time ranges, merged to save tokens) |
|
|
68
|
+
| Comments, filtered by keyword | rarely | **yes** |
|
|
69
|
+
| Look at the video (frames) | no | **yes, even or "most distinct moments"** |
|
|
70
|
+
| Read text on screen (slides, code) | no | **yes, local OCR, no images sent** |
|
|
71
|
+
| Videos without captions | no | **yes, local Whisper** |
|
|
72
|
+
| Multi-search topic research with ranking | no | **yes** |
|
|
73
|
+
| Find *where* something is said, with the frame | no | **yes** |
|
|
74
|
+
| Needs an API key or quota | often | **never** |
|
|
75
|
+
| Locked to an allow-list of hosts (prompt-injection safe) | rarely | **yes** |
|
|
76
|
+
|
|
77
|
+
## Supported sites
|
|
78
|
+
|
|
79
|
+
Verified by hand against real videos. "Everything" means all tools below.
|
|
80
|
+
|
|
81
|
+
| Site | What works | Notes |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| **YouTube** | Everything | Search, research, comments, channels, captions, frames, OCR, Whisper |
|
|
84
|
+
| **TED** | Info, subtitles (many languages), `find_in_video`, frames, OCR, Whisper | No search or comments |
|
|
85
|
+
| **Internet Archive** | Info, frames, OCR, Whisper | Usually no captions, so use `transcribe_video` |
|
|
86
|
+
| Other sites yt-dlp can read without login | Untested | Opt in with `VIDEOLENS_EXTRA_HOSTS="www.dailymotion.com"`; no guarantees |
|
|
87
|
+
| Vimeo and anything that needs a login | **Not supported** | VideoLens never logs in |
|
|
88
|
+
|
|
89
|
+
Found another site that works (or breaks)? [Open an issue](https://github.com/TheRookies/videolens/issues) with the `doctor` output.
|
|
90
|
+
|
|
91
|
+
## Tools
|
|
92
|
+
|
|
93
|
+
| Tool | Use it to |
|
|
94
|
+
|------|-----------|
|
|
95
|
+
| `youtube_research` | Research a topic: several searches, merged and ranked, a compact brief per video (stats, chapters, transcript excerpt, top terms, top comments) |
|
|
96
|
+
| `youtube_search` | Search with `sort=date`, `min_views`, and length filters |
|
|
97
|
+
| `video_info` | Title, channel, stats, chapters, description, caption languages |
|
|
98
|
+
| `video_transcript` | Timestamped transcript, `lang="auto"` picks the spoken language, `start`/`end` for one part |
|
|
99
|
+
| `batch_transcripts` | Several videos' transcripts in one call |
|
|
100
|
+
| `find_in_video` | Find where a term is said; optionally return the frame at each hit |
|
|
101
|
+
| `video_comments` | Top/new comments, replies, and `query="broken,refund"` to filter by keyword |
|
|
102
|
+
| `watch_video` | Frames + transcript for a range. `mode="scenes"` keeps the moments that differ most |
|
|
103
|
+
| `ocr_frames` | Read on-screen text (slides, code, UI) as plain text, cheap in tokens |
|
|
104
|
+
| `transcribe_video` | Local Whisper for videos without captions |
|
|
105
|
+
| `channel_videos` / `channel_stats` | Recent uploads; views, length and upload cadence. Accepts `@handle` |
|
|
106
|
+
| `doctor` | Self-check: versions, optional features, connectivity |
|
|
107
|
+
|
|
108
|
+
## Install
|
|
109
|
+
|
|
110
|
+
Requires Python 3.10+. ffmpeg is bundled, nothing else to install.
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pip install "videolens-mcp[all] @ git+https://github.com/TheRookies/videolens.git"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`[all]` adds local Whisper and OCR. Drop it (`pip install "videolens-mcp @ git+..."`) for the light install; those two tools then say what to install.
|
|
117
|
+
|
|
118
|
+
**Claude Code**
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
claude mcp add --scope user videolens --env PYTHONUTF8=1 -- videolens
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Claude Desktop / Cursor / any MCP client**
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"videolens": {
|
|
130
|
+
"command": "videolens",
|
|
131
|
+
"env": { "PYTHONUTF8": "1" }
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
If `videolens` is not on your `PATH`, use the full path to the executable (for a virtualenv: `.venv/bin/videolens`, or `.venv\Scripts\videolens.exe` on Windows). Then ask your assistant to run the `doctor` tool.
|
|
138
|
+
|
|
139
|
+
## Example prompts
|
|
140
|
+
|
|
141
|
+
- "Watch this video and tell me what the demo shows: `<url>`"
|
|
142
|
+
- "Research *rust vs go for CLIs*. Which videos are worth my time and why?"
|
|
143
|
+
- "In this 2-hour talk, where do they discuss pricing? Show me the slide."
|
|
144
|
+
- "Read the comments and list every bug people report. Keywords: crash, broke, error."
|
|
145
|
+
- "This video has no captions. Transcribe minutes 3 to 10 in Turkish."
|
|
146
|
+
- "How often does `@somechannel` upload and what are their best videos?"
|
|
147
|
+
|
|
148
|
+
## Token budget
|
|
149
|
+
|
|
150
|
+
Defaults are tuned so a call does not flood your context. Raise limits only when you need to.
|
|
151
|
+
|
|
152
|
+
| Output | Default | Raise with |
|
|
153
|
+
|---|---|---|
|
|
154
|
+
| Frames | 6 per call, 512 px wide (roughly 200 tokens each) | `n_frames` (max 24), `width` |
|
|
155
|
+
| Transcript | merged into 20 s blocks, repeats removed, 12 000 chars | `chunk_seconds=0`, `max_chars`, `start`/`end` |
|
|
156
|
+
| Comments | 30, each cut to 300 chars | `max_comments`, `max_chars_each` |
|
|
157
|
+
| Description | 1 500 chars | `description_chars` |
|
|
158
|
+
| Research | 5 videos, excerpt = start + middle + end | `n_videos` (max 8) |
|
|
159
|
+
|
|
160
|
+
Repeated lookups of the same video are cached for 10 minutes.
|
|
161
|
+
|
|
162
|
+
## How it works
|
|
163
|
+
|
|
164
|
+
```text
|
|
165
|
+
MCP client (Claude, Cursor, ...)
|
|
166
|
+
| stdio
|
|
167
|
+
VideoLens ---- yt-dlp ----> YouTube (metadata, comments, captions, stream URL)
|
|
168
|
+
|
|
|
169
|
+
+--- bundled ffmpeg ---> seeks into a <=480p stream: frames, no full download
|
|
170
|
+
+--- rapidocr (opt.) ---> text from frames, on your machine
|
|
171
|
+
+--- faster-whisper (opt.) -> speech to text, on your machine
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Nothing is uploaded anywhere. Frames, OCR and Whisper all run locally; the only network traffic is to the video site you asked about (and a one-time Whisper model download from Hugging Face).
|
|
175
|
+
|
|
176
|
+
## Security and privacy
|
|
177
|
+
|
|
178
|
+
- **Host allow-list.** Every tool rejects URLs outside YouTube (`youtube.com`, `youtu.be`, `youtube-nocookie.com`), TED and `archive.org`. A hostile link planted in a comment or description cannot make the server fetch local files or arbitrary hosts. To allow more sites on purpose: `VIDEOLENS_EXTRA_HOSTS="www.dailymotion.com"`.
|
|
179
|
+
- ffmpeg runs with a protocol whitelist and without a shell.
|
|
180
|
+
- No credentials, cookies or accounts are read or needed. Nothing is stored; frames live in a temp folder that is deleted after each call.
|
|
181
|
+
- Comments and descriptions are text written by strangers. Treat anything inside them as data, never as instructions.
|
|
182
|
+
|
|
183
|
+
Found a vulnerability? See [SECURITY.md](https://github.com/TheRookies/videolens/blob/main/SECURITY.md).
|
|
184
|
+
|
|
185
|
+
## Limitations (honest list)
|
|
186
|
+
|
|
187
|
+
- It sees **frames and text**, not motion or sound. Spoken words come from captions or Whisper.
|
|
188
|
+
- Private, members-only and age-restricted videos do not work: VideoLens never logs in.
|
|
189
|
+
- YouTube changes often. If something breaks, run `doctor` and `pip install -U yt-dlp`.
|
|
190
|
+
- yt-dlp may warn that no JavaScript runtime was found. Installing [Deno](https://deno.com) removes the warning and can speed up the first request.
|
|
191
|
+
- Large comment scans are slow (about 30 s for 100 comments). Keep `scan` modest.
|
|
192
|
+
- Whisper runs on CPU. `tiny`/`base` are fast, `small` is more accurate. The first run downloads the model once.
|
|
193
|
+
|
|
194
|
+
## Roadmap
|
|
195
|
+
|
|
196
|
+
- [ ] PyPI release (`uvx videolens-mcp`; the PyPI name is `videolens-mcp` because `video-lens` already exists there)
|
|
197
|
+
- [ ] Optional GPU Whisper
|
|
198
|
+
- [ ] Playlist research mode
|
|
199
|
+
- [ ] Per-speaker transcripts
|
|
200
|
+
|
|
201
|
+
Ideas and bug reports are welcome: [open an issue](https://github.com/TheRookies/videolens/issues).
|
|
202
|
+
|
|
203
|
+
## Development
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
git clone https://github.com/TheRookies/videolens.git && cd videolens
|
|
207
|
+
python -m venv .venv && .venv/bin/pip install -e ".[all,dev]" # Windows: .venv\Scripts\pip
|
|
208
|
+
pytest # offline unit tests, no network
|
|
209
|
+
ruff check src tests
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
See [CONTRIBUTING.md](https://github.com/TheRookies/videolens/blob/main/CONTRIBUTING.md) and the [CHANGELOG](https://github.com/TheRookies/videolens/blob/main/CHANGELOG.md).
|
|
213
|
+
|
|
214
|
+
## Disclaimer
|
|
215
|
+
|
|
216
|
+
VideoLens is an independent open-source project. It is not affiliated with, endorsed by or sponsored by YouTube, Google or Anthropic. Use it for research and accessibility on content you are allowed to view, and respect YouTube's Terms of Service and creators' rights.
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
[MIT](https://github.com/TheRookies/videolens/blob/main/LICENSE)
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/TheRookies/videolens/main/assets/banner.svg" alt="VideoLens: give your AI eyes on video" width="100%">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<a href="https://github.com/TheRookies/videolens/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/TheRookies/videolens/actions/workflows/ci.yml/badge.svg"></a>
|
|
7
|
+
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-blue.svg">
|
|
8
|
+
<img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-blue.svg">
|
|
9
|
+
<img alt="MCP server" src="https://img.shields.io/badge/MCP-server-8A2BE2.svg">
|
|
10
|
+
<img alt="No API key" src="https://img.shields.io/badge/API%20key-not%20needed-brightgreen.svg">
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
**Your AI can read your docs. Now it can watch the video.**
|
|
14
|
+
|
|
15
|
+
VideoLens is an [MCP](https://modelcontextprotocol.io) server that lets Claude Code, Claude Desktop, Cursor or any MCP client *research* video: search and rank videos, read comments, pull transcripts, look at frames, read the text on screen, and even transcribe videos that have no captions. **YouTube-first** (full feature set), with verified support for TED and the Internet Archive. No Google API key, no quota, no account.
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
You: Research "local-first note apps". Find the 3 best recent videos, tell me what
|
|
19
|
+
people complain about in the comments, and show me what the demo at the end
|
|
20
|
+
of the top video actually looks like.
|
|
21
|
+
|
|
22
|
+
Claude: [youtube_research] -> ranks 24 candidates from 3 searches, briefs the top 3
|
|
23
|
+
[video_comments query="slow,sync,bug,refund"] -> 11 matching complaints
|
|
24
|
+
[watch_video start="11:40" mode="scenes"] -> 6 frames + transcript
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Why VideoLens
|
|
28
|
+
|
|
29
|
+
Most YouTube MCP servers fetch a transcript and stop. That misses what makes a video a video.
|
|
30
|
+
|
|
31
|
+
| | Typical transcript-only server | **VideoLens** |
|
|
32
|
+
|---|:---:|:---:|
|
|
33
|
+
| Transcript | yes | yes (auto language, time ranges, merged to save tokens) |
|
|
34
|
+
| Comments, filtered by keyword | rarely | **yes** |
|
|
35
|
+
| Look at the video (frames) | no | **yes, even or "most distinct moments"** |
|
|
36
|
+
| Read text on screen (slides, code) | no | **yes, local OCR, no images sent** |
|
|
37
|
+
| Videos without captions | no | **yes, local Whisper** |
|
|
38
|
+
| Multi-search topic research with ranking | no | **yes** |
|
|
39
|
+
| Find *where* something is said, with the frame | no | **yes** |
|
|
40
|
+
| Needs an API key or quota | often | **never** |
|
|
41
|
+
| Locked to an allow-list of hosts (prompt-injection safe) | rarely | **yes** |
|
|
42
|
+
|
|
43
|
+
## Supported sites
|
|
44
|
+
|
|
45
|
+
Verified by hand against real videos. "Everything" means all tools below.
|
|
46
|
+
|
|
47
|
+
| Site | What works | Notes |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| **YouTube** | Everything | Search, research, comments, channels, captions, frames, OCR, Whisper |
|
|
50
|
+
| **TED** | Info, subtitles (many languages), `find_in_video`, frames, OCR, Whisper | No search or comments |
|
|
51
|
+
| **Internet Archive** | Info, frames, OCR, Whisper | Usually no captions, so use `transcribe_video` |
|
|
52
|
+
| Other sites yt-dlp can read without login | Untested | Opt in with `VIDEOLENS_EXTRA_HOSTS="www.dailymotion.com"`; no guarantees |
|
|
53
|
+
| Vimeo and anything that needs a login | **Not supported** | VideoLens never logs in |
|
|
54
|
+
|
|
55
|
+
Found another site that works (or breaks)? [Open an issue](https://github.com/TheRookies/videolens/issues) with the `doctor` output.
|
|
56
|
+
|
|
57
|
+
## Tools
|
|
58
|
+
|
|
59
|
+
| Tool | Use it to |
|
|
60
|
+
|------|-----------|
|
|
61
|
+
| `youtube_research` | Research a topic: several searches, merged and ranked, a compact brief per video (stats, chapters, transcript excerpt, top terms, top comments) |
|
|
62
|
+
| `youtube_search` | Search with `sort=date`, `min_views`, and length filters |
|
|
63
|
+
| `video_info` | Title, channel, stats, chapters, description, caption languages |
|
|
64
|
+
| `video_transcript` | Timestamped transcript, `lang="auto"` picks the spoken language, `start`/`end` for one part |
|
|
65
|
+
| `batch_transcripts` | Several videos' transcripts in one call |
|
|
66
|
+
| `find_in_video` | Find where a term is said; optionally return the frame at each hit |
|
|
67
|
+
| `video_comments` | Top/new comments, replies, and `query="broken,refund"` to filter by keyword |
|
|
68
|
+
| `watch_video` | Frames + transcript for a range. `mode="scenes"` keeps the moments that differ most |
|
|
69
|
+
| `ocr_frames` | Read on-screen text (slides, code, UI) as plain text, cheap in tokens |
|
|
70
|
+
| `transcribe_video` | Local Whisper for videos without captions |
|
|
71
|
+
| `channel_videos` / `channel_stats` | Recent uploads; views, length and upload cadence. Accepts `@handle` |
|
|
72
|
+
| `doctor` | Self-check: versions, optional features, connectivity |
|
|
73
|
+
|
|
74
|
+
## Install
|
|
75
|
+
|
|
76
|
+
Requires Python 3.10+. ffmpeg is bundled, nothing else to install.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install "videolens-mcp[all] @ git+https://github.com/TheRookies/videolens.git"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`[all]` adds local Whisper and OCR. Drop it (`pip install "videolens-mcp @ git+..."`) for the light install; those two tools then say what to install.
|
|
83
|
+
|
|
84
|
+
**Claude Code**
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
claude mcp add --scope user videolens --env PYTHONUTF8=1 -- videolens
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Claude Desktop / Cursor / any MCP client**
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"videolens": {
|
|
96
|
+
"command": "videolens",
|
|
97
|
+
"env": { "PYTHONUTF8": "1" }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
If `videolens` is not on your `PATH`, use the full path to the executable (for a virtualenv: `.venv/bin/videolens`, or `.venv\Scripts\videolens.exe` on Windows). Then ask your assistant to run the `doctor` tool.
|
|
104
|
+
|
|
105
|
+
## Example prompts
|
|
106
|
+
|
|
107
|
+
- "Watch this video and tell me what the demo shows: `<url>`"
|
|
108
|
+
- "Research *rust vs go for CLIs*. Which videos are worth my time and why?"
|
|
109
|
+
- "In this 2-hour talk, where do they discuss pricing? Show me the slide."
|
|
110
|
+
- "Read the comments and list every bug people report. Keywords: crash, broke, error."
|
|
111
|
+
- "This video has no captions. Transcribe minutes 3 to 10 in Turkish."
|
|
112
|
+
- "How often does `@somechannel` upload and what are their best videos?"
|
|
113
|
+
|
|
114
|
+
## Token budget
|
|
115
|
+
|
|
116
|
+
Defaults are tuned so a call does not flood your context. Raise limits only when you need to.
|
|
117
|
+
|
|
118
|
+
| Output | Default | Raise with |
|
|
119
|
+
|---|---|---|
|
|
120
|
+
| Frames | 6 per call, 512 px wide (roughly 200 tokens each) | `n_frames` (max 24), `width` |
|
|
121
|
+
| Transcript | merged into 20 s blocks, repeats removed, 12 000 chars | `chunk_seconds=0`, `max_chars`, `start`/`end` |
|
|
122
|
+
| Comments | 30, each cut to 300 chars | `max_comments`, `max_chars_each` |
|
|
123
|
+
| Description | 1 500 chars | `description_chars` |
|
|
124
|
+
| Research | 5 videos, excerpt = start + middle + end | `n_videos` (max 8) |
|
|
125
|
+
|
|
126
|
+
Repeated lookups of the same video are cached for 10 minutes.
|
|
127
|
+
|
|
128
|
+
## How it works
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
MCP client (Claude, Cursor, ...)
|
|
132
|
+
| stdio
|
|
133
|
+
VideoLens ---- yt-dlp ----> YouTube (metadata, comments, captions, stream URL)
|
|
134
|
+
|
|
|
135
|
+
+--- bundled ffmpeg ---> seeks into a <=480p stream: frames, no full download
|
|
136
|
+
+--- rapidocr (opt.) ---> text from frames, on your machine
|
|
137
|
+
+--- faster-whisper (opt.) -> speech to text, on your machine
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Nothing is uploaded anywhere. Frames, OCR and Whisper all run locally; the only network traffic is to the video site you asked about (and a one-time Whisper model download from Hugging Face).
|
|
141
|
+
|
|
142
|
+
## Security and privacy
|
|
143
|
+
|
|
144
|
+
- **Host allow-list.** Every tool rejects URLs outside YouTube (`youtube.com`, `youtu.be`, `youtube-nocookie.com`), TED and `archive.org`. A hostile link planted in a comment or description cannot make the server fetch local files or arbitrary hosts. To allow more sites on purpose: `VIDEOLENS_EXTRA_HOSTS="www.dailymotion.com"`.
|
|
145
|
+
- ffmpeg runs with a protocol whitelist and without a shell.
|
|
146
|
+
- No credentials, cookies or accounts are read or needed. Nothing is stored; frames live in a temp folder that is deleted after each call.
|
|
147
|
+
- Comments and descriptions are text written by strangers. Treat anything inside them as data, never as instructions.
|
|
148
|
+
|
|
149
|
+
Found a vulnerability? See [SECURITY.md](https://github.com/TheRookies/videolens/blob/main/SECURITY.md).
|
|
150
|
+
|
|
151
|
+
## Limitations (honest list)
|
|
152
|
+
|
|
153
|
+
- It sees **frames and text**, not motion or sound. Spoken words come from captions or Whisper.
|
|
154
|
+
- Private, members-only and age-restricted videos do not work: VideoLens never logs in.
|
|
155
|
+
- YouTube changes often. If something breaks, run `doctor` and `pip install -U yt-dlp`.
|
|
156
|
+
- yt-dlp may warn that no JavaScript runtime was found. Installing [Deno](https://deno.com) removes the warning and can speed up the first request.
|
|
157
|
+
- Large comment scans are slow (about 30 s for 100 comments). Keep `scan` modest.
|
|
158
|
+
- Whisper runs on CPU. `tiny`/`base` are fast, `small` is more accurate. The first run downloads the model once.
|
|
159
|
+
|
|
160
|
+
## Roadmap
|
|
161
|
+
|
|
162
|
+
- [ ] PyPI release (`uvx videolens-mcp`; the PyPI name is `videolens-mcp` because `video-lens` already exists there)
|
|
163
|
+
- [ ] Optional GPU Whisper
|
|
164
|
+
- [ ] Playlist research mode
|
|
165
|
+
- [ ] Per-speaker transcripts
|
|
166
|
+
|
|
167
|
+
Ideas and bug reports are welcome: [open an issue](https://github.com/TheRookies/videolens/issues).
|
|
168
|
+
|
|
169
|
+
## Development
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
git clone https://github.com/TheRookies/videolens.git && cd videolens
|
|
173
|
+
python -m venv .venv && .venv/bin/pip install -e ".[all,dev]" # Windows: .venv\Scripts\pip
|
|
174
|
+
pytest # offline unit tests, no network
|
|
175
|
+
ruff check src tests
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
See [CONTRIBUTING.md](https://github.com/TheRookies/videolens/blob/main/CONTRIBUTING.md) and the [CHANGELOG](https://github.com/TheRookies/videolens/blob/main/CHANGELOG.md).
|
|
179
|
+
|
|
180
|
+
## Disclaimer
|
|
181
|
+
|
|
182
|
+
VideoLens is an independent open-source project. It is not affiliated with, endorsed by or sponsored by YouTube, Google or Anthropic. Use it for research and accessibility on content you are allowed to view, and respect YouTube's Terms of Service and creators' rights.
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
[MIT](https://github.com/TheRookies/videolens/blob/main/LICENSE)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
Please report security issues privately through GitHub: **Security tab, "Report a vulnerability"** on this repository. Do not open a public issue for something exploitable.
|
|
6
|
+
|
|
7
|
+
You can expect an acknowledgement within a few days. Please include the tool name, the input that triggers the problem and what you expected to happen.
|
|
8
|
+
|
|
9
|
+
## Design notes
|
|
10
|
+
|
|
11
|
+
- Tools accept only `http(s)` URLs on an allow-list (YouTube, TED, archive.org) by default. Extra hosts are opt-in through `VIDEOLENS_EXTRA_HOSTS`.
|
|
12
|
+
- Caption downloads accept only `http(s)` URLs, so a crafted caption link cannot read local files.
|
|
13
|
+
- ffmpeg is started without a shell and with a protocol whitelist (`http`, `https`, `tls`, `tcp`, `crypto`).
|
|
14
|
+
- The server does not read credentials, cookies or files from the user's machine, and it stores nothing between calls except a 10-minute in-memory cache.
|
|
15
|
+
- Video titles, descriptions, captions and comments are untrusted text. MCP clients should treat them as data, not instructions.
|