io.github.daedalus/mcp-manimgl
MCP server exposing manimgl mathematical animation functionality as tools for LLMs
Versions
0.1.1latest0.1.2Tools 58
set_opacity get_render_result 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. Args: render_id: The render_id returned by render_scene(). Returns: Dictionary with render status and result. Example: >>> get_render_result("abc123def456")
next_to save_frame 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. Args: output_path: Path for the output PNG image. If None, uses a temp file. Returns: Dictionary with frame save result including output_path. Example: >>> save_frame("/tmp/frame.png")
get_render_status 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()
align_to render_scene 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. POLLING PROTOCOL: Use exponential backoff when polling: - 1st call: sleep 1s, then call get_render_result() - 2nd call: sleep 2s, then call - 3rd call: sleep 4s - Nth call: sleep min(2^(N-1), 30)s Reset the backoff once the render completes or fails. Use verify_video() on the output to inspect the result. IMPORTANT: Always use this MCP tool for rendering. Do NOT write or execute standalone manim scripts for scene operations. Args: output_path: Path for the output video file. If None, uses a temp file. fmt: Output format ("mp4", "gif", "mov"). Returns: Dictionary with render_id and status. Example: >>> render_scene("/tmp/my_animation.mp4", "mp4")
set_color verify_video 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. Args: video_path: Path to the video file to inspect. Returns: Dictionary with stream info, duration, resolution, and codecs. Example: >>> verify_video("/tmp/animation.mp4")
add_circle add_square add_rectangle add_polygon add_line add_arrow add_dot add_text add_tex add_function_graph add_parametric_curve add_coordinate_system add_vector add_labeled_point add_3d_object add_brace add_number_line add_decimal_number add_matrix move_to shift scale rotate animate_transform animate_fade_in animate_fade_out animate_grow animate_rotate animate_scale animate_shift animate_indicate animate_write animate_set_color animate_move_along_path animate_group audio_duration Get the duration of any audio file in seconds. Accepts audio files (.mp3, .wav, .ogg, .mid) created by the server. Uses ffprobe internally. Args: file_path: Path to the audio file. Returns: Dictionary with the duration in seconds. Example: >>> audio_duration("/tmp/mcp_manimgl/audio/audio_abc123.mp3")
add_narration 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. Args: text: The text to be spoken in the narration. lang: Language code (default: "en"). See gTTS docs for supported codes. Returns: Dictionary with audio_id, file_path, and status. Example: >>> add_narration("Hello, this is a test narration.") >>> add_narration("Bonjour le monde", "fr")
add_background_music 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. Args: file_path: Path to an audio file or MIDI file. volume: Playback volume 0.0-1.0 (default: 0.3). loop: Loop the music to fill the video duration if shorter (default: False). duck_threshold: Sidechain compression threshold for ducking (default: "-24dB"). duck_ratio: Compression ratio for ducking (default: 4.0). duck_attack: Duck attack time in seconds (default: 0.1). duck_release: Duck release time in seconds (default: 0.5). Returns: Dictionary with audio_id, file_path, and status. Example: >>> add_background_music("/path/to/music.mp3", volume=0.3, loop=True) >>> add_background_music("/path/to/song.mid", volume=0.2)
create_scene 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. Args: background_color: Hex color or named color for the background. resolution: Resolution string like "WxH", e.g. "1920x1080". fps: Frames per second for rendering. frame_height: The height of the coordinate frame in manim units. Returns: Scene configuration dictionary with scene ID. Example: >>> create_scene("#1a1a2e", "1920x1080", 60, 8.0)
get_scene_info 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()
clear_scene Remove all mobjects and animations from the current scene. IMPORTANT: Always use MCP tools for scene operations. Returns: True if successful. Example: >>> clear_scene()
add_wait Add a wait/pause to the scene timeline. IMPORTANT: Always use MCP tools for scene operations. Args: duration: Duration in seconds to wait. Returns: True if successful. Example: >>> add_wait(2.0)
save_state 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()
restore_state 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()
set_camera Configure the camera position and/or orientation. IMPORTANT: Always use MCP tools for scene operations. Args: position: Camera position [x, y, z] in 3D space. orientation: Camera orientation as [theta, phi, gamma] in radians. Returns: True if camera was configured. Example: >>> set_camera([0, 0, -5], [0, 0, 0])
set_config Set global rendering configuration parameters. IMPORTANT: Always use MCP tools for scene operations. Args: config: Dictionary with configuration options. Supported keys: background_color, resolution, fps, frame_height. Returns: True if configuration was applied. Example: >>> set_config({"background_color": "#000000", "fps": 60})
add_custom_code 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. Args: code_snippet: Valid Python code to insert in the scene's construct(). Returns: True if code was added. Example: >>> add_custom_code("self.camera.rotate(2 * PI / 3)")
verify_scene_overlaps 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()
generate_scene_script 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()
Permissions 3
filesystem low shell high env_vars low