lazy-media-mcp
Local MCP server that compresses images and videos, extracts video frames, and prepares media for AI vision agents by returning file paths instead of inline base64.
README
lazy-media-mcp
Local Model Context Protocol (MCP) server that compresses images/videos and prepares media for AI vision agents.
Designed for coding agents (Claude Code, Codex, Grok, and other MCP clients): returns file paths only (no inline base64), so large screenshots and demos stay within tool limits.
Keywords: MCP server, image compression, video compression, ffmpeg, sharp, AI vision prep, frame extraction, Claude, Codex.
Why this exists
Large screenshots and long demos burn context and often fail tool limits. This server:
- Shrinks images to a sensible size/quality
- Turns videos into frame packs agents can actually open
- Uses JPEG by default for widest agent compatibility
WebP / WebM — do they help AI “read better”?
| Format | Role | Default here? |
|---|---|---|
| JPEG | Best universal image input for local agents | Yes |
| PNG | Sharper for OCR / UI text / alpha | ocr_text profile |
| WebP | Smaller files when the host supports it | Opt-in only |
| MP4 | Storage/sharing re-encode | Video compress default |
| WebM | Optional container | Opt-in via video_compress |
Format does not improve model understanding by itself. Resolution, blur, and compression artifacts matter more. Over-aggressive WebP/JPEG hurts OCR.
Local agents usually do not natively watch WebM/MP4. Prefer prepare_for_ai / video_extract_frames → JPEG paths.
Requirements
- Node.js ≥ 20
- ffmpeg + ffprobe on
PATH(video tools)
# macOS
brew install ffmpeg
Install / run
From npm
npx -y lazy-media-mcp
# or
npm install -g lazy-media-mcp
From source
git clone https://github.com/leaf76/lazy-media-mcp.git
cd lazy-media-mcp
npm install
npm run build
npm test
node dist/cli.js # stdio MCP
MCP client config (example)
{
"mcpServers": {
"lazy-media": {
"command": "node",
"args": ["/absolute/path/to/lazy-media-mcp/dist/cli.js"],
"env": {
"MEDIA_ALLOWED_ROOTS": "/Users/you,/Users/you/WorkSpace",
"MEDIA_WORKDIR": "/Users/you/.cache/lazy-media-mcp/jobs"
}
}
}
}
Tools
| Tool | Purpose |
|---|---|
media_inspect |
Metadata only |
image_compress |
Resize/compress image → workdir path |
video_compress |
Re-encode video (default MP4) |
video_extract_frames |
Extract frames for vision |
prepare_for_ai |
One-shot profile pipeline (recommended) |
media_cleanup |
Delete a job directory by job_id |
prepare_for_ai profiles
| Profile | Behavior |
|---|---|
ai_vision (default) |
Image → JPEG ≤1536 edge; video → up to 10 JPEG frames |
ocr_text |
Prefer PNG / higher quality |
inline_small |
Smaller edges, fewer frames |
archive |
Higher quality + optional compressed MP4 |
Environment
| Variable | Default |
|---|---|
MEDIA_ALLOWED_ROOTS |
$HOME, cwd, workdir |
MEDIA_WORKDIR |
~/.cache/lazy-media-mcp/jobs |
MEDIA_MAX_INPUT_BYTES |
500MB |
MEDIA_MAX_OUTPUT_BYTES |
200MB |
MEDIA_MAX_FRAMES |
24 |
MEDIA_PROCESS_TIMEOUT_MS |
120000 |
FFMPEG_BIN / FFPROBE_BIN |
ffmpeg / ffprobe |
LOG_LEVEL |
info |
Security
- Path allowlist (realpath checks)
- Input/output size caps
- Process timeout
- ffmpeg/ffprobe invoked with argv arrays only (no shell interpolation)
- Outputs go to workdir; originals are not overwritten
- Cleanup only deletes direct children of workdir by
job_id
Typical agent flow
1. prepare_for_ai({ path: "/path/to/demo.mp4", profile: "ai_vision" })
2. Read returned outputs[].path frame files in the next vision step
3. media_cleanup({ job_id }) when done (optional)
Related
- lazy-desktop-mcp — desktop computer-use MCP
- lazy_mobile_mcp — Android/iOS mobile automation MCP
- session-collab-mcp — multi-session collaboration MCP
License
MIT © leaf76
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。