agy-video-reader
Enables reading Bilibili video links: probes metadata such as title, author, duration, description, and subtitles; downloads lightweight video or extracts timestamped storyboard frames; and summarizes high-like comments and high-energy danmaku segments.
Enables reading YouTube video links through metadata probing, lightweight video download or keyframe storyboard extraction, and subtitle retrieval where available.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@agy-video-reader what's this video about, plus top comments? https://www.bilibili.com/video/BV1xx411c7mD"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
为什么做这个插件?
日常把 B站、YouTube 视频链接丢给 AI 伴侣或编程 Agent 时,常常会遇到三个痛点:
只能看标题盲猜:普通网页抓取拿不到视频画面、听不到配音,更看不到评论区玩什么梗。
直接下载太重:动辄几百 MB 的长视频会瞬间撑爆上下文或拖垮下载。
跨端兼容踩坑多:不同宿主对视频、图片和工具 Schema 的支持差异很大(比如部分网关遇到无参空 Schema 会直接报
400)。
agy-video-reader 用一套轻量、零污染的 Python MCP 服务把这些问题一次解决。
Related MCP server: video-link-analyzer
核心特性
先探针,后按需拉取:
inspect_video_link秒级获取标题、UP主、时长、简介、字幕列表与时长预警,绝不盲目下载大文件。双端最优视觉模式:
Antigravity(
mode="video"):下载轻量.mp4(默认<= 480p/<= 25MB,超限由ffmpeg自动压制),直接配合read_file观看完整音画。DeepSeek Harness / 通用视觉 Agent(
mode="frames_and_text"):均匀抽取关键帧并自动拼接成一张带时间戳的 故事板网格图storyboard.jpg+ 字幕全文;开启AGY_VIDEO_INLINE_STORYBOARD=1可通过标准 MCPImageContent直出拼图,一次调用直接看懂全片。
超长视频防呆守卫:超过设定时长阈值(默认 300 秒)自动拒绝全量下载,引导先看字幕/热评或指定
start_time/end_time切片观看。B站热评与高能弹幕摘要:基于
bilibili-api-python抓取高赞热评与弹幕高能时间段;支持可选cookies.txt,遇到风控或登录限制自动优雅降级,不中断主流程。灵活调参(GUI + 自然语言 + 环境变量):
在 Antigravity 中内置亮/暗双主题适配的 MCP App 可视化设置面板(侧边栏
Plugins > 🎬 视频读取设置或对话调用open_settings),实时调节时长上限、分辨率(360p~1080p)、最大体积、关键帧数与缓存上限。在 DSH 中遵循极简原生理念,无需额外 GUI,直接用自然语言让 Agent 调用
update_settings或配置环境变量即可(如需 Web 面板也可自行搭配社区dsh-mcp-apps)。
网关友好 & 自动缓存清理:所有工具均杜绝无参空 Schema,避免网关 400 假报错;内置基于条目数 / 容量 / 存活时长的 LRU 缓存自动淘汰。
快速开始
环境要求
Python
>= 3.12uv(用于隔离插件专属虚拟环境,不污染全局 Python)(可选)系统级
ffmpeg;若本机未安装,插件会自动回退到内置的imageio-ffmpeg二进制
1. 安装到 Antigravity(推荐)
git clone https://github.com/eleysia111/agy-video-reader.git
cd agy-video-readerWindows:双击或运行
install.batmacOS / Linux:运行
bash install.sh
脚本会将插件安装到 ~/.gemini/config/plugins/agy-video-reader 并自动执行 uv sync。Antigravity 会自动发现并热加载插件,无需重启。
国内网络如
uv sync下载缓慢,可临时使用国内镜像加速:uv sync --default-index https://pypi.tuna.tsinghua.edu.cn/simple
2. 挂载到 DeepSeek Harness (DSH)
先在克隆下来的仓库目录执行一次 uv sync,然后在你的 DSH Profile 配置中加入以下条目(完整模板见 examples/dsh-mcp-client.yml):
- id: mcp-agy-video-reader
name: '@deepseek-ai/dsh-mcp-client'
config:
serverName: agy-video-reader
transport: stdio
command: uv
args:
- run
- --directory
- /absolute/path/to/agy-video-reader
- python
- -m
- agy_video_reader.server
env:
# DSH 默认走故事板+字幕,不与同机 Antigravity 的 video 模式冲突
AGY_VIDEO_DEFAULT_MODE: frames_and_text
# 以 MCP ImageContent 直接返回带时间戳的故事板拼图
AGY_VIDEO_INLINE_STORYBOARD: '1'日常怎么用?
装好后直接像聊天一样把链接发给你的 Agent 即可:
「帮我看看这个 B站视频讲了什么,再顺便总结一下评论区热评:
https://www.bilibili.com/video/BV...」「这个视频有点长,先帮我看下简介和弹幕高能片段,再切片看
02:00到04:30」「把视频读取插件的最大时长调到 600 秒、分辨率改成 720p」
「打开视频读取设置面板 / 清理一下视频缓存」
MCP 工具一览
工具 | 说明 |
| 快速探测标题、作者、时长、简介、可用字幕与是否超过阈值 |
| 下载轻量 |
| 抓取高赞热评与 B站高能弹幕时间段摘要 |
| 打开 Antigravity 设置面板并返回当前配置与缓存统计 |
| 持久化修改最大时长、分辨率、体积上限、关键帧数、热评条数、缓存上限或恢复默认 |
| 手动清理本地缓存目录(后台已内置 LRU 自动淘汰) |
环境变量
变量 | 可选值 | 说明 |
|
| 覆写默认读取模式,便于同机多宿主共存 |
|
| 在 |
可选 Cookies 说明
部分平台(如 B站)的完整热评或高清字幕可能需要登录会话。如有需要,可将自己浏览器导出的 Netscape 格式 Cookie 保存为插件根目录下的 cookies.txt(参考 cookies.txt.example)。
cookies.txt、settings.json、.venv/ 与 cache/ 均已写入 .gitignore,请勿提交个人凭证到公开仓库。
合规与安全声明
本项目仅用于辅助读取公开可访问的网页视频、字幕与评论信息,或基于用户自愿提供的合法会话读取其有权访问的内容。严禁用于绕过付费墙、会员加密或任何 CAPTCHA / 人机验证。
License
Available Tools
6 toolscleanup_cacheA
Clean up downloaded video/keyframe cache files.
Args: max_age_hours: If omitted, clears the entire cache directory. If provided, only removes entries older than max_age_hours.
Inputs: max_age_hours. Returns: object
fetch_commentsB
Fetch top-liked hot comments and (for Bilibili) high-energy danmaku summary.
Supports optional cookies.txt in the plugin root directory. Always degrades gracefully on anti-bot/login limits without crashing or attempting to bypass CAPTCHAs.
Inputs: url (required), limit. Returns: result
fetch_video_bundleA
Download a lightweight video bundle (<=max_height, <=max_size_mb MP4) or keyframes + storyboard + subtitles, along with hot comments / danmaku summary.
Args: url: Web video URL (e.g., Bilibili, YouTube). mode: 'auto' (uses AGY_VIDEO_DEFAULT_MODE env var or configured default_mode), 'video' (lightweight MP4 for video-capable agents like Antigravity via read_file), or 'frames_and_text' (evenly spaced JPEG keyframes + single timestamped storyboard + subtitles, ideal for DSH / DeepSeek Harness and other non-video agents). start_time: Optional slice start time (seconds or MM:SS / HH:MM:SS). Required when video duration exceeds max_duration_seconds. end_time: Optional slice end time (seconds or MM:SS / HH:MM:SS). Single slice must be <= max_duration_seconds. inline_storyboard: When True (or AGY_VIDEO_INLINE_STORYBOARD=1) in frames_and_text mode, returns the timestamped storyboard JPEG inline as MCP ImageContent.
Inputs: url (required), mode, end_time, start_time, +1 more.
inspect_video_linkA
Quickly inspect a web video link (Bilibili, YouTube, etc.) without downloading media.
Returns title, uploader, duration, description, available subtitles, whether it exceeds the configured duration threshold, and recommended next steps.
Inputs: url (required). Returns: result
open_settings视频读取设置面板B
Open the interactive settings panel (Antigravity / DSH MCP Apps) and return current settings.
Note: Keeping an optional parameter avoids empty-object tool schemas that some DSH/Gemini API gateways reject with 400 errors.
Args: include_cache_stats: Include local cache directory usage stats (default True).
Inputs: include_cache_stats. Returns: object
update_settingsB
Update and persist agy-video-reader settings (takes effect immediately).
Args: max_duration_seconds: Max allowed video/slice duration in seconds (30..1800, default 300). max_height: Max video height in pixels (360, 480, 720, or 1080; default 480). max_size_mb: Max MP4 file size in MB before ffmpeg compression (5..100, default 25). default_mode: Default fetch mode: 'auto', 'video', or 'frames_and_text'. keyframe_count: Number of keyframes extracted in frames_and_text mode (4..20, default 8). default_comment_limit: Default number of hot comments to fetch (5..50, default 30). cache_max_entries: Max LRU cache entries (2..100, default 12). cache_max_mb: Max LRU cache size in MB (50..2048, default 300). cache_max_age_hours: Max LRU cache retention in hours (1..168, default 24). reset: If True, resets all settings back to defaults.
Inputs: reset, max_height, max_size_mb, cache_max_mb, +6 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
The three operational tools are clearly tiered: inspect_video_link is metadata-only, fetch_video_bundle downloads media, and fetch_comments fetches only comments. The one soft overlap is that fetch_comments largely duplicates functionality already bundled inside fetch_video_bundle, so an agent may wonder when the standalone call is warranted (though 'lighter weight' is implied).
All six tools use a consistent snake_case verb_noun pattern (cleanup_cache, open_settings, update_settings, inspect_video_link, fetch_comments, fetch_video_bundle). The verb choice is also semantically meaningful: inspect vs fetch vs update vs cleanup signal cost/side-effects clearly.
Six tools is well-scoped for a video reading/config server, with each tool earning its place: three config/cache admin tools and three content tools. No redundant or vestigial tools inflate the surface.
The lifecycle is covered end to end: inspect → fetch bundle → fetch comments, plus settings read/update/reset and cache cleanup. Minor gaps exist, such as no subtitles/transcript-only retrieval (cheap text extraction without keyframes) and no way to grab a single keyframe at an arbitrary timestamp, but agents can work around these via the bundle modes.
Maintenance
Related MCP Connectors
Transcripts, summaries, chapters and timestamped search for video links, for AI agents.
Turn any video or audio link into files, transcripts and metadata, right from your AI agent.
YouTube for AI agents: transcripts, comments, video stats, channel monitor, Shorts captions.
Turn any video into context for AI agents: transcripts, metadata, chapters, timestamps.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceConverts YouTube and Bilibili videos into structured knowledge articles using local transcription or subtitle extraction combined with AI-powered summarization. It supports multiple summary styles and provides tools to process URLs, track job status, and retrieve results directly within MCP-compatible agents.65MIT
- AlicenseNot gradedqualityCmaintenanceEnables link type detection, video downloading, metadata extraction, and transcript generation across 16+ platforms including YouTube, Bilibili, and WeChat Channels. Supports automatic subtitle extraction and optional Whisper speech-to-text for videos without captions.2MIT
- AlicenseAqualityDmaintenanceEnables coding agents to turn videos from social platforms or local files into a small set of distinct frames plus a manifest, so they can answer visual questions by reading image paths. Also provides metadata lookup for captions and authors without downloading the video.2MIT
- AlicenseAqualityCmaintenanceExtracts transcripts or spoken captions from multi-platform video links (Bilibili, YouTube, Douyin) and returns concise Markdown summaries or full transcripts, saving tokens by keeping full text out of the conversation.22MIT