Skip to main content
Glama

mcp-manimgl — MCP server exposing manimgl (Manim OpenGL) mathematical animation functionality as tools for LLMs.

PyPI Python Ruff

mcp-name: io.github.daedalus/mcp-manimgl

Install

pip install mcp-manimgl

Optional extras:

# For rendering (requires manimgl + system deps)
pip install "mcp-manimgl[render]"

# For audio narration + MIDI music support
pip install "mcp-manimgl[audio]"

Related MCP server: manim-web

System Dependencies

Dependency

Required for

Install

ffmpeg + ffprobe

Audio mixing, narration sync, music ducking

apt install ffmpeg

libfluidsynth3

MIDI file rendering to audio

apt install libfluidsynth3

SoundFont (.sf2/.sf3)

MIDI instrument sounds

apt install fluidr3mono-gm-soundfont

pangocairo, OpenGL

Manim rendering engine

See manimgl docs

The server checks for non-Python dependencies at startup and reports any missing ones to stderr and via the mcp-manimgl://info resource.

Usage

MCP Server

# Run with stdio transport (default for MCP)
mcp-manimgl

In Claude Desktop / Cursor / MCP clients

Add to your mcp.json:

{
  "mcpServers": {
    "mcp-manimgl": {
      "command": "mcp-manimgl"
    }
  }
}

Tools

The server exposes these tool categories:

Scene Management

  • create_scene — Create/configure a new scene

  • clear_scene — Remove all elements

  • add_wait — Add wait/pause

  • set_camera — Configure camera

  • set_config — Set global rendering config

  • save_state / restore_state — State management

  • generate_scene_script — Get the generated Python script

Mobject Creation

  • add_circle, add_square, add_rectangle, add_polygon

  • add_line, add_arrow, add_dot

  • add_text, add_tex (LaTeX)

  • add_function_graph, add_parametric_curve

  • add_coordinate_system, add_vector

  • add_labeled_point, add_brace, add_number_line

  • add_decimal_number, add_matrix

  • add_3d_object (sphere, cube, torus, cone, cylinder)

Mobject Manipulation

  • move_to, shift, scale, rotate

  • set_color, set_opacity

  • next_to, align_to

Animations

  • animate_transform, animate_fade_in/out, animate_grow

  • animate_rotate, animate_scale, animate_shift

  • animate_indicate, animate_write, animate_set_color

  • animate_move_along_path, animate_group

Audio

  • add_narration — Generate TTS (gTTS) narration that plays at the current timeline position

  • add_background_music — Add background music from audio files or MIDI files (auto-rendered via FluidSynth). Supports volume control, looping, and sidechain ducking during narration.

Rendering

  • render_scene — Render to video (auto-mixes background music + narration with ducking)

  • save_frame — Save single frame

  • get_render_status — Check environment

Audio Features

Narration

# TTS narration at current timeline position
add_narration("Shor's algorithm factors large numbers in polynomial time.")

Background Music

Accepts audio files (.mp3, .wav, .ogg) or MIDI files (.mid, .midi). MIDI files are rendered to audio using FluidSynth and the system SoundFont.

# From an audio file
add_background_music("/path/to/music.mp3", volume=0.3, loop=True)

# From a MIDI file (auto-rendered)
add_background_music("/path/to/classical.mid", volume=0.2)

# With ducking configuration
add_background_music(
    "bach_chorale.mid",
    volume=0.25,
    loop=True,
    duck_threshold="-20dB",
    duck_ratio=6,
    duck_attack=0.05,
    duck_release=0.3,
)

When both background music and narration are present, render_scene automatically:

  1. Renders the video without audio via manimgl

  2. Places the music track (looped if needed) at the configured volume

  3. Places each narration track at its timeline position

  4. Applies sidechain compression so music volume ducks during narration

  5. Composites everything into the final MP4 via ffmpeg

Example: Shor's Algorithm

A narrated animation explaining Shor's algorithm with LaTeX, 5 TTS narration tracks, and classical MIDI background music.

Watch: YouTube

MCP tool call sequence:

# 1. Configure scene
create_scene(background_color="#0a0a2e", resolution="1920x1080", fps=30)

# 2. Background music (auto-loops to fill video duration)
add_background_music("classical.mid", volume=0.25, loop=True)

# 3. Create mobjects + animate (5 sections)
add_tex("Shor's Algorithm", font_size=72, color="#FFD700")
add_tex("Integer Factorization on Quantum Computers", font_size=36, color="#88CCFF")
animate_fade_in("m_...", run_time=1.5)
# ... more shapes, LaTeX formulas, fade-ins, fade-outs ...

# 4. Narration at specific timeline positions
add_narration("Shor's algorithm factors large numbers...")   # ~3.5s
add_narration("The factoring problem...")                     # ~18.5s
add_narration("Key insight: reduce factoring to period...")   # ~36.1s
add_narration("Quantum period finding uses superposition...") # ~55.4s
add_narration("Summary of Shor's algorithm...")               # ~76.3s

# 5. Render (auto-mixes video + narrations + ducked BGM)
render_scene(output_path="data/Shors_Algorithm.mp4")

See the full scene script at shor_mcp.py in the repository root.

MIDI Rendering

MIDI files are rendered using pyfluidsynth with a system SoundFont. On Debian/Ubuntu:

sudo apt install fluidr3mono-gm-soundfont libfluidsynth3
pip install "mcp-manimgl[audio]"

Auto-discovered SoundFont paths:

  • /usr/share/sounds/sf3/ (.sf3)

  • /usr/share/sounds/sf2/ (.sf2)

  • /usr/share/fluidr3mono-gm-soundfont/

Development

git clone https://github.com/dclavijo/mcp-manimgl.git
cd mcp-manimgl
pip install -e ".[test]"

# run tests
pytest

# format
ruff format src/ tests/

# lint + type check
prospector --with-tool ruff --with-tool mypy src/

# security scan
semgrep --config=auto --severity=ERROR src/

# find unused code
vulture --min-confidence 90 src/

MCP

mcp-name: io.github.dclavijo/mcp-manimgl

Available Tools

58 tools
add_3d_objectD

Inputs: object_type (required), color, properties, fill_opacity. Returns: object

add_arrowD

Inputs: end (required), start (required), color, stroke_width. Returns: object

add_background_musicA

Add background music to the scene.

The music plays from the beginning of the rendered video. Accepts audio files (.mp3, .wav, .ogg) or MIDI files (.mid, .midi). MIDI files are rendered to audio using FluidSynth and a system SoundFont.

When narration tracks are also present, the music volume auto-ducks during narration via sidechain compression in post-processing.

IMPORTANT: Always use MCP tools for scene operations.

Inputs: file_path (required), loop, volume, duck_ratio, +3 more. Returns: object

add_braceD

Inputs: mobject_id (required), color, label, direction. Returns: object

add_circleD

Inputs: color, radius, position, fill_opacity, +1 more. Returns: object

add_coordinate_systemD

Inputs: x_range, y_range, axis_config. Returns: object

add_custom_codeA

Inject custom Python code into the scene script.

The code will be inserted inside the construct() method body. Use this for advanced manim functionality not covered by other tools.

IMPORTANT: Always use MCP tools for scene operations. Do NOT write or execute standalone manim scripts.

Inputs: code_snippet (required). Returns: result

add_decimal_numberD

Inputs: color, value, font_size. Returns: object

add_dotD

Inputs: color, point, radius. Returns: object

add_function_graphD

Inputs: function (required), color, x_range. Returns: object

add_labeled_pointD

Inputs: label (required), point (required), color, dot_radius. Returns: object

add_lineD

Inputs: end (required), start (required), color, stroke_width. Returns: object

add_matrixD

Inputs: rows (required), color. Returns: object

add_narrationA

Generate and add a text-to-speech narration audio track to the scene.

The audio plays at the point in the timeline where this tool is called. Uses Google TTS (gTTS) for voice synthesis.

IMPORTANT: Always use MCP tools for scene operations.

Inputs: text (required), lang. Returns: object

add_number_lineD

Inputs: color, x_range. Returns: object

add_parametric_curveD

Inputs: function (required), color, t_range. Returns: object

add_polygonD

Inputs: vertices (required), color, fill_opacity, stroke_width. Returns: object

add_rectangleD

Inputs: color, width, height, position, +2 more. Returns: object

add_squareD

Inputs: color, position, side_length, fill_opacity, +1 more. Returns: object

add_texD

Inputs: tex_string (required), color, font_size. Returns: object

add_textD

Inputs: text (required), font, color, font_size. Returns: object

add_vectorD

Inputs: vector (required), color. Returns: object

add_waitB

Add a wait/pause to the scene timeline.

IMPORTANT: Always use MCP tools for scene operations.

Inputs: duration. Returns: result

align_toD

Inputs: mobject_id (required), reference_id (required), direction. Returns: result

animate_fade_inD

Inputs: mobject_id (required), run_time, shift_direction. Returns: object

animate_fade_outD

Inputs: mobject_id (required), run_time. Returns: object

animate_groupD

Inputs: animation_data (required), run_time, group_type. Returns: object

animate_growD

Inputs: mobject_id (required), run_time, grow_type. Returns: object

animate_indicateD

Inputs: mobject_id (required), run_time. Returns: object

animate_move_along_pathD

Inputs: mobject_id (required), run_time, path_type, path_config. Returns: object

animate_rotateD

Inputs: mobject_id (required), axis, angle, run_time. Returns: object

animate_scaleD

Inputs: mobject_id (required), scale_factor (required), run_time. Returns: object

animate_set_colorD

Inputs: color (required), mobject_id (required), run_time. Returns: object

animate_shiftD

Inputs: vector (required), mobject_id (required), run_time. Returns: object

animate_transformD

Inputs: mobject_id (required), run_time, rate_func, target_config, +1 more. Returns: object

animate_writeD

Inputs: mobject_id (required), run_time. Returns: object

audio_durationA

Get the duration of any audio file in seconds.

Accepts audio files (.mp3, .wav, .ogg, .mid) created by the server. Uses ffprobe internally.

Inputs: file_path (required). Returns: object

clear_sceneA

Remove all mobjects and animations from the current scene.

IMPORTANT: Always use MCP tools for scene operations.

Returns: True if successful.

Example: >>> clear_scene()

Inputs: no named parameters. Returns: result

create_sceneB

Create a new manimgl scene with the given configuration.

IMPORTANT: Always use MCP tools for scene operations. Do NOT write or execute standalone manim scripts.

Inputs: fps, resolution, frame_height, background_color. Returns: object

generate_scene_scriptA

Generate the full Python script for the current scene.

IMPORTANT: Always use MCP tools for scene operations. Do NOT write or execute standalone manim scripts. Use render_scene() and get_render_result() for rendering instead.

Returns: The complete Python script as a string.

Example: >>> generate_scene_script()

Inputs: no named parameters. Returns: result

get_render_resultA

Poll for the result of an async render started by render_scene().

Returns the render result dict when done, or a "still running" status. Keep polling until status is "completed" or "failed". The caller should use exponential backoff between polls: 1s, 2s, 4s, 8s... (cap at 30s). The count resets when the render completes or fails.

IMPORTANT: Always use this MCP tool for scene operations. Do NOT write or execute standalone manim scripts.

Inputs: render_id (required). Returns: object

get_render_statusA

Check if manimgl and OpenGL are available for rendering.

IMPORTANT: Always use this MCP tool for scene operations. Do NOT write or execute standalone manim scripts.

Returns: Dictionary with availability status of manimgl and OpenGL.

Example: >>> get_render_status()

Inputs: no named parameters. Returns: object

get_scene_infoA

Get the current scene's configuration and element counts.

IMPORTANT: Always use MCP tools for scene operations.

Returns: Scene information including resolution, mobject/animation counts.

Example: >>> get_scene_info()

Inputs: no named parameters. Returns: object

move_toD

Inputs: position (required), mobject_id (required), aligned_edge. Returns: object

next_toD

Inputs: mobject_id (required), reference_id (required), buff, direction. Returns: result

render_sceneA

Render the current scene to a video file.

Renders in the background to avoid MCP timeouts. Returns a render_id immediately. Poll get_render_result() with that render_id to check completion and get the output path.

Inputs: fmt, output_path. Returns: object

restore_stateA

Restore the scene to a previously saved state.

IMPORTANT: Always use MCP tools for scene operations.

Returns: True if state was restored, False if no saved state exists.

Example: >>> restore_state()

Inputs: no named parameters. Returns: result

rotateD

Inputs: angle (required), mobject_id (required), axis, about_point. Returns: result

save_frameA

Save a single frame (image) of the current scene.

IMPORTANT: Always use this MCP tool for scene operations. Do NOT write or execute standalone manim scripts.

Inputs: output_path. Returns: object

save_stateB

Save the current scene state for later restoration.

IMPORTANT: Always use MCP tools for scene operations.

Returns: True if state was saved.

Example: >>> save_state()

Inputs: no named parameters. Returns: result

scaleD

Inputs: mobject_id (required), scale_factor (required), about_point. Returns: result

set_cameraB

Configure the camera position and/or orientation.

IMPORTANT: Always use MCP tools for scene operations.

Inputs: position, orientation. Returns: result

set_colorD

Inputs: color (required), mobject_id (required). Returns: result

set_configC

Set global rendering configuration parameters.

IMPORTANT: Always use MCP tools for scene operations.

Inputs: config (required). Returns: result

set_opacityD

Inputs: opacity (required), mobject_id (required). Returns: result

shiftD

Inputs: vector (required), mobject_id (required). Returns: result

verify_scene_overlapsA

Detect overlapping visual elements (mobjects) in the current scene.

Computes axis-aligned bounding boxes for each mobject based on its stored position and dimension properties (radius, width, height, side_length, font_size). Reports any pair whose bounding boxes intersect.

NOTE: Positions are only reliably updated by move_to(). After shift/scale/rotate/next_to/align_to, the stored position may be stale. Text and TeX dimensions are estimated from font_size and character count — actual rendered glyphs may differ.

Returns: List of overlap reports, each with the pair of overlapping mobjects, their positions, types, and overlap magnitudes.

Example: >>> verify_scene_overlaps()

Inputs: no named parameters. Returns: result

verify_videoA

Inspect a rendered video file and return its technical properties.

Uses ffprobe to extract codec info, streams, duration, resolution, and bitrate. Verifies the file exists and has both video and audio.

IMPORTANT: Always use this MCP tool for scene operations. Do NOT write or execute standalone manim scripts.

Inputs: video_path (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.2/5.0

    Scored across 58 tools

    Disambiguation4/5

    Most tools have clear, specific purposes: add_* creates distinct object types, animate_* handles different animations, and set_*/get_* cover properties and queries. However, some overlap exists between generic tools like add_custom_code and animate_transform, and several add_* tools (e.g., add_vector vs add_arrow, add_function_graph vs add_parametric_curve) could confuse agents, especially with many missing descriptions.

    Naming Consistency5/5

    Tool names follow a consistent verb_noun snake_case pattern: add_* for creation, animate_* for animations, set_* for properties, get_* for queries, and render_* for output. Minor exceptions like audio_duration don't break the overall predictability, and the grouping by prefix makes the set easy to navigate.

    Tool Count2/5

    58 tools is excessive for a scene-builder server. Many similar operations are split into individual tools (18 add_* variants, 12 animate_* variants) that could be consolidated with parameters. While the domain is broad, the count makes the surface unwieldy and difficult for agents to choose from efficiently.

    Completeness4/5

    The set covers the full manim workflow: scene creation, object construction, transformations, animations, rendering, and audio. Gaps include no way to remove individual objects or animations (only clear_scene), and audio tracks once added cannot be removed or replaced. Overall, the core lifecycle is covered with minor dead ends.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers