MCP server exposing manimgl (Manim OpenGL) mathematical animation functionality as tools for LLMs
Project description
mcp-manimgl — MCP server exposing manimgl (Manim OpenGL) mathematical animation functionality as tools for LLMs.
mcp-name: io.github.dclavijo/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]"
Requires manimgl system dependencies (pangocairo, OpenGL). See manimgl docs.
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 sceneclear_scene— Remove all elementsadd_wait— Add wait/pauseset_camera— Configure cameraset_config— Set global rendering configsave_state/restore_state— State managementgenerate_scene_script— Get the generated Python script
Mobject Creation
add_circle,add_square,add_rectangle,add_polygonadd_line,add_arrow,add_dotadd_text,add_tex(LaTeX)add_function_graph,add_parametric_curveadd_coordinate_system,add_vectoradd_labeled_point,add_brace,add_number_lineadd_decimal_number,add_matrixadd_3d_object(sphere, cube, torus, cone, cylinder)
Mobject Manipulation
move_to,shift,scale,rotateset_color,set_opacitynext_to,align_to
Animations
animate_transform,animate_fade_in/out,animate_growanimate_rotate,animate_scale,animate_shiftanimate_indicate,animate_write,animate_set_coloranimate_move_along_path,animate_group
Audio
add_narration— Generate TTS (gTTS) narration that plays at the current timeline positionadd_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 frameget_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:
- Renders the video without audio via manimgl
- Places the music track (looped if needed) at the configured volume
- Places each narration track at its timeline position
- Applies sidechain compression so music volume ducks during narration
- 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.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_manimgl-0.1.0.tar.gz.
File metadata
- Download URL: mcp_manimgl-0.1.0.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26db315330d008bb8475799ed052cd4bdc8778e2e027a094883c5fbe8c71eb4a
|
|
| MD5 |
e142bbf778239e6c3ecb5ad99cf6dd16
|
|
| BLAKE2b-256 |
1f0f2812cf818124d5ab5b83c1fe0755ffbb371048e96a73333d1850d2247dd6
|
Provenance
The following attestation bundles were made for mcp_manimgl-0.1.0.tar.gz:
Publisher:
pypi-publish.yml on daedalus/mcp_manimgl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_manimgl-0.1.0.tar.gz -
Subject digest:
26db315330d008bb8475799ed052cd4bdc8778e2e027a094883c5fbe8c71eb4a - Sigstore transparency entry: 1539783056
- Sigstore integration time:
-
Permalink:
daedalus/mcp_manimgl@9d2850de81f6a1aafb467dcc9c3d9548d23d7b75 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@9d2850de81f6a1aafb467dcc9c3d9548d23d7b75 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file mcp_manimgl-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_manimgl-0.1.0-py3-none-any.whl
- Upload date:
- Size: 30.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1127ca1bad9dd9ff4d87f23e268e5752ff9aba17ffc5ed17f369ee8890b5b3b0
|
|
| MD5 |
7c4b5777fe3229cc57a51daeb8fd52d8
|
|
| BLAKE2b-256 |
3fe0d8282a198c14e42c014991c0baa960d4a068879a0a3796a19580f721b6de
|
Provenance
The following attestation bundles were made for mcp_manimgl-0.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on daedalus/mcp_manimgl
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_manimgl-0.1.0-py3-none-any.whl -
Subject digest:
1127ca1bad9dd9ff4d87f23e268e5752ff9aba17ffc5ed17f369ee8890b5b3b0 - Sigstore transparency entry: 1539783171
- Sigstore integration time:
-
Permalink:
daedalus/mcp_manimgl@9d2850de81f6a1aafb467dcc9c3d9548d23d7b75 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/daedalus
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@9d2850de81f6a1aafb467dcc9c3d9548d23d7b75 -
Trigger Event:
workflow_dispatch
-
Statement type: