Skip to content
Build your own
81 views·0 installs·Jun 2, 2026
Shared stack plan · /s/syRnouoe

Construye un MCP server en Python con las siguientes especificaciones…

Construye un MCP server en Python con las siguientes especificaciones: Identidad y contexto Nombre del MCP: video-generator-mcp Empresa: EDIFICACIÓN (Salfacorp) Propósito: Transformar procedimientos técnicos (PDF o texto) en guiones JSON estructurados para generación de video corporativo de capacitación Stack técnico Lenguaje: Python Transport: stdio (para Claude Desktop) Imágenes: Gemini API (gemini-2.0-flash-preview-image-generation) — solicitar API key al usuario si no está configurada Renderer de video: Creatomate (API REST, JSON → video) Generación de guión: Anthropic API (claude-sonnet-4-20250514) Herramientas (tools) que debe exponer el MCP generate_video_script Input: procedure_text (string) — texto extraído del PDF o pegado directamente pdf_path (string, opcional) — ruta al PDF si se sube archivo Proceso interno: Extrae PROJECT_NAME desde el título o encabezado del procedimiento Fija COMPANY = "EDIFICACIÓN" Determina TEMPLATE desde el nombre del procedimiento (sin prefijo numérico) Analiza el contenido y determina cantidad de escenas dinámicas (libre, sin mínimo ni máximo fijo) Genera escenas: escena 1 (intro corporativa fija) + escenas dinámicas + escena final (cierre corporativo fijo) Para cada escena dinámica genera: voz_en_off, image_prompt, video_prompt Output: JSON estructurado según el formato definido abajo generate_scene_images Input: JSON del guión generado por generate_video_script Proceso: Para cada escena dinámica, llama a Gemini API con el image_prompt y retorna las rutas o base64 de las imágenes generadas Output: JSON del guión con campo imagen_generada poblado por escena render_video Input: JSON del guión con imágenes generadas Proceso: Mapea el JSON al template de Creatomate y llama a su API REST Output: URL del video renderizado

Install with one command
$ npx mcpflix install syRnouoe

Writes claude_desktop_config.json, prompts for any required API keys, and drops skills into ~/.claude/skills/. Backed up automatically.

What this stack is

What you're building

  • Entities: Video-generator-mcp (MCP server, Python), Procedimientos técnicos (PDF/texto input), Guiones JSON estructurados (output), Gemini API (image generation), Creatomate API (video rendering), Anthropic API (script generation)
  • Constraints: Python + stdio transport for Claude Desktop, API keys for Gemini, Creatomate, Anthropic must be user-supplied or env-configured, Deterministic JSON schema for video scripts, Corporate training video format (EDIFICACIÓN/Salfacorp branding)
  • Out of scope: Web UI or frontend (MCP server only), Video hosting or CDN delivery, PDF parsing library selection (user will choose), Creatomate template design (user provides templates)

Why this stack fits anthropic-api provides claude-sonnet-4 for script generation from procedure text. No listed MCP server wraps Gemini or Creatomate, so the MCP itself will call those APIs directly. postgres or supabase are not needed; this is a stateless transformation pipeline.

Architecture

Loading diagram…

Install everything in one go

Copy a single setup guide that includes the MCP config and the skills installer script — paste into a doc to keep, or follow it section by section.

Implementation Plan

  1. Initialize Python MCP project structure ⏱ 15m

Create a new Python project with uv (or pip) and install mcp, anthropic, google-generativeai, requests, and pydantic. Set up a src/video_generator_mcp/ directory with init.py, server.py (main MCP server), tools.py (tool implementations), and schemas.py (Pydantic models for JSON validation). Initialize git and add .env.example for API keys.

Done when:

  • Project structure matches MCP Python template (server.py exports Server class)
  • pyproject.toml lists mcp, anthropic, google-generativeai, requests, pydantic as dependencies
  • .env.example documents ANTHROPIC_API_KEY, GEMINI_API_KEY, CREATOMATE_API_KEY

Files: pyproject.toml, src/video_generator_mcp/__init__.py, src/video_generator_mcp/server.py, src/video_generator_mcp/tools.py, src/video_generator_mcp/schemas.py, .env.example, .gitignore

Verify:

Loading code…
  1. Define Pydantic schemas for video script JSON ⏱ 30m

In schemas.py, define Pydantic models for: SceneContent (voz_en_off, image_prompt, video_prompt), DynamicScene (extends SceneContent with scene_number, duration_seconds), FixedScene (intro/outro with static content), VideoScript (project_name, company, template, scenes list, metadata). Ensure JSON serialization matches Creatomate's expected format. Add validation for required fields and enum constraints (e.g., template names).

Done when:

  • Pydantic models validate and serialize to JSON without errors
  • VideoScript model includes intro scene (fixed), dynamic scenes list, outro scene (fixed)
  • Each DynamicScene has voz_en_off, image_prompt, video_prompt, scene_number, duration_seconds

Files: src/video_generator_mcp/schemas.py

Verify:

Loading code…
  1. Implement generate_video_script tool ⏱ 60m · • medium-risk

In tools.py, create generate_video_script(procedure_text, pdf_path=None). Extract PROJECT_NAME from the first heading or title line. Set COMPANY='EDIFICACIÓN'. Determine TEMPLATE by removing numeric prefixes from the procedure name. Call Anthropic API (claude-sonnet-4) with a system prompt that instructs the model to: (1) analyze the procedure, (2) determine optimal number of dynamic scenes, (3) generate voz_en_off (Spanish narration), image_prompt (for Gemini), and video_prompt (for Creatomate) for each scene. Return a VideoScript Pydantic model, serialized to JSON.

Done when:

  • Tool accepts procedure_text and optional pdf_path
  • Extracts PROJECT_NAME and sets COMPANY='EDIFICACIÓN'
  • Calls Anthropic API and receives structured JSON response
  • Returns VideoScript JSON with intro, dynamic scenes, and outro

Files: src/video_generator_mcp/tools.py

Verify:

Loading code…
  1. Implement generate_scene_images tool ⏱ 45m · • medium-risk

In tools.py, create generate_scene_images(video_script_json). Iterate over each dynamic scene in the script. For each scene, extract image_prompt and call Gemini API (gemini-2.0-flash-preview-image-generation) to generate an image. Store the returned image (base64 or URL) in a new field imagen_generada for each scene. Return the updated VideoScript JSON with all images populated. Handle API rate limits and errors gracefully.

Done when:

  • Tool iterates over dynamic scenes and calls Gemini API for each image_prompt
  • imagen_generada field is populated with base64 or image URL
  • Returns updated VideoScript JSON with all images
  • Handles Gemini API errors and rate limits

Files: src/video_generator_mcp/tools.py

Verify:

Loading code…
  1. Implement render_video tool ⏱ 60m · ⚠ high-risk

In tools.py, create render_video(video_script_json). Map the VideoScript JSON to Creatomate's template schema (composition, layers, timeline). Call Creatomate API (POST /v1/renders) with the mapped JSON payload. Poll the render status endpoint until completion (or timeout after 5 minutes). Return the final video URL or error message. Document the expected Creatomate template structure in a README section.

Done when:

  • Tool maps VideoScript JSON to Creatomate composition format
  • Calls Creatomate API and receives job ID
  • Polls render status until completion or timeout
  • Returns video URL on success, error message on failure

Files: src/video_generator_mcp/tools.py, README.md

Verify:

Loading code…

Rollback: Delete the render job via Creatomate API using the job ID returned from the initial POST request; document job IDs in logs for manual cleanup if needed.

  1. Register tools in MCP server and add stdio transport ⏱ 30m · • medium-risk

In server.py, instantiate the MCP Server class. Register the three tools (generate_video_script, generate_scene_images, render_video) with their input schemas. Set up stdio transport so the server can communicate with Claude Desktop via stdin/stdout. Add error handling and logging. Test locally with mcp-cli or by running the server and sending test JSON payloads.

Done when:

  • MCP Server class instantiated with three registered tools
  • Stdio transport configured for Claude Desktop
  • Tool input schemas match Pydantic models
  • Server starts without errors: python -m src.video_generator_mcp.server

Files: src/video_generator_mcp/server.py

Verify:

Loading code…
  1. Configure Claude Desktop to load the MCP server ⏱ 15m · • medium-risk

Edit ~/.claude/claude_desktop_config.json to add a new entry under mcpServers for video-generator-mcp. Set the command to python -m src.video_generator_mcp.server (or the installed package path). Set environment variables for ANTHROPIC_API_KEY, GEMINI_API_KEY, and CREATOMATE_API_KEY. Restart Claude Desktop. Verify the server appears in the MCP list and tools are callable.

Done when:

  • claude_desktop_config.json contains mcpServers.video-generator-mcp entry
  • Command path is correct and server starts without errors
  • Environment variables are set for all three API keys
  • Claude Desktop shows the three tools in the MCP panel after restart

Files: ~/.claude/claude_desktop_config.json

Verify:

Loading code…
  1. Test end-to-end workflow with sample procedure ⏱ 120m · ⚠ high-risk

Create a sample procedure text (e.g., a construction safety checklist or equipment maintenance guide in Spanish). Call generate_video_script with the sample text. Verify the returned JSON has correct structure, PROJECT_NAME, COMPANY, and dynamic scenes. Call generate_scene_images on the output. Verify images are generated or URLs are populated. Call render_video on the final script. Verify a video URL is returned. Document the test case in tests/ directory.

Done when:

  • Sample procedure text is processed without errors
  • generate_video_script returns valid VideoScript JSON
  • generate_scene_images populates imagen_generada for all scenes
  • render_video returns a valid video URL
  • End-to-end test passes and is documented

Files: tests/test_e2e.py, tests/fixtures/sample_procedure.txt

Verify:

Loading code…

Rollback: Delete any test videos created in Creatomate via the API or web dashboard; clear test image files from local cache.

Five-Tool Carpentry

Prompts· 1

System prompt for script generation

Craft a detailed system prompt for claude-sonnet-4 that instructs the model on scene structure, Spanish narration quality, image prompt specificity, and Creatomate compatibility.

Skills· 2

/security-audit on MCP code

Scan the MCP server for hardcoded API keys, credential leaks in environment variable handling, and insecure API calls before publishing.

/test-gen for tool unit tests

Generate pytest fixtures and test cases for each of the three tools to verify API mocking, JSON schema validation, and error handling.

Projects· 1

Sample procedure library

Build a collection of real construction/maintenance procedures (in Spanish) to test the MCP with realistic inputs and validate output quality.

MCP· 1

video-generator-mcp server structure

Define a clean MCP server entry point (server.py) that registers tools, validates schemas, and handles stdio transport for Claude Desktop integration.

Deterministic Last-Mile Warnings

WarnFinancial

Anthropic, Gemini, and Creatomate API calls incur per-request costs. Each video generation triggers 1 Anthropic call (script), N Gemini calls (images), and 1 Creatomate call (render). Uncontrolled loops or high-volume testing can accumulate charges quickly.

Mitigation: Implement rate limiting and cost tracking in the MCP server. Log all API calls with timestamps and costs. Set up billing alerts in Anthropic, Google Cloud, and Creatomate dashboards. Use dry-run modes (e.g., mock responses) during development.

WarnSystem of record

Creatomate render jobs are asynchronous and create persistent video artifacts. If the render_video tool is called multiple times with identical inputs, duplicate videos will be created and stored.

Mitigation: Implement idempotency by hashing the VideoScript JSON and checking if a render already exists for that hash. Store render job IDs and URLs in a local SQLite or in-memory cache. Provide a cleanup tool to delete old renders.

InfoCompliance

Procedure text may contain proprietary or confidential EDIFICACIÓN/Salfacorp information. Anthropic and Gemini APIs may log or retain input data depending on their retention policies.

Mitigation: Review Anthropic's and Google's data retention policies. Consider using private deployments or on-premises alternatives if data sensitivity is high. Redact sensitive identifiers before sending to APIs. Document data handling in the MCP README.

Build your own — or save this one

Describe your project and our AI will design a complete stack — architecture diagram, MCP servers, skills, and step-by-step setup. Sign up free to save and share your own.