capped-video-mcp
A local MCP server for generating AI videos through Replicate/fal with hard spending caps, duplicate protection and automatic download — the exposed tools cover text-to-video generation plus job monitoring, costing, previews and budget checks.
Generate videos (
generate_video, billed): create a job from a prompt, choosingmodel,resolution,duration_sec,aspect_ratioandforce; returns ajob_id. Known models includeseedance-2.5(default),kling-3.0,wan-2.5,veo-3.1-fast/lite,hailuo-2.3,gemini-omni-1.2-flash(README also documents-i2vimage-to-video andseedance-2.5-refreference-to-video variants).Stay under budget: daily/monthly USD caps, request-count caps, resolution/duration limits, model allowlist, concurrent-job limit; over-budget requests are refused.
Avoid double billing: an identical request within the duplicate window (default 10 min) returns the existing
job_idwithduplicate: true;request_idalso dedupes;force: truefor a deliberate second copy.Track progress (
get_video_status, free): poll status with up to 60 s wait; returns the local file path when finished.Recover downloads (
download_video, free): retry a failed/lost download or get the finished file path; no URLs needed.Estimate costs (
estimate_video, free): per-model estimates sorted cheapest first, remaining budget, the cheapest affordable option, models that can't meet the constraints (with reasons), and any recent duplicate.Inspect the result (
preview_video, free): 6 frames tiled into one image so the agent can judge whether to regenerate (needs ffmpeg).Discover options (
list_models, free): allowed models, per-second prices by resolution, duration ranges and defaults.Check spending (
get_usage, free): today's/month's counts and estimated cost vs. caps, plus in-flight jobs.Cost confirmation & failover: optional user confirmation above a cost threshold, and automatic fallback to an alternate provider on definitive rejection (pricier fallbacks require approval).
Mock mode:
CAPPED_VIDEO_PROVIDER=mockproduces fake files without calling any paid API.
Used as one of the two video-generation backends: the server submits generation jobs to Replicate for its supported models (e.g. seedance-2.5, default), polls job status, and automatically downloads the finished videos. Replicate is also the failover counterpart for the equivalent fal model, and its pricing is used to compute per-request cost estimates against the configured daily/monthly budget caps.
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., "@capped-video-mcp estimate a 5s 480p video, then generate the cheapest one"
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.
capped-video-mcp
A local MCP server that lets agents (Claude Code, Claude Desktop, …) generate videos through Replicate and fal, using your own API keys — with hard spending caps enforced by the server.
Supported models: seedance-2.5 (Replicate, default), seedance-2.5-fal, kling-3.0, wan-2.5, veo-3.1-fast, veo-3.1-lite, hailuo-2.3, gemini-omni-1.2-flash. Each model has its own allowed durations, resolutions and prices (see list_models or the default config.toml).
Every model also has an image-to-video variant with the -i2v suffix (seedance-2.5-i2v is the default) that animates your own image as the first frame — see Image to video. Seedance 2.5 also has a reference-to-video mode (seedance-2.5-ref) that combines several of your images and audio clips into a new scene — see Reference to video.
The server enforces cost limits (model allowlist, resolution/duration caps, daily and monthly budgets, concurrent jobs), detects duplicate requests so agent retries don't get billed twice, and downloads finished videos automatically.
Alpha. Prices in the config are estimates used for budgeting (taken from provider list prices, checked 2026-11-22). Check actual charges on your Replicate/fal dashboard. Provider request formats were validated against the public API schemas. A real fal generation was verified end-to-end on 2026-11-25 (image-to-video: image upload → generate → automatic download → preview); Replicate generations and reference-to-video have not been verified with real generations yet. Start with the cheapest settings (480p, 4–5 s) and a low budget cap.
Install and register
Requirements: uv and a Replicate token and/or a fal key (one is enough; models of a provider without a key are disabled). Optional: ffmpeg, used only by preview_video.
Claude Code
claude mcp add capped-video --scope user \
-e FAL_KEY=fal-xxxx \
-e REPLICATE_API_TOKEN=r8_xxxx \
-e CAPPED_VIDEO_DEFAULT_MODEL=kling-3.0 \
-e CAPPED_VIDEO_DAILY_MAX_USD=3 \
-- uvx capped-video-mcp--scope user makes the server available in every project. To share a .mcp.json in a team repository, don't write keys into it; reference each developer's environment variables instead:
{
"mcpServers": {
"capped-video": {
"command": "uvx",
"args": ["capped-video-mcp"],
"env": {
"FAL_KEY": "${FAL_KEY:-}",
"REPLICATE_API_TOKEN": "${REPLICATE_API_TOKEN:-}",
"CAPPED_VIDEO_DEFAULT_MODEL": "kling-3.0"
}
}
}
}Check the connection with /mcp. generate_video costs money — keep it out of any auto-allow list and approve each call.
uvx keeps using the version it first downloaded. To upgrade, register with uvx capped-video-mcp@latest or run uvx --refresh capped-video-mcp once.
Claude Code plugin (prompts for keys and budget)
/plugin install capped-video-mcp --marketplace bslim1009/capped-video-mcpClaude Code asks for your fal/Replicate keys, default model and budget caps when the plugin is enabled, stores keys in the OS credential store, and runs the server with uvx capped-video-mcp. Change the values later under /config.
Claude Desktop extension (double-click install)
Download capped-video-mcp-<version>.mcpb from the releases page and open it with Claude Desktop. The install dialog asks for your keys, default model, budget caps and output folder; Claude Desktop manages Python and dependencies itself (UV runtime). No terminal needed.
Other clients
Add the same JSON shape to mcpServers in your client's MCP settings (for Claude Desktop without the extension: claude_desktop_config.json). Write the key values directly instead of ${...}.
Try it without keys
Pass CAPPED_VIDEO_PROVIDER=mock and the server never calls a real API; it produces fake files and keeps its records separate (data/usage-mock.json, <output dir>/mock/).
Related MCP server: longtake-mcp
Tools
Tool | Billed | What it does |
| yes | Creates a generation job and returns a |
| no | Job status. Waits up to 60 s. Returns the file path when finished |
| no | Retry the download if the automatic one failed |
| no | Today's and this month's usage against the caps |
| no | Estimated cost per model for the given constraints (duration, resolution, aspect ratio), cheapest first, with remaining budget. Includes the cheapest model that fits the budget ( |
| no | Returns 6 frames of a finished video tiled into one image, so the agent can look at the result and decide whether to regenerate. Needs ffmpeg (returns the reason if missing) |
| no | Allowed models, prices, duration ranges and current defaults |
Results are collected only while the server (your client session) is running. Don't close the session while a generation is in progress.
Image to video
Pass image_path with an absolute path to a PNG, JPEG or WebP file (up to 20 MB, limits.max_image_bytes). The image becomes the first frame. Without model, defaults.image_model (seedance-2.5-i2v) is used; text-only models reject images and -i2v models require one.
Model | Endpoint | Aspect ratio |
| Replicate | follows the image |
| fal | follows the image |
| fal | follows the image (min 300 px, ratio 0.4–2.5) |
| fal | follows the image |
| fal | follows the image (720p+ 16:9 or 9:16 recommended) |
| fal | follows the image |
| fal |
|
Prices are the same as the text-to-video versions. For models whose ratio follows the image, don't pass aspect_ratio (list_models shows auto).
Right before the generation request, the server uploads the image to the provider's storage and passes the resulting URL: Replicate's Files API (files expire after 24 hours) or the fal CDN (expiry set to 24 hours; URLs are unguessable but public by default). Upload failures happen before anything billable, so they are recorded as create_failed and can fail over (seedance-2.5-i2v ↔ seedance-2.5-fal-i2v). The job record and audit log keep the image path and SHA-256, never the image bytes.
Reference to video
Give Seedance 2.5 several images (characters, objects, backgrounds) and optionally audio (voice, roars, music), and describe the scene. Refer to the files in the prompt as [Image1], [Image2], [Audio1], … in the order they were given:
generate_video(
prompt="The dinosaur from [Image1] fights the dinosaur from [Image2] in a jungle, roaring like [Audio1]",
reference_dir="C:/Project/Sample")reference_image_paths(PNG/JPEG/WebP, at least 1, up to 30) andreference_audio_paths(MP3/WAV, up to 10) take absolute paths in the order you choose.reference_dirtakes a folder instead and uses its images and audio files sorted by file name (no subfolders, hidden files skipped). Use one or the other.Call
estimate_videowith the same arguments first (free): itsreferencesfield shows which file became[Image1],[Audio1], … .Audio: each file at least 1.8 s, 30 s in total, up to 15 MB (
limits.max_audio_bytes) — the intersection of both providers' limits, checked before anything is reserved.Models:
seedance-2.5-ref(Replicate, defaultdefaults.reference_model) andseedance-2.5-fal-ref(falbytedance/seedance-2.5/reference-to-video, about 2× the price). They fail over to each other (switching to the pricier fal model needs the user's approval, see Provider failover). Replicate writes references as[Image1]and fal as@Image1; the server rewrites either form to the target model's syntax.Reference mode can't be combined with
image_path(first frame). Reference videos are not supported (video input costs about 4.2× more).Pricing: fal lists the same per-second price as image-to-video. Replicate's price table only distinguishes
video_infromnon_video_in; the config assumes image/audio references use thenon_video_inrate.
Duplicate request detection
Agents tend to resend a request when a response is slow or ambiguous. If a request with the same prompt (whitespace-normalized), model, resolution, duration, aspect ratio and input image content arrives within duplicate_window_minutes (default 10), the server returns the existing job's status instead of calling the provider. Rejected (create_failed, not billed) and failed (failed) jobs are not treated as duplicates, so they can be retried. The check and the reservation happen under the same file lock, so two clients sending the same request at once still create only one job. Disable with CAPPED_VIDEO_DUPLICATE_WINDOW_MINUTES=0.
Cost confirmation before generating (optional)
Set a threshold such as CAPPED_VIDEO_CONFIRM_ABOVE_USD=0.5 and, when the estimated cost is at or above it, the server itself asks the user "This will cost about $0.63. Proceed?" via MCP elicitation. This works independently of the client's tool-approval settings, so expensive generations get a second look even in auto-approve mode. If the client doesn't support elicitation, CAPPED_VIDEO_CONFIRM_FALLBACK applies (allow, the default, proceeds; deny refuses). The default 0 never asks.
Provider failover
When the same model is available from two providers (seedance-2.5 ↔ seedance-2.5-fal) and the first provider definitively rejects the request (4xx, maintenance, …), the server re-checks the remaining budget and generates with the fallback model; the response carries failover_from.
The user decides when the fallback costs more (e.g. seedance-2.5 $0.51 → seedance-2.5-fal $1.10). A fallback that costs the same or less is used right away. A pricier one is used only after the server asks the user via MCP elicitation ("… rejected the request. Generating with seedance-2.5-fal costs about $1.10 (originally $0.51). Proceed?") and the user accepts; the reservation is kept alive while waiting for the answer. If the user declines, or the client doesn't support elicitation, nothing is generated or billed, and the error names the fallback model and its price so the agent can ask the user and retry with model="<fallback>".
It never fails over on errors with an unknown outcome (timeouts, 5xx), because the first attempt may have been billed. Disable with CAPPED_VIDEO_FAILOVER=false; change the fallback with fallback_model in the config.
Result preview
preview_video uses ffmpeg to tile 6 frames (3 × 2, in time order) into one JPEG and returns it as image content. The result is cached next to the video as <job_id>.preview.jpg. ffmpeg is looked up on PATH or via CAPPED_VIDEO_FFMPEG; if it's missing, the tool returns the video path and the reason. Frame count and width are set in the [preview] section of the config.
Configuration
Settings are layered; later layers win:
Package defaults: src/capped_video_mcp/config.toml
config.tomlin the data directory (optional; only the keys you want to change)CAPPED_VIDEO_*environment variables (passed with-e/envat registration, or in.envin the data directory)
Environment variables
Variable | Setting | Example |
| fal API key (API scope — don't use an ADMIN key) | |
| Replicate token | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Data directory. Absolute path, registration env only (has no effect in |
|
|
|
|
Empty values are treated as unset (a value in .env is used instead). Invalid values (unknown model or resolution, non-numeric budget, …) stop the server from starting and name the offending variable or file. Paths may use ~ and environment variables (%USERPROFILE%, $HOME). Never pass API keys as tool arguments or in chat — they would end up in transcripts and logs.
Data directory
How the server runs | Location |
| that directory |
Installed with |
|
Run from this repository after | repository root |
Contents: config.toml and .env (optional, created by you), output/ (videos), data/usage.json (usage ledger), logs/.
Example data-directory config.toml. Tables ([limits], …) are merged key by key; lists ([[models]], allowed_hosts) are replaced as a whole.
[defaults]
model = "veo-3.1-lite"
[limits]
daily_max_usd = 2.0
[download]
dir = 'D:\Videos\capped-video' # use single quotes or forward slashes for Windows pathsDevelopment
uv sync
cp .env.example .env # fill in keys; or set CAPPED_VIDEO_PROVIDER=mock to run without keys
uv run pytest # never calls a real APITo run the server from the repository, register it in .mcp.json (git-ignored):
{
"mcpServers": {
"capped-video": {
"command": "uv",
"args": ["run", "--directory", "<repo path>", "python", "-m", "capped_video_mcp"]
}
}
}Changes are listed on the releases page.
License
MIT
Official MCP Registry name (ownership marker for the PyPI package):
mcp-name: io.github.bslim1009/capped-video-mcp
Available Tools
7 toolsdownload_videoAIdempotent
내려받지 못한(lost) 작업의 다운로드를 다시 시도하거나, 완료된 파일 경로를 돌려준다. 과금되지 않는다.
보통은 서버가 자동으로 내려받으므로 부를 필요가 없다. URL 이나 경로는 받지 않는다.
Inputs: job_id (required), wait_seconds. Returns: object
estimate_videoARead-only
과금 없이 비용을 견적한다. 조건(길이·해상도·화면 비율)에 맞는 모델을 싼 순서로, 남은 예산과 함께 돌려준다.
generate_video 를 부르기 전에 모델을 고르거나 예산이 충분한지 볼 때 쓴다. cheapest 는 예산 안에서 가장 싼 모델.
조건을 지정하지 않으면 모델별 가장 싼 값을 가정한다. 조건을 만족하지 못하는 모델은 unavailable 에 이유와 함께 나온다.
prompt 를 주면 같은 요청이 최근에 있었는지(duplicate_of)도 알려 준다.
입력 종류가 같은 모델끼리 비교한다: 참조 파일(reference_*)을 주면 참조→영상, image_path 를 주면 이미지→영상,
둘 다 없으면 텍스트→영상. 참조 파일을 주면 references 에 [Image1]·[Audio1] 표기와 파일의 대응을 돌려준다.
Inputs: model, prompt, image_path, resolution, +5 more. Returns: object
generate_videoA
영상 생성 작업을 만든다. 과금된다. 사용자가 영상 생성을 요청했을 때만 부른다.
기본값: config.toml 의 defaults (seedance-2.5 / Replicate, 480p, 5초, 16:9).
이미지→영상: image_path 에 첫 프레임으로 쓸 로컬 이미지의 절대 경로(PNG·JPEG·WebP)를 준다.
이때 model 은 이름이 -i2v 로 끝나는 이미지→영상 모델이어야 하며, 생략하면 list_models 의 defaults.image_model 을 쓴다.
대부분의 이미지→영상 모델은 화면 비율이 이미지를 따르므로 aspect_ratio 를 주지 않는다
(list_models 의 aspect_ratios 가 auto 인 모델).
참조→영상: 여러 이미지(캐릭터·배경 등)와 음성을 참고해 새 장면을 만든다. 파일은 모두 로컬 절대 경로다.
reference_image_paths(PNG·JPEG·WebP, 1장 이상)와 reference_audio_paths(MP3·WAV, 파일당 1.8초 이상,
합계 30초 이하)를 주거나, reference_dir 에 폴더를 주면 그 안의 이미지·오디오를 파일 이름순으로 쓴다.
프롬프트에서는 순서대로 [Image1], [Image2], [Audio1] 처럼 가리킨다 (예: "[Image1] 의 공룡과 [Image2] 의 공룡이 싸운다.
[Audio1] 의 포효 소리에 맞춰"). 어떤 파일이 몇 번인지는 estimate_video 의 references 로 먼저 확인할 수 있다 (무료).
model 은 -ref 로 끝나는 참조→영상 모델이며, 생략하면 defaults.reference_model 을 쓴다. image_path 와 함께 쓸 수 없다.
모델마다 허용 해상도·길이·화면 비율과 가격이 다르다. 다른 모델을 쓰기 전에 list_models 로 확인한다
(예: veo 는 4·6·8초, wan 은 5·10초, hailuo 는 6·10초만). 지정하지 않으면 모델에 맞는 가장 싼 값을 고른다.
자동 길이는 허용하지 않는다. 일일·월간 예산을 넘으면 거부한다.
job_id 를 반환한다. 완료되면 서버가 출력 폴더에 자동 저장하며, get_video_status 로 확인한다.
오류가 "다시 보내지 마세요"라고 하면 같은 요청을 반복하지 않는다.
같은 요청(프롬프트·모델·해상도·길이·비율·입력 파일 내용)이 최근에 이미 접수됐으면 새 작업을 만들지 않고 기존 job_id 를
duplicate=true 로 돌려준다 (과금 없음). request_id 를 주면 그 값으로도 중복을 잡는다.
사용자가 같은 영상을 하나 더 원할 때만 force=true 를 쓴다.
1차 제공처가 요청을 확정 거부하면 대체 모델로 만들고 failover_from 에 원래 모델을 적는다.
대체 모델이 더 비싸면 서버가 사용자에게 직접 묻고 승인했을 때만 넘어간다. 확인 요청을 지원하지 않는
클라이언트에서는 넘어가지 않고 오류로 대체 모델과 가격을 알려 준다 → 사용자에게 물어본 뒤 그 model 로 다시 요청한다.
예상 비용이 설정 임계값 이상이면 서버가 사용자에게 직접 확인을 요청할 수 있다.
Inputs: prompt (required), force, model, image_path, +7 more. Returns: object
get_usageARead-only
오늘·이번 달 생성 횟수와 예상 비용, 상한, 진행 중인 작업 수를 돌려준다.
Inputs: no named parameters. Returns: object
get_video_statusARead-only
작업 상태를 확인한다. 과금되지 않는다.
완료될 때까지 최대 wait_seconds(상한 60초) 동안 기다린다.
status 가 queued/running/downloading 이면 이 도구를 다시 부른다.
succeeded 이면 file 에 저장된 영상 경로가 있다.
Inputs: job_id (required), wait_seconds. Returns: object
list_modelsARead-only
사용할 수 있는 모델, 해상도별 초당 가격(USD), 길이 범위, 기본값을 돌려준다.
input 이 image 인 모델은 이미지→영상 모델이며 generate_video 에 image_path 가 필요하다.
input 이 reference 인 모델은 참조→영상 모델이며 참조 이미지(reference_image_paths 또는 reference_dir)가 필요하다.
Inputs: no named parameters. Returns: object
preview_videoARead-only
완성된 영상의 프레임 여러 장을 한 이미지로 붙여 돌려준다. 과금되지 않는다.
영상을 직접 볼 수 없으니 이 이미지로 결과가 요청과 맞는지 확인한다. 왼쪽 위부터 오른쪽 아래로 시간 순서다.
succeeded 상태에서만 만들 수 있다. ffmpeg 가 없으면 preview_available=false 와 이유를 돌려준다.
Inputs: job_id (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool maps to a distinct step in the video pipeline (estimate, generate, status, download, preview, catalog, usage), and descriptions explicitly mark which tools cost money versus which are free. The only mild overlap is pricing/budget info shared across list_models, estimate_video, and get_usage, but each frames it around a different purpose (catalog prices, per-request quote, spend-to-date).
Every tool follows a verb_noun snake_case pattern: get_usage, generate_video, estimate_video, list_models, download_video, get_video_status, preview_video. The single longer name (get_video_status) is still a clear extension of the same convention.
Seven tools cover the full lifecycle with no filler: discovery, quoting, generation, polling, retrieval, preview, and budget. Each earns its place and the set stays well under the point where selection becomes burdensome.
The core flow (list models → estimate → generate → poll → download → preview, with budget awareness) is fully covered and no step is a dead end. Minor gaps remain: no cancel/abort for an in-flight job and no way to enumerate past jobs or their outputs.
Maintenance
Related MCP Connectors
Generate reproducible image, video, and audio assets with leading models and your own provider keys.
Generate video and images with prepaid USD billing and explicit per-job spending limits.
Video tools for agents (trim, captions, 9:16, GIF/MP3) + hire us for fixed-price jobs. No API key.
Create images & video from any MCP agent — 17 models, spend limits, one URL.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to generate, manage, and download AI-generated videos using OpenAI's Sora models, supporting text prompts, image-to-video, remixing, and more.9MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to create and manage AI video productions through Longtake Studio using their own API keys, including casting characters, shooting takes on models such as Seedance, Veo, Gemini Omni, and Kling, drafting and finishing in 1080p, and tracking render costs.74 npm1MIT
- AlicenseAqualityCmaintenanceEnables Claude to generate ByteDance Seedance videos and Seedream images through a BytePlus key, pricing every request in dollars before it is sent. It adds budget limits, ask-first approvals and whole-key spend tracking so costly generations cannot happen without consent.9MIT
- AlicenseAqualityCmaintenanceEnables Claude to generate videos from text prompts via the Replicate API, check generation status, and download completed videos to disk.3MIT